Hello Martin,
Thanks for your reply.  My files are all UTF-8.  And, no - never touch
MS Word - pasted in from browser.  Running Linux on dev and production
boxes.
I also looked at Firefox View Source.  The leading mysterious quote
mark is the upward curving opening quote, and the trailing one is the
downward curving closing quote mark - I'm looking for the character
numbers.  My source file is using the regular single quote found on
the keyboard (not the backtick).

See how these characters are inserted inside my vanilla-flavored
single-quoted string containing the model name, which the inflector is
converting to a table name?  All references to the model name in my
source files are using the regular single quote character.  It appears
that the undesired characters are being inserted before and after the
contents of that string by Cake.  I've traced with a debugger to find
where the transformation is happening, but am only close to it;
haven't nailed it yet.

One thing I've found is that with PHP error_reporting set high enough,
Cake generates a fair number of E_NOTICES regarding undefined
constants - the ticket system shows these being fixed on a case-by-
case basis. I think those errors are not necessarily related to this
problem.

Thanks again.  Does this generate any ideas from you or other readers?
- Clark

On Jan 16, 2:30 am, Martin Westin <[email protected]> wrote:
> Hi Clark,
> Looks to me like the thing you are missing is the small problem your
> source-file has with its quotes.
>
> Use of undefined constant â Organizationâ
> This suggests that your modelname is not in fact enclosed by single
> quotes but some other glyph that looks like it but really has another
> ASCII code. You may have pasted the line of code from a browser or
> (god forbid) Word and got the strange character in your file that way.
> If the quotes are not "real" quotes then PHP will interpret this as
> you trying to use a constant.
>
> While you are at it make sure the charset of the php file is not
> something strange.
>
> /Martin
>
> On Jan 16, 12:35 am, clarkphp <[email protected]> wrote:
>
> > Check out the extra quotes in the model name in the WHERE clause
> > below:
>
> > SELECT `Organization`.`name`, `Organization`.`description` FROM
> > `organizations` AS `Organization`   WHERE `‘Organization’`.`status` =
> > 'inactive'   ORDER BY `Organization`.`name` asc
>
> > I've used SimpleTest before, but am now beginning to use it in the
> > context of CakePHP's testing framework.  All test cases that involving
> > a model are failing because the model names are getting enclosed with
> > single quotes, which produces table names in database queries that of
> > course don't exist.  For example:
>
> > App::import('Model', 'Organization');
>
> > class OrganizationTestCase extends CakeTestCase
> > {
> >     public $useTable = 'organizations';
> >     public $fixtures = array('app.organization');
>
> >     public function testInactive()
> >     {
> >         $this->Organization = ClassRegistry::init('Organization');
>
> >         $result = $this->Organization->inactive(array('name',
> > 'description'));
> >         $expected = array(
> >            array('Organization' => array('name' => 'Test Company
> > Name', 'description'    => 'Mortgages'))
> >         );
> >         $this->assertEqual($result, $expected);
> >     }
>
> > }
>
> > results in a failed assertion and two E_NOTICES.
>
> > The failed assertion:
> > Equal expectation fails as [Boolean: false] does not match [Array: 1
> > items] at [/usr/local/apache2/vhosts/dev-obfuscated.com/app/tests/
> > cases/models/organization.test.php line 19]
>
> > The Errors:
> > Unexpected PHP error [Use of undefined constant â Organizationâ -
> > assumed 'â Organizationâ '] severity [E_NOTICE] in [/usr/local/
> > apache2/vhosts/dev-obfuscated.com/cake/libs/class_registry.php line
> > 134]
>
> > Unexpected PHP error [<span style = "color:Red;text-align:left"><b>SQL
> > Error:</b> 1054: Unknown column 'Ã¢â ¬Ë Organizationâ⠬⠢.status'
> > in 'where clause'</span>] severity [E_USER_WARNING] in [/usr/local/
> > apache2/vhosts/dev-obfuscated.com/cake/libs/model/datasources/
> > dbo_source.php line 514]
>
> > The use (or lack of) $useTable in the app/models or tests/cases/models
> > code makes little difference. If I leave out the $useTable statement,
> > the inflector creates this table name: 'organization's generating this
> > message:
> > Error:  Database table ‘organization’s for model Organization was not
> > found.
>
> > What obvious thing am I missing here?
> > Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to