From 58585c5ca81abd96f247d7df4ea54a69e13d486b Mon Sep 17 00:00:00 2001 From: sinbad Date: Thu, 27 Jul 2023 16:53:08 +0500 Subject: [PATCH 01/29] parse multipart/form-data for PUT request --- phalcon/Http/Request.zep | 85 +++++++++++++++++++++++++- tests/unit/Http/Request/GetPutCest.php | 62 +++++++++++++++++++ 2 files changed, 145 insertions(+), 2 deletions(-) diff --git a/phalcon/Http/Request.zep b/phalcon/Http/Request.zep index e9f3f0e65f2..be9ed7e50b1 100644 --- a/phalcon/Http/Request.zep +++ b/phalcon/Http/Request.zep @@ -1721,12 +1721,20 @@ class Request extends AbstractInjectionAware implements RequestInterface, Reques if null === cached { let contentType = this->getContentType(); - if typeof contentType == "string" && stripos(contentType, "json") != false { - let cached = this->getJsonRawBody(true); + if typeof contentType == "string" { + + if (stripos(contentType, "json") != false) { + let cached = this->getJsonRawBody(true); + } + + if (stripos(contentType, "multipart/form-data") !== false) { + let cached = this->getFormData(); + } if typeof cached != "array" { let cached = []; } + } else { let cached = []; @@ -1745,4 +1753,77 @@ class Request extends AbstractInjectionAware implements RequestInterface, Reques noRecursive ); } + + /** + * parse multipart/form-data from raw data + */ + private function getFormData() -> array + { + var boundary, matches; + + preg_match("/boundary=(.*)$/is", this->getContentType(), matches); + + let boundary = matches[1]; + + var bodyParts; + + let bodyParts = preg_split("/\\R?-+" . preg_quote(boundary, "/") . "/s", this->getRawBody()); + + array_pop(bodyParts); + + array dataset = []; + var bodyPart; + + for bodyPart in bodyParts { + if empty(bodyPart) { + continue; + } + + var splited; + let splited = preg_split("/\\R\\R/", bodyPart, 2); + + array headers = []; + var headerParts, headerPart; + + let headerParts = preg_split("/\\R/s", splited[0], -1, PREG_SPLIT_NO_EMPTY); + + for headerPart in headerParts { + if (strpos(headerPart, ":") === false) { + continue; + } + + var exploded, headerName, headerValue; + + let exploded = explode(":", headerPart, 2), + headerName = strtolower(trim(exploded[0])), + headerValue = trim(exploded[1]); + + if strpos(headerValue, ";") !== false { + var explodedHeader, part; + let explodedHeader = explode(";", headerValue); + + for part in explodedHeader { + let part = preg_replace("/\"/", "", trim(part)); + + if strpos(part, "=") !== false { + var explodedPart, namePart, valuePart; + let explodedPart = explode("=", part, 2), + namePart = strtolower(trim(explodedPart[0])), + valuePart = trim(trim(explodedPart[1]), '"'), + headers[headerName][namePart] = valuePart; + + } else { + let headers[headerName][] = part; + } + } + } else { + let headers[headerName] = headerValue; + } + } + + let dataset[headers["content-disposition"]["name"]] = splited[1]; + } + + return dataset; + } } diff --git a/tests/unit/Http/Request/GetPutCest.php b/tests/unit/Http/Request/GetPutCest.php index ed7263546d3..41a174466fd 100644 --- a/tests/unit/Http/Request/GetPutCest.php +++ b/tests/unit/Http/Request/GetPutCest.php @@ -127,4 +127,66 @@ public function httpRequestGetPutJson(UnitTester $I) $_SERVER = $store; } + + /** + * Tests Phalcon\Http\Request :: getPut() - multipart/form-data + * + * @issue @16271 + * @author Phalcon Team + * @since 2023-07-28 + */ + public function httpRequestGetPutMultipartFormData(UnitTester $I) + { + $I->wantToTest('Http\Request - getPut() - multipart/form-data'); + + stream_wrapper_unregister('php'); + stream_wrapper_register('php', PhpStream::class); + + $boundary = md5(microtime()); + + $data = << $time, + 'REQUEST_METHOD' => 'PUT', + 'CONTENT_TYPE' => "multipart/form-data; boundary={$boundary}", + ]; + + $request = new Request(); + + $expected = [ + 'fruit' => 'orange', + 'quantity' => '4', + ]; + + $actual = file_get_contents('php://input'); + + $I->assertSame($data, $actual); + + $I->assertSame( + $expected, + $request->getPut() + ); + + stream_wrapper_restore('php'); + + $_SERVER = $store; + } } From 582bf57ee73b1086bf78ffd2a86bfd929feb3af3 Mon Sep 17 00:00:00 2001 From: sinbad Date: Fri, 28 Jul 2023 12:19:39 +0500 Subject: [PATCH 02/29] update changelog --- CHANGELOG-5.0.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 8e729929767..1b9ca4e6aa4 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,5 +1,12 @@ # Changelog +## [5.2.4](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) + +### Fixed + +- Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) + + ## [5.2.3](https://github.com/phalcon/cphalcon/releases/tag/v5.2.3) (2023-07-26) ### Fixed From ebf388d3cc2a17560e12923ef93ebf8a965bb3f7 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Fri, 18 Nov 2022 10:58:52 -0500 Subject: [PATCH 03/29] minor adjustments --- .../Di/FactoryDefault/Cli/ConstructCest.php | 74 +++++++++++++++++++ .../Di/FactoryDefault/Cli/SetServiceCest.php | 46 ++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 tests/unit/Di/FactoryDefault/Cli/ConstructCest.php create mode 100644 tests/unit/Di/FactoryDefault/Cli/SetServiceCest.php diff --git a/tests/unit/Di/FactoryDefault/Cli/ConstructCest.php b/tests/unit/Di/FactoryDefault/Cli/ConstructCest.php new file mode 100644 index 00000000000..78898b97810 --- /dev/null +++ b/tests/unit/Di/FactoryDefault/Cli/ConstructCest.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Tests\Unit\Di\FactoryDefault\Cli; + +use Codeception\Example; +use Phalcon\Di\Exception; +use Phalcon\Di\FactoryDefault\Cli; +use Phalcon\Tests\Fixtures\Traits\CliTrait; +use UnitTester; + +/** + * Class ConstructCest + * + * @package Phalcon\Tests\Unit\Di\FactoryDefault\Cli + */ +class ConstructCest +{ + use CliTrait; + + /** + * Tests Phalcon\Di\FactoryDefault\Cli :: __construct() + * + * @param UnitTester $I + * + * @author Phalcon Team + * @since 2019-09-09 + */ + public function diFactoryDefaultCliConstruct(UnitTester $I) + { + $I->wantToTest('Di\FactoryDefault\Cli - __construct()'); + + $container = new Cli(); + $services = $this->getServices(); + + $expected = count($services); + $actual = count($container->getServices()); + $I->assertEquals($expected, $actual); + } + + /** + * Tests Phalcon\Di\FactoryDefault\Cli :: __construct() - Check services + * + * @dataProvider getServices + * + * @param UnitTester $I + * @param Example $example + * + * @throws Exception + * + * @author Phalcon Team + * @since 2019-09-09 + */ + public function diFactoryDefaultCliConstructServices(UnitTester $I, Example $example) + { + $I->wantToTest('Di\FactoryDefault\Cli - __construct() - Check services'); + + $container = new Cli(); + + $class = $example['class']; + $actual = $container->get($example['service']); + $I->assertInstanceOf($class, $actual); + } +} diff --git a/tests/unit/Di/FactoryDefault/Cli/SetServiceCest.php b/tests/unit/Di/FactoryDefault/Cli/SetServiceCest.php new file mode 100644 index 00000000000..10e2f409793 --- /dev/null +++ b/tests/unit/Di/FactoryDefault/Cli/SetServiceCest.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Tests\Unit\Di\FactoryDefault\Cli; + +use Phalcon\Di\FactoryDefault; +use Phalcon\Di\Service; +use Phalcon\Html\Escaper; +use UnitTester; + +/** + * Class SetServiceCest + * + * @package Phalcon\Tests\Unit\Di\FactoryDefault\Cli + */ +class SetServiceCest +{ + /** + * Unit Tests Phalcon\Di\FactoryDefault\Cli :: setService() + * + * @param UnitTester $I + * + * @author Phalcon Team + * @since 2019-09-09 + */ + public function diFactoryDefaultCliSetRaw(UnitTester $I) + { + $I->wantToTest('Di\FactoryDefault\Cli - setService()'); + + $container = new FactoryDefault\Cli(); + + $expected = new Service(Escaper::class); + $actual = $container->setService('escaper', $expected); + $I->assertSame($expected, $actual); + } +} From 085153484e7046847528a1316ff06743e4c048b8 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Fri, 18 Nov 2022 10:59:12 -0500 Subject: [PATCH 04/29] clearing reusable cache on getRelated delete --- phalcon/Mvc/Model.zep | 23 ++- tests/database/Mvc/Model/DeleteCest.php | 226 +++++++++++++++++------- 2 files changed, 180 insertions(+), 69 deletions(-) diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index d69d364438a..1cc7fac3eb2 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -1267,7 +1267,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, success; array values, bindTypes, conditions; - let metaData = this->getModelsMetaData(), + let metaData = this->getModelsMetaData(), writeConnection = this->getWriteConnection(); /** @@ -1285,11 +1285,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, } } - let values = [], - bindTypes = [], + let values = [], + bindTypes = [], conditions = []; - let primaryKeys = metaData->getPrimaryKeyAttributes(this), + let primaryKeys = metaData->getPrimaryKeyAttributes(this), bindDataTypes = metaData->getBindTypes(this); if globals_get("orm.column_renaming") { @@ -1340,7 +1340,8 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !fetch value, this->{attributeField} { throw new Exception( - "Cannot delete the record because the primary key attribute: '" . attributeField . "' was not set" + "Cannot delete the record because the primary key attribute: '" + . attributeField . "' was not set" ); } @@ -1405,6 +1406,15 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, } } + /** + * Clear related records from the internal cache so that next time + * we can get proper counts. + */ + if (success) { + let this->related = []; + this->modelsManager->clearReusableObjects(); + } + /** * Force perform the record existence checking again */ @@ -2046,7 +2056,8 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof relation !== "object" { throw new Exception( - "There is no defined relations for the model '" . className . "' using alias '" . alias . "'" + "There is no defined relations for the model '" + . className . "' using alias '" . alias . "'" ); } diff --git a/tests/database/Mvc/Model/DeleteCest.php b/tests/database/Mvc/Model/DeleteCest.php index a4f7c445641..359b4816d30 100644 --- a/tests/database/Mvc/Model/DeleteCest.php +++ b/tests/database/Mvc/Model/DeleteCest.php @@ -36,15 +36,6 @@ public function _before(DatabaseTester $I) { $this->setNewFactoryDefault(); $this->setDatabase($I); - - /** @var PDO $connection */ - $connection = $I->getConnection(); - - $customersMigration = new CustomersMigration($connection); - $customersMigration->clear(); - - $invoicesMigration = new InvoicesMigration($connection); - $invoicesMigration->clear(); } /** @@ -104,7 +95,6 @@ public function mvcModelDeleteCascadeRelated(DatabaseTester $I) $lastName = uniqid('cust-', true); $customersMigration = new CustomersMigration($connection); - $customersMigration->clear(); $customersMigration->insert($custId, 0, $firstName, $lastName); $paidInvoiceId = 4; @@ -113,7 +103,6 @@ public function mvcModelDeleteCascadeRelated(DatabaseTester $I) $title = uniqid('inv-'); $invoicesMigration = new InvoicesMigration($connection); - $invoicesMigration->clear(); $invoicesMigration->insert( $paidInvoiceId, $custId, @@ -132,36 +121,159 @@ public function mvcModelDeleteCascadeRelated(DatabaseTester $I) */ $customer = Customers::findFirst($custId); - $I->assertEquals( - 2, - $customer->invoices->count() - ); + $expected = 2; + $actual = $customer->invoices->count(); + $I->assertSame($expected, $actual); - $I->assertEquals( - 1, - $customer->paidInvoices->count() - ); + $expected = 1; + $actual = $customer->paidInvoices->count(); + $I->assertSame($expected, $actual); - $I->assertEquals( - 1, - $customer->unpaidInvoices->count() - ); + $expected = 1; + $actual = $customer->unpaidInvoices->count(); + $I->assertSame($expected, $actual); - $I->assertTrue( - $customer->delete() - ); + $actual = $customer->delete(); + $I->assertTrue($actual); $invoices = Invoices::find(); - $I->assertEquals( - 1, - $invoices->count() + $expected = 1; + $actual = $invoices->count(); + $I->assertSame($expected, $actual); + + $expected = $unpaidInvoiceId; + $actual = $invoices[0]->inv_id; + $I->assertSame($expected, $actual); + } + + /** + * Tests Phalcon\Mvc\Model :: delete() from getRelated + * + * @author Phalcon Team + * @since 2022-11-18 + * + * @group mysql + * @group pgsql + * @group sqlite + */ + public function mvcModelDeleteGetRelated(DatabaseTester $I) + { + $I->wantToTest('Mvc\Model - delete() from getRelated'); + + /** @var PDO $connection */ + $connection = $I->getConnection(); + + $custId = 2; + $firstName = uniqid('cust-', true); + $lastName = uniqid('cust-', true); + + /** + * Set up a customer + */ + $customersMigration = new CustomersMigration($connection); + $customersMigration->insert($custId, 0, $firstName, $lastName); + + $paidInvoiceId = 40; + $unpaidInvoiceId = 50; + + $title = uniqid('inv-'); + + /** + * Set up invoices for the customer + * + * 2 paid + * 3 unpaid + */ + $invoicesMigration = new InvoicesMigration($connection); + $invoicesMigration->insert( + 40, + $custId, + Invoices::STATUS_PAID, + $title . '-paid' + ); + $invoicesMigration->insert( + 41, + $custId, + Invoices::STATUS_PAID, + $title . '-paid' ); - $I->assertEquals( - $unpaidInvoiceId, - $invoices[0]->inv_id + $invoicesMigration->insert( + 50, + $custId, + Invoices::STATUS_PAID, + $title . '-paid' + ); + $invoicesMigration->insert( + 51, + $custId, + Invoices::STATUS_PAID, + $title . '-paid' ); + $invoicesMigration->insert( + 52, + $custId, + Invoices::STATUS_PAID, + $title . '-paid' + ); + + /** + * Get the customer from the database + * + * @var Customers $customer + */ + $customer = Customers::findFirst($custId); + + /** + * Check for the number of invoices + */ + $expected = 5; + $actual = $customer->invoices->count(); + $I->assertSame($expected, $actual); + + /** + * Get paid invoices using the property + */ + $invoices = $customer->paidInvoices; + /** @var Invoices $invoice */ + foreach ($invoices as $invoice) { + if ($invoice->inv_id < 50) { + $actual = $invoice->delete(); + $I->assertTrue($actual); + } + } + + /** + * Just in case for a refresh + * + * @var Customers $customer + */ + $customer = Customers::findFirst($custId); + + /** + * Check for the number of invoices + */ + $expected = 3; + $actual = $customer->invoices->count(); + $I->assertSame($expected, $actual); + + /** + * Get unpaid invoices using getRelated() + */ + $invoices = $customer->getRelated('invoices'); + /** @var Invoices $invoice */ + foreach ($invoices as $invoice) { + $actual = $invoice->delete(); + $I->assertTrue($actual); + } + + /** + * Check for the number of invoices + */ + $expected = 0; + $actual = $customer->invoices->count(); + $I->assertSame($expected, $actual); } /** @@ -187,13 +299,11 @@ public function mvcModelDeleteRestrictRelated(DatabaseTester $I) $lastName = uniqid('cust-', true); $customersMigration = new CustomersMigration($connection); - $customersMigration->clear(); $customersMigration->insert($customerId, 0, $firstName, $lastName); $title = uniqid('inv-'); $invoicesMigration = new InvoicesMigration($connection); - $invoicesMigration->clear(); $invoicesMigration->insert( 1, $customerId, @@ -206,24 +316,20 @@ public function mvcModelDeleteRestrictRelated(DatabaseTester $I) */ $customer = Customers::findFirst($customerId); - $I->assertEquals( - 1, - $customer->inactiveInvoices->count() - ); + $expected = 1; + $actual = $customer->inactiveInvoices->count(); + $I->assertSame($expected, $actual); - $I->assertFalse( - $customer->delete() - ); + $actual = $customer->delete(); + $I->assertFalse($actual); - $I->assertCount( - 1, - $customer->getMessages() - ); + $expected = 1; + $actual = $customer->getMessages(); + $I->assertCount($expected, $actual); - $I->assertEquals( - 'Record is referenced by model ' . Invoices::class, - current($customer->getMessages())->getMessage() - ); + $expected = 'Record is referenced by model ' . Invoices::class; + $actual = current($customer->getMessages())->getMessage(); + $I->assertSame($expected, $actual); } /** @@ -255,13 +361,11 @@ public function mvcModelDeleteRestrictRelatedInTransaction(DatabaseTester $I) $lastName = uniqid('cust-', true); $customersMigration = new CustomersMigration($connection); - $customersMigration->clear(); $customersMigration->insert($customerId, 0, $firstName, $lastName); $title = uniqid('inv-'); $invoicesMigration = new InvoicesMigration($connection); - $invoicesMigration->clear(); $invoicesMigration->insert( $invoiceId, $customerId, @@ -296,33 +400,29 @@ public function mvcModelDeleteRestrictRelatedInTransaction(DatabaseTester $I) /** * Make sure foreign key restrict works */ - $I->assertFalse( - $customer->delete() - ); + $actual = $customer->delete(); + $I->assertFalse($actual); /** * Step 3: * Delete Model B first so that Model A passes FK constraint check successfully */ - $I->assertTrue( - $invoice->delete() - ); + $actual = $invoice->delete(); + $I->assertTrue($actual); /** * Step 4: * Then try to delete Model A */ - $I->assertTrue( - $customer->delete() - ); + $actual = $customer->delete(); + $I->assertTrue($actual); $transaction->rollback(); /** * Test again foreign key restrict */ - $I->assertFalse( - $customer->delete() - ); + $actual = $customer->delete(); + $I->assertFalse($actual); } } From bdeb25d11b704470fc984ae096e8a2957e01cbab Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Fri, 18 Nov 2022 11:35:33 -0500 Subject: [PATCH 05/29] fixing cli tests --- tests/_data/fixtures/Traits/CliTrait.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/_data/fixtures/Traits/CliTrait.php b/tests/_data/fixtures/Traits/CliTrait.php index 629b01bbeb7..13712cc21b5 100644 --- a/tests/_data/fixtures/Traits/CliTrait.php +++ b/tests/_data/fixtures/Traits/CliTrait.php @@ -13,12 +13,16 @@ namespace Phalcon\Tests\Fixtures\Traits; +use Phalcon\Annotations\Adapter\Memory; use Phalcon\Cli\Dispatcher; use Phalcon\Cli\Router; use Phalcon\Encryption\Security; use Phalcon\Events\Manager as EventsManager; use Phalcon\Filter\Filter; use Phalcon\Html\Escaper; +use Phalcon\Mvc\Model\Manager; +use Phalcon\Mvc\Model\MetaData\Memory as MetadataMemory; +use Phalcon\Mvc\Model\Transaction\Manager as TransactionManager; use Phalcon\Support\HelperFactory; trait CliTrait @@ -80,6 +84,10 @@ protected function getExamplesShortPaths(): array private function getServices(): array { return [ + [ + 'service' => 'annotations', + 'class' => Memory::class, + ], [ 'service' => 'dispatcher', 'class' => Dispatcher::class, @@ -100,6 +108,14 @@ private function getServices(): array 'service' => 'helper', 'class' => HelperFactory::class, ], + [ + 'service' => 'modelsManager', + 'class' => Manager::class, + ], + [ + 'service' => 'modelsMetadata', + 'class' => MetadataMemory::class, + ], [ 'service' => 'router', 'class' => Router::class, @@ -108,6 +124,10 @@ private function getServices(): array 'service' => 'security', 'class' => Security::class, ], + [ + 'service' => 'transactionManager', + 'class' => TransactionManager::class, + ], ]; } } From a7ac0bc35aa78a78f8e188f8da6ea16991e98ef0 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Sun, 30 Jul 2023 13:47:40 -0400 Subject: [PATCH 06/29] adjusting test --- tests/database/Mvc/Model/GetRelatedCest.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tests/database/Mvc/Model/GetRelatedCest.php b/tests/database/Mvc/Model/GetRelatedCest.php index 083e9388c44..f8fa851a086 100644 --- a/tests/database/Mvc/Model/GetRelatedCest.php +++ b/tests/database/Mvc/Model/GetRelatedCest.php @@ -221,22 +221,5 @@ public function mvcModelGetRelatedChangeForeignKey(DatabaseTester $I) $expected = $custIdTwo; $actual = $customer->cst_id; $I->assertEquals($expected, $actual); - - /** - * Delete Customer Two and call getRelated again. We should get - * the cached copy - */ - $result = $customer->delete(); - $I->assertTrue($result); - - /** @var Customers $customer */ - $customer = $invoice->getRelated('customer'); - - $class = Customers::class; - $I->assertInstanceOf($class, $customer); - - $expected = $custIdTwo; - $actual = $customer->cst_id; - $I->assertEquals($expected, $actual); } } From 696ea528cc45902acfc2b6f90f1e853bb36d39d7 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Sun, 30 Jul 2023 14:40:30 -0400 Subject: [PATCH 07/29] correting test --- tests/_data/fixtures/Traits/CliTrait.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/_data/fixtures/Traits/CliTrait.php b/tests/_data/fixtures/Traits/CliTrait.php index 13712cc21b5..b04e09bbd8b 100644 --- a/tests/_data/fixtures/Traits/CliTrait.php +++ b/tests/_data/fixtures/Traits/CliTrait.php @@ -20,6 +20,7 @@ use Phalcon\Events\Manager as EventsManager; use Phalcon\Filter\Filter; use Phalcon\Html\Escaper; +use Phalcon\Html\TagFactory; use Phalcon\Mvc\Model\Manager; use Phalcon\Mvc\Model\MetaData\Memory as MetadataMemory; use Phalcon\Mvc\Model\Transaction\Manager as TransactionManager; @@ -124,6 +125,10 @@ private function getServices(): array 'service' => 'security', 'class' => Security::class, ], + [ + 'service' => 'tag', + 'class' => TagFactory::class, + ], [ 'service' => 'transactionManager', 'class' => TransactionManager::class, From 6c65a50585b859c9c9d18a5d390440e346375ad5 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Sun, 30 Jul 2023 15:51:55 -0400 Subject: [PATCH 08/29] test corrections --- tests/database/Mvc/Model/DeleteCest.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/database/Mvc/Model/DeleteCest.php b/tests/database/Mvc/Model/DeleteCest.php index 359b4816d30..021669fc3ef 100644 --- a/tests/database/Mvc/Model/DeleteCest.php +++ b/tests/database/Mvc/Model/DeleteCest.php @@ -123,15 +123,15 @@ public function mvcModelDeleteCascadeRelated(DatabaseTester $I) $expected = 2; $actual = $customer->invoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); $expected = 1; $actual = $customer->paidInvoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); $expected = 1; $actual = $customer->unpaidInvoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); $actual = $customer->delete(); $I->assertTrue($actual); @@ -140,11 +140,11 @@ public function mvcModelDeleteCascadeRelated(DatabaseTester $I) $expected = 1; $actual = $invoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); $expected = $unpaidInvoiceId; $actual = $invoices[0]->inv_id; - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); } /** @@ -230,7 +230,7 @@ public function mvcModelDeleteGetRelated(DatabaseTester $I) */ $expected = 5; $actual = $customer->invoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); /** * Get paid invoices using the property @@ -256,7 +256,7 @@ public function mvcModelDeleteGetRelated(DatabaseTester $I) */ $expected = 3; $actual = $customer->invoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); /** * Get unpaid invoices using getRelated() @@ -273,7 +273,7 @@ public function mvcModelDeleteGetRelated(DatabaseTester $I) */ $expected = 0; $actual = $customer->invoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); } /** @@ -318,7 +318,7 @@ public function mvcModelDeleteRestrictRelated(DatabaseTester $I) $expected = 1; $actual = $customer->inactiveInvoices->count(); - $I->assertSame($expected, $actual); + $I->assertEquals($expected, $actual); $actual = $customer->delete(); $I->assertFalse($actual); From 11b830e1d1801038616d0ab3381db593c8301116 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 26 Jul 2023 18:33:58 -0400 Subject: [PATCH 09/29] adjusting api doc generation --- tests/_config/generate-api-docs.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/_config/generate-api-docs.php b/tests/_config/generate-api-docs.php index 820dc786210..d6c964c7125 100644 --- a/tests/_config/generate-api-docs.php +++ b/tests/_config/generate-api-docs.php @@ -51,6 +51,7 @@ layout: default title: '{$document['title']}' --- +{%- include env-setup.html -%} "; foreach ($document['docs'] as $file) { $link = str_replace(['.zep', DIRECTORY_SEPARATOR], ['', '\\'], $file); @@ -86,7 +87,7 @@

{$signature}

-[Source on GitHub](https://github.com/phalcon/cphalcon/blob/v{{ pageVersion }}.0/phalcon/{$github}) +[Source on GitHub](https://github.com/phalcon/cphalcon/blob/{{ pageVersion }}.x/phalcon/{$github}) "; if (!empty($namespace)) { From 837dcd6ea4d7b3503b9716cdbc58b853f49ca7b1 Mon Sep 17 00:00:00 2001 From: Rudi Servo Date: Sun, 6 Aug 2023 16:20:28 +0000 Subject: [PATCH 10/29] Refactored Model, added Loader::isRegistered [#16391] --- CHANGELOG-5.0.md | 7 + phalcon/Autoload/Loader.zep | 10 + phalcon/Mvc/Model.zep | 423 ++++++++++-------- tests/database/Mvc/Model/FindFirstCest.php | 2 +- .../Mvc/Model/UnderscoreCallStaticCest.php | 4 +- .../database/Mvc/Model/UnderscoreGetCest.php | 2 +- 6 files changed, 251 insertions(+), 197 deletions(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 1b9ca4e6aa4..23084bcec28 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -2,6 +2,13 @@ ## [5.2.4](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) +### Added +- Added `Phalcon\Mvc\Model::appendMessagedFrom` for code consistency and to add messages from another another model. [#16391](https://github.com/phalcon/cphalcon/issues/16391) +- Added `Phalcon\Autoload\Loader::isRegistered` for debugging purposes [#16391](https://github.com/phalcon/cphalcon/issues/16391) + +### Changed +- Refactored `Phalcon\Mvc\Model::doLowUpdate` and `Phalcon\Mvc\Model::postSaveRelatedRecords` for better code logic and a clearer seperation of behaviour although it lead to partially repeated code.[#16391](https://github.com/phalcon/cphalcon/issues/16391) + ### Fixed - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) diff --git a/phalcon/Autoload/Loader.zep b/phalcon/Autoload/Loader.zep index 9cafe960e3f..93f67188489 100644 --- a/phalcon/Autoload/Loader.zep +++ b/phalcon/Autoload/Loader.zep @@ -510,6 +510,16 @@ class Loader extends AbstractEventsAware return this; } + /** + * returns isRegister + * + * @return bool + */ + public function isRegistered() -> bool + { + return this->isRegistered; + } + /** * If the file exists, require it and return true; false otherwise * diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index 1cc7fac3eb2..7a9c65e2d95 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -178,7 +178,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if container === null { throw new Exception( - "A dependency injection container is required to access the services related to the ODM" + "A dependency injection container is required to access the services related to the ODM in '" . get_class(this) . "'" ); } @@ -191,7 +191,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let modelsManager = container->getShared("modelsManager"); if modelsManager === null { throw new Exception( - "The injected service 'modelsManager' is not valid" + "The injected service 'modelsManager' is not valid in '" . get_class(this) . "'" ); } } @@ -518,7 +518,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !manager->isVisibleModelProperty(this, property) { throw new Exception( - "Cannot access property '" . property . "' (not public)." + "Cannot access property '" . property . "' (not public) in '" . get_class(this) . "'" ); } } @@ -547,7 +547,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let container = Di::getDefault(); if container === null { throw new Exception( - "A dependency injection container is required to access the services related to the ODM" + "A dependency injection container is required to access the services related to the ODM in '" . get_class(this) . "'" ); } @@ -562,7 +562,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let manager = container->getShared("modelsManager"); if manager === null { throw new Exception( - "The injected service 'modelsManager' is not valid" + "The injected service 'modelsManager' is not valid in '" . get_class(this) . "'" ); } @@ -776,7 +776,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attributeField, columnMap[attribute] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . attribute. "' doesn't make part of the column map" + "Column '" . attribute. "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -882,7 +882,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, for key, value in data { if unlikely typeof key !== "string" { throw new Exception( - "Invalid key in array data provided to dumpResult()" + "Invalid key in array data provided to dumpResult() in '" . get_class(base) . "'" ); } @@ -952,7 +952,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attribute, reverseMap[key] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(base) . "'" ); } @@ -961,7 +961,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, } else { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(base) . "'" ); } @@ -1087,6 +1087,9 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if !fetch attribute, columnMap[key] { if unlikely !globals_get("orm.ignore_unknown_columns") { + /** + * @todo unless we pass the model name in the funciton we cannot tell what model has this problem + */ throw new Exception( "Column '" . key . "' doesn't make part of the column map" ); @@ -1232,7 +1235,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, new Message( "Record cannot be created because it already exists", null, - "InvalidCreateAttempt" + "InvalidCreateAttempt", + 0, + [ + "model": get_class(this) + ] ) ]; @@ -1303,7 +1310,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !count(primaryKeys) { throw new Exception( - "A primary key must be defined in the model in order to perform the operation" + "A primary key must be defined in the model in order to perform the operation in '" . get_class(this) . "'" ); } @@ -1317,7 +1324,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !fetch bindType, bindDataTypes[primaryKey] { throw new Exception( - "Column '" . primaryKey . "' have not defined a bind data type" + "Column '" . primaryKey . "' have not defined a bind data type in '" . get_class(this) . "'" ); } @@ -1327,7 +1334,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if typeof columnMap == "array" { if unlikely !fetch attributeField, columnMap[primaryKey] { throw new Exception( - "Column '" . primaryKey . "' isn't part of the column map" + "Column '" . primaryKey . "' isn't part of the column map in '" . get_class(this) . "'" ); } } else { @@ -1341,7 +1348,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !fetch value, this->{attributeField} { throw new Exception( "Cannot delete the record because the primary key attribute: '" - . attributeField . "' was not set" + . attributeField . "' was not set in '" . get_class(this) . "'" ); } @@ -1746,7 +1753,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let params = [parameters]; } else { throw new Exception( - "Parameters passed must be of type array, string, numeric or null" + "Parameters passed must be of type array, string, numeric or null in '" . get_called_class() . "'" ); } @@ -1832,7 +1839,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof snapshot !== "array" { throw new Exception( - "The 'keepSnapshots' option must be enabled to track changes" + "The 'keepSnapshots' option must be enabled to track changes in '" . get_class(this) . "'" ); } @@ -1981,7 +1988,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof metaData != "object" { throw new Exception( - "The injected service 'modelsMetadata' is not valid" + "The injected service 'modelsMetadata' is not valid in '" . get_class(this) . "'" ); } @@ -2181,7 +2188,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !globals_get("orm.update_snapshot_on_save") { throw new Exception( - "The 'updateSnapshotOnSave' option must be enabled for this method to work properly" + "The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '" . get_class(this) . "'" ); } @@ -2196,7 +2203,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely this->dirtyState != self::DIRTY_STATE_PERSISTENT { throw new Exception( - "Change checking cannot be performed because the object has not been persisted or is deleted" + "Change checking cannot be performed because the object has not been persisted or is deleted in '" . get_class(this) . "'" ); } @@ -2462,7 +2469,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely this->dirtyState != self::DIRTY_STATE_PERSISTENT { throw new Exception( - "The record cannot be refreshed because it does not exist or is deleted" + "The record cannot be refreshed because it does not exist or is deleted in '" . get_class(this) . "'" ); } @@ -2487,7 +2494,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !this->has(metaData, readConnection) { throw new Exception( - "The record cannot be refreshed because it does not exist or is deleted" + "The record cannot be refreshed because it does not exist or is deleted in '" . get_class(this) . "'" ); } @@ -2498,7 +2505,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof uniqueParams != "array" { throw new Exception( - "The record cannot be refreshed because it does not exist or is deleted" + "The record cannot be refreshed because it does not exist or is deleted in '" . get_class(this) . "'" ); } @@ -2783,7 +2790,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let container = Di::getDefault(); if container === null { throw new Exception( - "A dependency injection container is required to access the services related to the ODM" + "A dependency injection container is required to access the services related to the ODM in '" . get_class(this) . "'" ); } @@ -2799,7 +2806,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof manager !== "object" { throw new Exception( - "The injected service 'modelsManager' is not valid" + "The injected service 'modelsManager' is not valid in '" . get_class(this) . "'" ); } @@ -2920,7 +2927,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attribute, columnMap[key] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -2931,7 +2938,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attribute, attribute[0] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -2985,7 +2992,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attribute, columnMap[key] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -2996,7 +3003,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attribute, attribute[0] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . key . "' doesn't make part of the column map" + "Column '" . key . "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -3260,7 +3267,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if !fetch attributeField, columnMap[attribute] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . attribute . "' doesn't make part of the column map" + "Column '" . attribute . "' doesn't make part of the column map in '" . get_class(this) . "'" ); } @@ -3315,7 +3322,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, new Message( "Record cannot be updated because it does not exist", null, - "InvalidUpdateAttempt" + "InvalidUpdateAttempt", + 0, + [ + "model": get_class(this) + ] ) ]; @@ -3481,7 +3492,12 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, new Message( message, fields, - "ConstraintViolation" + "ConstraintViolation", + 0, + [ + "model": get_class(this), + "referenceModel" : relation->getReferencedModel() + ] ) ); @@ -3643,7 +3659,12 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, new Message( message, fields, - "ConstraintViolation" + "ConstraintViolation", + 0, + [ + "model": get_class(this), + "referenceModel" : relationClass + ] ) ); @@ -3711,7 +3732,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if typeof columnMap === "array" { if unlikely !fetch attributeField, columnMap[field] { throw new Exception( - "Column '" . field . "' isn't part of the column map" + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" ); } } else { @@ -3746,7 +3767,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !fetch bindType, bindDataTypes[field] { throw new Exception( - "Column '" . field . "' have not defined a bind data type" + "Column '" . field . "' in '" . get_class(this) . "' have not defined a bind data type" ); } @@ -3797,7 +3818,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if typeof columnMap == "array" { if unlikely !fetch attributeField, columnMap[identityField] { throw new Exception( - "Identity column '" . identityField . "' isn't part of the column map" + "Identity column '" . identityField . "' isn't part of the column map in '" . get_class(this) . "'" ); } } else { @@ -3826,7 +3847,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !fetch bindType, bindDataTypes[identityField] { throw new Exception( - "Identity column '" . identityField . "' isn\'t part of the table columns" + "Identity column '" . identityField . "' isn\'t part of the table columns in '" . get_class(this) . "'" ); } @@ -3941,12 +3962,6 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let useDynamicUpdate = (bool) manager->isUsingDynamicUpdate(this), snapshot = this->snapshot; - if useDynamicUpdate { - if typeof snapshot !== "array" { - let useDynamicUpdate = false; - } - } - let dataTypes = metaData->getDataTypes(this), bindDataTypes = metaData->getBindTypes(this), nonPrimary = metaData->getNonPrimaryKeyAttributes(this), @@ -3958,52 +3973,37 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let columnMap = null; } - /** - * We only make the update based on the non-primary attributes, values - * in primary key attributes are ignored - */ - for field in nonPrimary { - /** - * Check if the model has a column map - */ - if typeof columnMap === "array" { - if unlikely !fetch attributeField, columnMap[field] { - if unlikely !globals_get("orm.ignore_unknown_columns") { + if useDynamicUpdate && typeof snapshot !== "array" { + for field in nonPrimary { + let changed = false; + if typeof columnMap === "array" { + if unlikely !fetch attributeField, columnMap[field] { + if unlikely !globals_get("orm.ignore_unknown_columns") { + throw new Exception( + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" + ); + } + } + } else { + let attributeField = field; + } + if !isset automaticAttributes[attributeField] { + /** + * Check a bind type for field to update + */ + if unlikely !fetch bindType, bindDataTypes[field] { throw new Exception( - "Column '" . field . "' isn't part of the column map" + "Column '" . field . "' in '" . get_class(this) . "' have not defined a bind data type" ); } - } - } else { - let attributeField = field; - } - - if !isset automaticAttributes[attributeField] { - /** - * Check a bind type for field to update - */ - if unlikely !fetch bindType, bindDataTypes[field] { - throw new Exception( - "Column '" . field . "' have not defined a bind data type" - ); - } - - /** - * Get the field's value - * If a field isn't set we pass a null value - */ - if fetch value, this->{attributeField} { /** - * When dynamic update is not used we pass every field to the update + * Get the field's value + * If a field isn't set there was no change */ - if !useDynamicUpdate { - let fields[] = field, - values[] = value; - let bindTypes[] = bindType; - } else { + if fetch value, this->{attributeField} { /** - * If the field is not part of the snapshot we add them as changed - */ + * If the field is not part of the snapshot we add them as changed + */ if !fetch snapshotValue, snapshot[attributeField] { let changed = true; } else { @@ -4023,13 +4023,13 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, } else { if unlikely !fetch dataType, dataTypes[field] { throw new Exception( - "Column '" . field . "' have not defined a data type" + "Column '" . field . "' in '" . get_class(this) . "' have not defined a data type" ); } /** - * Get actual values before comparison - */ + * Get actual values before comparison + */ if is_object(snapshotValue) && snapshotValue instanceof RawValue { let snapshotValue = snapshotValue->getValue(); } @@ -4062,44 +4062,91 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, break; /** - * Any other type is not really supported... - */ + * Any other type is not really supported... + */ default: let changed = updateValue != snapshotValue; } } } } - /** - * Only changed values are added to the SQL Update - */ + * Only changed values are added to the SQL Update + */ if changed { let fields[] = field, values[] = value, bindTypes[] = bindType; } + let newSnapshot[attributeField] = value; + } else { + let newSnapshot[attributeField] = null; + } + } + } + /** + * If there is no fields to update we return true + */ + if !count(fields) { + let this->oldSnapshot = snapshot; + return true; + } + } else { + /** + * We only make the update based on the non-primary attributes, values + * in primary key attributes are ignored + */ + for field in nonPrimary { + /** + * Check if the model has a column map + */ + if typeof columnMap === "array" { + if unlikely !fetch attributeField, columnMap[field] { + if unlikely !globals_get("orm.ignore_unknown_columns") { + throw new Exception( + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" + ); + } } - let newSnapshot[attributeField] = value; - } else { - let newSnapshot[attributeField] = null; + let attributeField = field; + } - let fields[] = field, - values[] = null, - bindTypes[] = bindSkip; + if !isset automaticAttributes[attributeField] { + /** + * Check a bind type for field to update + */ + if unlikely !fetch bindType, bindDataTypes[field] { + throw new Exception( + "Column '" . field . "' in '" . get_class(this) . "' have not defined a bind data type" + ); + } + + /** + * Get the field's value + * If a field isn't set we pass a null value + */ + if fetch value, this->{attributeField} { + /** + * When dynamic update is not used we pass every field to the update + */ + let fields[] = field, + values[] = value; + let bindTypes[] = bindType; + let newSnapshot[attributeField] = value; + } else { + let newSnapshot[attributeField] = null; + let fields[] = field, + values[] = null, + bindTypes[] = bindSkip; + } } } } - /** * If there is no fields to update we return true */ if !count(fields) { - if useDynamicUpdate { - let this->oldSnapshot = snapshot; - } - return true; } @@ -4117,7 +4164,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ if unlikely !count(primaryKeys) { throw new Exception( - "A primary key must be defined in the model in order to perform the operation" + "A primary key must be defined in the model in order to perform the operation in '" . get_class(this) . "'" ); } @@ -4130,7 +4177,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if typeof columnMap == "array" { if unlikely !fetch attributeField, columnMap[field] { throw new Exception( - "Column '" . field . "' isn't part of the column map" + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" ); } } else { @@ -4233,7 +4280,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if typeof columnMap === "array" { if unlikely !fetch attributeField, columnMap[field] { throw new Exception( - "Column '" . field . "' isn't part of the column map" + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" ); } } else { @@ -4263,7 +4310,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !fetch type, bindDataTypes[field] { throw new Exception( - "Column '" . field . "' isn't part of the table columns" + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the table columns" ); } @@ -4558,7 +4605,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !isset arguments[0] { throw new Exception( - "The static method '" . method . "' requires one argument" + "The static method '" . method . "' in '" . get_called_class() . "' requires one argument" ); } @@ -4595,7 +4642,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !isset attributes[field] { throw new Exception( - "Cannot resolve attribute '" . extraMethod . "' in the model" + "Cannot resolve attribute '" . extraMethod . "' in the model '" . get_called_class() . "'" ); } } @@ -4756,7 +4803,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely !fetch attributeField, columnMap[field] { if unlikely !globals_get("orm.ignore_unknown_columns") { throw new Exception( - "Column '" . field . "' isn't part of the column map" + "Column '" . field . "' in '" . get_class(this) . "' isn't part of the column map" ); } } @@ -4825,7 +4872,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let this->errorMessages[] = new Message( attributeField . " is required", attributeField, - "PresenceOf" + "PresenceOf", + 0, + [ + "model": get_class(this) + ] ); let error = true; @@ -4917,8 +4968,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ protected function preSaveRelatedRecords( connection, related) -> bool { - var className, manager, type, relation, columns, referencedFields, - message, nesting, name, record; + var className, manager, type, relation, columns, referencedFields, nesting, name, record; let nesting = false; @@ -4953,7 +5003,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, connection->rollback(nesting); throw new Exception( - "Only objects can be stored as part of belongs-to relations" + "Only objects can be stored as part of belongs-to relations in '" . get_class(this) . "' Relation " . name ); } @@ -4966,7 +5016,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof columns === "array" { connection->rollback(nesting); - throw new Exception("Not implemented"); + throw new Exception("Not implemented in '" . get_class(this) . "' Relation " . name); } /** @@ -4978,23 +5028,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, * Get the validation messages generated by the * referenced model */ - for message in record->getMessages() { - /** - * Set the related model - */ - if typeof message == "object" { - message->setMetaData( - [ - "model": record - ] - ); - } - - /** - * Appends the messages to the current model - */ - this->appendMessage(message); - } + this->appendMessagesFrom(record); /** * Rollback the implicit transaction @@ -5042,7 +5076,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ protected function postSaveRelatedRecords( connection, related) -> bool { - var nesting, className, manager, relation, name, record, message, + var nesting, className, manager, relation, name, record, columns, referencedModel, referencedFields, relatedRecords, value, recordAfter, intermediateModel, intermediateFields, intermediateValue, intermediateModelName, @@ -5074,7 +5108,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, connection->rollback(nesting); throw new Exception( - "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations" + "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations on model " . className . " on Relation " . name ); } @@ -5085,7 +5119,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, if unlikely typeof columns === "array" { connection->rollback(nesting); - throw new Exception("Not implemented"); + throw new Exception("Not implemented in '" . className . "' on Relation " . name); } /** @@ -5101,7 +5135,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, connection->rollback(nesting); throw new Exception( - "The column '" . columns . "' needs to be present in the model" + "The column '" . columns . "' needs to be present in the model '" . className . "'" ); } @@ -5112,61 +5146,31 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let isThrough = (bool) relation->isThrough(); /** - * Get the rest of intermediate model info + * Many-to-Many */ if isThrough { let intermediateModelName = relation->getIntermediateModel(), intermediateFields = relation->getIntermediateFields(), intermediateReferencedFields = relation->getIntermediateReferencedFields(); - } - for recordAfter in relatedRecords { - /** - * For non has-many-to-many relations just assign the local - * value in the referenced model - */ - if !isThrough { + for recordAfter in relatedRecords { /** - * Assign the value to the - */ - recordAfter->writeAttribute(referencedFields, value); - } - - /** - * Save the record and get messages - */ - if !recordAfter->save() { - /** - * Get the validation messages generated by the - * referenced model + * Save the record and get messages */ - for message in recordAfter->getMessages() { + if !recordAfter->save() { /** - * Set the related model + * Get the validation messages generated by the + * referenced model */ - if typeof message === "object" { - message->setMetaData( - [ - "model": recordAfter - ] - ); - } - + this->appendMessagesFrom(recordAfter); + /** - * Appends the messages to the current model + * Rollback the implicit transaction */ - this->appendMessage(message); + connection->rollback(nesting); + + return false; } - - /** - * Rollback the implicit transaction - */ - connection->rollback(nesting); - - return false; - } - - if isThrough { /** * Create a new instance of the intermediate model */ @@ -5221,24 +5225,32 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, /** * Get the validation messages generated by the referenced model */ - for message in intermediateModel->getMessages() { - /** - * Set the related model - */ - if typeof message === "object" { - message->setMetaData( - [ - "model": intermediateModel - ] - ); - } + this->appendMessagesFrom(intermediateModel); - /** - * Appends the messages to the current model - */ - this->appendMessage(message); - } + /** + * Rollback the implicit transaction + */ + connection->rollback(nesting); + return false; + } + } + } else { + for recordAfter in relatedRecords { + /** + * Assign the value to the + */ + recordAfter->writeAttribute(referencedFields, value); + /** + * Save the record and get messages + */ + if !recordAfter->save() { + /** + * Get the validation messages generated by the + * referenced model + */ + this->appendMessagesFrom(recordAfter); + /** * Rollback the implicit transaction */ @@ -5867,7 +5879,8 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, message->getMessage(), message->getField(), message->getType(), - message->getCode() + message->getCode(), + message->getMetaData() ) ); } @@ -5927,4 +5940,28 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, return key; } + + /*** + * Append messages to this model from another Model. + */ + public inline function appendMessagesFrom(var model) -> void + { + var messages, message; + let messages = model->getMessages(); + if false === empty(messages) { + for message in messages { + if typeof message == "object" { + message->setMetaData( + [ + "model": model + ] + ); + } + /** + * Appends the messages to the current model + */ + this->appendMessage(message); + } + } + } } diff --git a/tests/database/Mvc/Model/FindFirstCest.php b/tests/database/Mvc/Model/FindFirstCest.php index 8411822dc8e..c4543f467b3 100644 --- a/tests/database/Mvc/Model/FindFirstCest.php +++ b/tests/database/Mvc/Model/FindFirstCest.php @@ -264,7 +264,7 @@ public function mvcModelFindFirstException(DatabaseTester $I) $I->expectThrowable( new Exception( - 'Parameters passed must be of type array, string, numeric or null' + "Parameters passed must be of type array, string, numeric or null in '" . Invoices::class . "'" ), function () { Invoices::findFirst(false); diff --git a/tests/database/Mvc/Model/UnderscoreCallStaticCest.php b/tests/database/Mvc/Model/UnderscoreCallStaticCest.php index 8388c771a15..dbe02f15961 100644 --- a/tests/database/Mvc/Model/UnderscoreCallStaticCest.php +++ b/tests/database/Mvc/Model/UnderscoreCallStaticCest.php @@ -167,7 +167,7 @@ function () { */ $I->expectThrowable( new Exception( - "Cannot resolve attribute 'UnknownField' in the model" + "Cannot resolve attribute 'UnknownField' in the model '" . Models\Invoices::class . "'" ), function () { Models\Invoices::findFirstByUnknownField(1); @@ -179,7 +179,7 @@ function () { */ $I->expectThrowable( new Exception( - "Cannot resolve attribute 'UnknownField' in the model" + "Cannot resolve attribute 'UnknownField' in the model '" . Models\Invoices::class . "'" ), function () { Models\Invoices::countByUnknownField(1); diff --git a/tests/database/Mvc/Model/UnderscoreGetCest.php b/tests/database/Mvc/Model/UnderscoreGetCest.php index 5817894be0d..130b358926d 100644 --- a/tests/database/Mvc/Model/UnderscoreGetCest.php +++ b/tests/database/Mvc/Model/UnderscoreGetCest.php @@ -302,7 +302,7 @@ public function mvcModelUnderscorePrivatePropertyException(DatabaseTester $I) $I->expectThrowable( new Exception( - "Cannot access property 'superSecret' (not public)." + "Cannot access property 'superSecret' (not public) in '" . Invoices::class . "'" ), function () { $model = new Invoices(); From f3f6cc8c5c93492b243d16d5e1c51b0968778470 Mon Sep 17 00:00:00 2001 From: Rudi Servo Date: Sun, 6 Aug 2023 20:32:06 +0000 Subject: [PATCH 11/29] Fixed Phalcon\Mvc\Model\Metadata::initialize behaviour [#16393] --- CHANGELOG-5.0.md | 4 + phalcon/Mvc/Model/MetaData.zep | 199 +++++++++--------- phalcon/Mvc/Model/MetaDataInterface.zep | 6 +- .../MetaData/Adapter/ReadMetadataCest.php | 9 +- 4 files changed, 116 insertions(+), 102 deletions(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 23084bcec28..f65598c369b 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -5,9 +5,13 @@ ### Added - Added `Phalcon\Mvc\Model::appendMessagedFrom` for code consistency and to add messages from another another model. [#16391](https://github.com/phalcon/cphalcon/issues/16391) - Added `Phalcon\Autoload\Loader::isRegistered` for debugging purposes [#16391](https://github.com/phalcon/cphalcon/issues/16391) +- Added `Phalcon\Mvc\Model\Metadata::initializeMetadata` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) +- Added `Phalcon\Mvc\Model\Metadata::getMetaDataUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) +- Added `Phalcon\Mvc\Model\Metadata::getColumnMapUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) ### Changed - Refactored `Phalcon\Mvc\Model::doLowUpdate` and `Phalcon\Mvc\Model::postSaveRelatedRecords` for better code logic and a clearer seperation of behaviour although it lead to partially repeated code.[#16391](https://github.com/phalcon/cphalcon/issues/16391) +- Cleaned `Phalcon\Mvc\Model\Metadata::initialize` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) ### Fixed diff --git a/phalcon/Mvc/Model/MetaData.zep b/phalcon/Mvc/Model/MetaData.zep index 42c7fc55dd7..b8fc27009b8 100644 --- a/phalcon/Mvc/Model/MetaData.zep +++ b/phalcon/Mvc/Model/MetaData.zep @@ -484,10 +484,10 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface let columnMap = this->getReverseColumnMap(model); if typeof columnMap == "array" { - return isset columnMap[attribute]; + return isset(columnMap[attribute]); } - return isset this->readMetaData(model)[self::MODELS_DATA_TYPES][attribute]; + return isset(this->readMetaData(model)[self::MODELS_DATA_TYPES][attribute]); } /** @@ -525,21 +525,16 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface */ final public function readColumnMap( model) -> array | null { - var keyName, data; + var keyName; if !globals_get("orm.column_renaming") { return null; } - - let keyName = get_class_lower(model); - - if !fetch data, this->columnMap[keyName] { - this->initialize(model, null, null, null); - - let data = this->columnMap[keyName]; + let keyName = this->getColumnMapUniqueKey(model); + if likely keyName !== null { + return this->columnMap[keyName]; } - - return data; + return null; } /** @@ -554,25 +549,18 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface * ); *``` */ - final public function readColumnMapIndex( model, int index) + final public function readColumnMapIndex( model, int index) -> array | null { - var keyName, columnMapModel, map; + var keyName; if !globals_get("orm.column_renaming") { return null; } - - let keyName = get_class_lower(model); - - if !fetch columnMapModel, this->columnMap[keyName] { - this->initialize(model, null, null, null); - - let columnMapModel = this->columnMap[keyName]; + let keyName = this->getColumnMapUniqueKey(model); + if likely keyName !== null { + return this->columnMap[keyName][index]; } - - fetch map, columnMapModel[index]; - - return map; + return null; } /** @@ -586,24 +574,14 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface * ); *``` */ - final public function readMetaData( model) -> array + final public function readMetaData( model) -> array | null { - var source, schema; - string key; - - let source = model->getSource(), - schema = model->getSchema(); - - /* - * Unique key for meta-data is created using class-name-schema-source - */ - let key = get_class_lower(model) . "-" . schema . source; - - if !isset this->metaData[key] { - this->initialize(model, key, source, schema); + var key; + let key = this->getMetaDataUniqueKey(model); + if likely key !== null { + return this->metaData[key]; } - - return this->metaData[key]; + return null; } /** @@ -618,24 +596,14 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface * ); *``` */ - final public function readMetaDataIndex( model, int index) + final public function readMetaDataIndex( model, int index) -> array | null { - var source, schema; - string key; - - let source = model->getSource(), - schema = model->getSchema(); - - /* - * Unique key for meta-data is created using class-name-schema-source - */ - let key = get_class_lower(model) . "-" . schema . source; - - if !isset this->metaData[key][index] { - this->initialize(model, key, source, schema); + var key; + let key = this->getMetaDataUniqueKey(model); + if likely key !== null { + return this->metaData[key][index]; } - - return this->metaData[key][index]; + return null; } /** @@ -766,44 +734,36 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface */ final public function writeMetaDataIndex( model, int index, var data) -> void { - var source, schema; - string key; - - if unlikely (typeof data != "array" && typeof data != "string" && typeof data != "boolean") { - throw new Exception("Invalid data for index"); - } - - let source = model->getSource(), - schema = model->getSchema(); - - /* - * Unique key for meta-data is created using class-name-schema-table - */ - let key = get_class_lower(model) . "-" . schema . source; - - if !isset this->metaData[key] { - this->initialize(model, key, source, schema); + var key; + let key = this->getMetaDataUniqueKey(model); + if likely key !== null { + let this->metaData[key][index] = data; } + } - let this->metaData[key][index] = data; + /** + * Initialize old behaviour for compatability + */ + final protected function initialize( model, var key, var table, var schema) + { + this->initializeMetaData(model, key); + this->initializeColumnMap(model, key); } /** * Initialize the metadata for certain table */ - final protected function initialize( model, var key, var table, var schema) + final protected function initializeMetaData( model, var key) -> bool { - var strategy, className, metaData, data, modelMetadata, modelColumnMap, - container, keyName; + var strategy, metaData, data, modelMetadata, container; string prefixKey; - let strategy = null, - className = get_class(model); + let strategy = null; - if key !== null { + if likely key !== null { let metaData = this->metaData; - if !isset metaData[key] { + if false === isset(metaData[key]) { /** * The meta-data is read from the adapter always if not available in metaData property */ @@ -821,7 +781,7 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface if unlikely typeof modelMetadata != "array" { throw new Exception( - "Invalid meta-data for model " . className + "Invalid meta-data for model " . get_class(model) ); } } else { @@ -847,53 +807,66 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface this->{"write"}(prefixKey, modelMetadata); } } + return true; + } + return false; + } + + /** + * Initialize ColumnMap for a certain table + */ + final protected function initializeColumnMap( model, key) -> bool + { + var strategy, data, modelColumnMap, container; + string prefixKey; + + if unlikely key === null { + return false; } /** * Check for a column map, store in columnMap in order and reversed order */ if !globals_get("orm.column_renaming") { - return null; + return false; } - let keyName = strtolower(className); - - if isset this->columnMap[keyName] { - return null; + if true === isset(this->columnMap[key]) { + return false; } /** * Create the map key name * Check if the meta-data is already in the adapter */ - let prefixKey = "map-" . keyName, + let prefixKey = "map-" . key, data = this->{"read"}(prefixKey); if data !== null { - let this->columnMap[keyName] = data; + let this->columnMap[key] = data; - return null; + return false; } /** * Get the meta-data extraction strategy */ - if typeof strategy != "object" { - let container = this->getDI(), - strategy = this->getStrategy(); - } + + let container = this->getDI(), + strategy = this->getStrategy(); /** * Get the meta-data * Update the column map locally */ let modelColumnMap = strategy->getColumnMaps(model, container), - this->columnMap[keyName] = modelColumnMap; + this->columnMap[key] = modelColumnMap; /** * Write the data to the adapter */ this->{"write"}(prefixKey, modelColumnMap); + return true; } /** @@ -928,4 +901,38 @@ abstract class MetaData implements InjectionAwareInterface, MetaDataInterface return value; } + + /** + * Returns a MetaData Unique key for meta-data is created using className + * + * @return string + */ + public final function getMetaDataUniqueKey( model) -> string | null + { + string key; + let key = get_class_lower(model); + if false === isset(this->metaData[key]) { + if false === this->initializeMetaData(model, key) { + return null; + } + } + return key; + } + + /** + * Returns a ColumnMap Unique key for meta-data is created using className + * + * @return string + */ + public final function getColumnMapUniqueKey( model) -> string | null + { + string key; + let key = get_class_lower(model); + if false === isset(this->columnMap[key]) { + if false === this->initializeColumnMap(model, key) { + return null; + } + } + return key; + } } diff --git a/phalcon/Mvc/Model/MetaDataInterface.zep b/phalcon/Mvc/Model/MetaDataInterface.zep index dc3d4866202..301060bc8a7 100644 --- a/phalcon/Mvc/Model/MetaDataInterface.zep +++ b/phalcon/Mvc/Model/MetaDataInterface.zep @@ -118,17 +118,17 @@ interface MetaDataInterface /** * Reads column-map information for certain model using a MODEL_* constant */ - public function readColumnMapIndex( model, int index); + public function readColumnMapIndex( model, int index) -> array | null; /** * Reads meta-data for certain model */ - public function readMetaData( model) -> array; + public function readMetaData( model) -> array | null; /** * Reads meta-data for certain model using a MODEL_* constant */ - public function readMetaDataIndex( model, int index) -> var; + public function readMetaDataIndex( model, int index) -> array | null; /** * Resets internal meta-data in order to regenerate it diff --git a/tests/database/Mvc/Model/MetaData/Adapter/ReadMetadataCest.php b/tests/database/Mvc/Model/MetaData/Adapter/ReadMetadataCest.php index 11d446c8773..78d57e450b1 100644 --- a/tests/database/Mvc/Model/MetaData/Adapter/ReadMetadataCest.php +++ b/tests/database/Mvc/Model/MetaData/Adapter/ReadMetadataCest.php @@ -87,6 +87,7 @@ public function mvcModelMetadataGetAttributesRedis( 'photo_id', ]; $actual = $metadata->getAttributes($model); + $columnMap = $metadata->getColumnMap($model); $I->assertEquals($expected, $actual); $model = new AlbumPhoto(); @@ -97,6 +98,7 @@ public function mvcModelMetadataGetAttributesRedis( 'position', ]; $actual = $metadata->getAttributes($model); + $columnMap = $metadata->getColumnMap($model); $I->assertEquals($expected, $actual); $model = new Photo(); @@ -120,6 +122,7 @@ public function mvcModelMetadataGetAttributesRedis( 'wins', ]; $actual = $metadata->getAttributes($model); + $columnMap = $metadata->getColumnMap($model); $I->assertEquals($expected, $actual); $service = $adapter->getAdapter(); @@ -165,7 +168,7 @@ private function getExamples(): array private function getKeyData(): array { return [ - 'meta-phalcon\tests\fixtures\models\albumphoto-album_photo' => [ + 'meta-phalcon\tests\fixtures\models\albumphoto' => [ 0 => [ 'id', 'photo_id', @@ -220,7 +223,7 @@ private function getKeyData(): array 0 => null, 1 => null, ], - 'meta-phalcon\tests\fixtures\models\photo-photo' => [ + 'meta-phalcon\tests\fixtures\models\photo' => [ 0 => [ 'id', 'date_uploaded', @@ -345,7 +348,7 @@ private function getKeyData(): array 0 => null, 1 => null, ], - 'meta-phalcon\tests\fixtures\models\album-album' => [ + 'meta-phalcon\tests\fixtures\models\album' => [ 0 => [ 'id', 'name', From 78694f00c0951e1382142bf5f6a805c564c6a191 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 17:01:10 -0400 Subject: [PATCH 12/29] more validation tests --- .../Validator/Alnum/ValidateCest.php | 98 +++-- .../Validator/Alpha/ValidateCest.php | 48 ++- .../Validator/Between/ValidateCest.php | 54 ++- .../Validator/Callback/ValidateCest.php | 34 ++ .../Validator/Confirmation/ValidateCest.php | 35 +- .../Validator/CreditCard/ValidateCest.php | 71 ++-- .../Validator/Date/ValidateCest.php | 366 ++++++++++++++++- .../Filter/Validation/Validator/DateCest.php | 279 ------------- .../Validator/Digit/ValidateCest.php | 190 ++++++++- .../Filter/Validation/Validator/DigitCest.php | 180 --------- .../Validator/Email/ValidateCest.php | 314 ++++++++++++++- .../Filter/Validation/Validator/EmailCest.php | 191 --------- .../Validator/ExclusionIn/ValidateCest.php | 310 +++++++++++++- .../Validation/Validator/ExclusionInCest.php | 245 ----------- .../Validator/File/CustomMessagesCest.php | 6 +- .../Validation/Validator/GetOptionCest.php | 34 -- .../Validation/Validator/HasOptionCest.php | 34 -- .../Validator/Identical/ValidateCest.php | 380 +++++++++++++++++- .../Validation/Validator/IdenticalCest.php | 312 -------------- .../Validator/InclusionIn/ValidateCest.php | 290 ++++++++++++- .../Validation/Validator/InclusionInCest.php | 317 --------------- .../Validation/Validator/Ip/ValidateCest.php | 2 +- .../Validator/Numericality/ValidateCest.php | 170 +++++++- .../Validation/Validator/NumericalityCest.php | 156 ------- .../Validator/PresenceOf/ValidateCest.php | 278 ++++++++++++- .../Validation/Validator/PresenceOfCest.php | 270 ------------- .../Validator/Regex/ValidateCest.php | 304 +++++++++++++- .../Filter/Validation/Validator/RegexCest.php | 296 -------------- .../Validation/Validator/SetOptionCest.php | 34 -- .../StringLength/GetTemplateCest.php | 4 +- .../StringLength/Max/GetOptionCest.php | 4 +- .../StringLength/Max/GetTemplateCest.php | 6 +- .../StringLength/Max/GetTemplatesCest.php | 4 +- .../StringLength/Max/MessageFactoryCest.php | 8 +- .../StringLength/Max/SetTemplateCest.php | 2 +- .../StringLength/Max/SetTemplatesCest.php | 2 +- .../StringLength/Max/ValidateCest.php | 35 +- .../StringLength/Min/GetOptionCest.php | 4 +- .../StringLength/Min/GetTemplateCest.php | 6 +- .../StringLength/Min/GetTemplatesCest.php | 4 +- .../StringLength/Min/MessageFactoryCest.php | 8 +- .../StringLength/Min/SetTemplateCest.php | 2 +- .../StringLength/Min/SetTemplatesCest.php | 2 +- .../StringLength/Min/ValidateCest.php | 36 +- .../StringLength/SetTemplateCest.php | 2 +- .../StringLength/SetTemplatesCest.php | 2 +- .../Validator/StringLength/ValidateCest.php | 41 +- .../Validation/Validator/Url/ValidateCest.php | 56 ++- .../Validation/Validator/ValidateCest.php | 34 -- 49 files changed, 2944 insertions(+), 2616 deletions(-) delete mode 100644 tests/integration/Filter/Validation/Validator/DateCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/DigitCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/EmailCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/ExclusionInCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/GetOptionCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/HasOptionCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/IdenticalCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/InclusionInCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/NumericalityCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/PresenceOfCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/RegexCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/SetOptionCest.php delete mode 100644 tests/integration/Filter/Validation/Validator/ValidateCest.php diff --git a/tests/integration/Filter/Validation/Validator/Alnum/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Alnum/ValidateCest.php index e4452389701..4afdad52254 100644 --- a/tests/integration/Filter/Validation/Validator/Alnum/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Alnum/ValidateCest.php @@ -15,10 +15,38 @@ use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\Alnum; +use stdClass; class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Alnum :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorAlnumValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Alnum - validate() - empty"); + + $validation = new Validation(); + $validator = new Alnum(['allowEmpty' => true,]); + $validation->add('name', $validator); + $entity = new stdClass(); + $entity->name = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'name'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\Alnum :: validate() - single field * @@ -30,11 +58,7 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes $I->wantToTest("Validation\Validator\Alnum - validate() - single field"); $validation = new Validation(); - - $validation->add( - 'name', - new Alnum() - ); + $validation->add('name', new Alnum()); $messages = $validation->validate( [ @@ -42,10 +66,9 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes ] ); - $I->assertEquals( - 0, - $messages->count() - ); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ @@ -53,10 +76,9 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes ] ); - $I->assertEquals( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } /** @@ -67,7 +89,7 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes */ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationTester $I) { - $I->wantToTest("Validation\Validator\Alnum - validate() - multiple field"); + $I->wantToTest("Validation\Validator\Alnum - validate() - multiple fields"); $validation = new Validation(); @@ -90,10 +112,6 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT $al ); - codecept_debug($validation); - codecept_debug($al); - - $messages = $validation->validate( [ 'name' => 'SomeValue123', @@ -101,11 +119,9 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT ] ); - $I->assertEquals( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ @@ -114,16 +130,13 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT ] ); - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ @@ -132,19 +145,16 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT ] ); - $I->assertEquals( - 2, - $messages->count() - ); + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(1)->getMessage() - ); + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/Alpha/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Alpha/ValidateCest.php index 3ee231d8a0b..96008fd937c 100644 --- a/tests/integration/Filter/Validation/Validator/Alpha/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Alpha/ValidateCest.php @@ -16,12 +16,40 @@ use Codeception\Example; use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\Alpha; use Phalcon\Messages\Message; use Phalcon\Messages\Messages; +use stdClass; class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Alpha :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorAlphaValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Alpha - validate() - empty"); + + $validation = new Validation(); + $validator = new Alpha(['allowEmpty' => true,]); + $validation->add('name', $validator); + $entity = new stdClass(); + $entity->name = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'name'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\Alpha :: validate() - single field * @@ -46,7 +74,7 @@ public function filterValidationValidatorAlphaValidateSingleField(IntegrationTes ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -58,7 +86,7 @@ public function filterValidationValidatorAlphaValidateSingleField(IntegrationTes ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -98,7 +126,7 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -111,12 +139,12 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['name'], $messages->offsetGet(0)->getMessage() ); @@ -129,17 +157,17 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['name'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMessages['type'], $messages->offsetGet(1)->getMessage() ); @@ -225,7 +253,7 @@ public function filterValidationValidatorAlphaValidateAlphabeticCharacters(Integ ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -263,7 +291,7 @@ public function filterValidationValidatorAlphaValidateNonLatinCharacters(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/Between/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Between/ValidateCest.php index 9a3c79a1e53..0774243dfa8 100644 --- a/tests/integration/Filter/Validation/Validator/Between/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Between/ValidateCest.php @@ -15,15 +15,49 @@ use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\Between; use Phalcon\Messages\Message; use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest */ class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Between :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorBetweenValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Between - validate() - empty"); + + $validation = new Validation(); + $validator = new Between( + [ + 'allowEmpty' => true, + 'minimum' => 1, + 'maximum' => 3, + ] + ); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\Between :: validate() - single field * @@ -66,21 +100,19 @@ public function filterValidationValidatorBetweenValidateSingleField(IntegrationT $I->assertEquals($expected, $messages); - $messages = $validation->validate( [] ); $I->assertEquals($expected, $messages); - $messages = $validation->validate( [ 'price' => 2, ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -130,7 +162,7 @@ public function filterValidationValidatorBetweenValidateMultipleField(Integratio ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -143,12 +175,12 @@ public function filterValidationValidatorBetweenValidateMultipleField(Integratio ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['amount'], $messages->offsetGet(0)->getMessage() ); @@ -161,17 +193,17 @@ public function filterValidationValidatorBetweenValidateMultipleField(Integratio ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['amount'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMessages['price'], $messages->offsetGet(1)->getMessage() ); @@ -220,20 +252,18 @@ public function filterValidationValidatorBetweenValidateCustomMessage(Integratio $I->assertEquals($expected, $messages); - $I->assertEquals( $validation->validate([]), $messages ); - $messages = $validation->validate( [ 'price' => 2, ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php index 78ba6a0f38c..5a153d3cdb5 100644 --- a/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php @@ -414,4 +414,38 @@ function () { } ); } + + /** + * Tests Phalcon\Filter\Validation\Validator\Callback :: validate() - no callback + * + * @author Phalcon Team + * @since 2023-08-08 + */ + public function filterValidationValidatorCallbackValidateNoCallback(IntegrationTester $I) + { + $I->wantToTest( + "Validation\Validator\Callback - validate() - no callback" + ); + + $validation = new Validation(); + + $validation->add( + 'user', + new Callback( + [ + 'callback' => 'test', + ] + ) + ); + + + $messages = $validation->validate( + [ + 'user' => 'u', + 'admin' => 'admin', + ] + ); + + $I->assertCount(0, $messages); + } } diff --git a/tests/integration/Filter/Validation/Validator/Confirmation/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Confirmation/ValidateCest.php index 435620fa315..6675f2b66c9 100644 --- a/tests/integration/Filter/Validation/Validator/Confirmation/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Confirmation/ValidateCest.php @@ -57,7 +57,7 @@ public function filterValidationValidatorConfirmationValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -70,7 +70,7 @@ public function filterValidationValidatorConfirmationValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -84,7 +84,7 @@ public function filterValidationValidatorConfirmationValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count(), "Phalcon\Filter\Validation\Validator\Confirmation failed to compare 000012345=12345" @@ -97,7 +97,7 @@ public function filterValidationValidatorConfirmationValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count(), "Phalcon\Filter\Validation\Validator\Confirmation failed to compare asd=asdß" @@ -149,7 +149,7 @@ public function filterValidationValidatorConfirmationValidateMultipleField(Integ ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -164,12 +164,12 @@ public function filterValidationValidatorConfirmationValidateMultipleField(Integ ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['name'], $messages->offsetGet(0)->getMessage() ); @@ -184,17 +184,17 @@ public function filterValidationValidatorConfirmationValidateMultipleField(Integ ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['name'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMessages['type'], $messages->offsetGet(1)->getMessage() ); @@ -231,6 +231,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra new Confirmation( [ 'allowEmpty' => true, + 'ignoreCase' => true, 'with' => 'password2', ] ) @@ -239,12 +240,12 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra $messages = $validation->validate( [ - 'password' => 'test123', + 'password' => 'TEST123', 'password2' => 'test123', ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -257,7 +258,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -283,7 +284,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -296,7 +297,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -323,7 +324,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -336,7 +337,7 @@ public function filterValidationValidatorConfirmationValidateEmptyValues(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/CreditCard/ValidateCest.php b/tests/integration/Filter/Validation/Validator/CreditCard/ValidateCest.php index bbe2dc0e242..8e547f96b4d 100644 --- a/tests/integration/Filter/Validation/Validator/CreditCard/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/CreditCard/ValidateCest.php @@ -15,15 +15,43 @@ use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\CreditCard; use Phalcon\Messages\Message; use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest */ class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\CreditCard :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorCreditCardValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\CreditCard - validate() - empty"); + + $validation = new Validation(); + $validator = new CreditCard(['allowEmpty' => true,]); + $validation->add('creditCard', $validator); + $entity = new stdClass(); + $entity->creditCard = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'creditCard'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\CreditCard :: validate() - single * field @@ -37,28 +65,23 @@ public function filterValidationValidatorCreditCardValidateSingleField(Integrati $validation = new Validation(); - $validation->add( - 'creditCard', - new CreditCard() - ); + $validation->add('creditCard', new CreditCard()); - $I->assertCount( - 0, - $validation->validate( - [ - 'creditCard' => 4601587377626131, - ] - ) + $expected = 0; + $actual = $validation->validate( + [ + 'creditCard' => 4601587377626131, + ] ); + $I->assertCount($expected, $actual); - $I->assertCount( - 1, - $validation->validate( - [ - 'creditCard' => 46015873776261312, - ] - ) + $expected = 1; + $actual = $validation->validate( + [ + 'creditCard' => 46015873776261312, + ] ); + $I->assertCount($expected, $actual); } /** @@ -96,7 +119,7 @@ public function filterValidationValidatorCreditCardValidateMultipleFields(Integr ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -109,13 +132,13 @@ public function filterValidationValidatorCreditCardValidateMultipleFields(Integr ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['creditCard'], $messages->offsetGet(0)->getMessage() ); @@ -128,19 +151,19 @@ public function filterValidationValidatorCreditCardValidateMultipleFields(Integr ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['creditCard'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMessages['anotherCreditCard'], $messages->offsetGet(1)->getMessage() ); diff --git a/tests/integration/Filter/Validation/Validator/Date/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Date/ValidateCest.php index 3bd6c5e75c4..380efc5c5d1 100644 --- a/tests/integration/Filter/Validation/Validator/Date/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Date/ValidateCest.php @@ -13,7 +13,14 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\Date; +use Codeception\Example; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\Date; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +28,364 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\Date :: validate() + * Tests Phalcon\Filter\Validation\Validator\Date :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 + */ + public function filterValidationValidatorDateValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Date - validate() - empty"); + + $validation = new Validation(); + $validator = new Date(['allowEmpty' => true,]); + $validation->add('start_date', $validator); + $entity = new stdClass(); + $entity->start_date = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'start_date'); + $I->assertTrue($result); + } + + /** + * Tests Phalcon\Filter\Validation\Validator\Date :: validate() - single field + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorDateValidateSingleField(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Date - validate() - single field"); + + $validation = new Validation(); + $validation->add('start_date', new Date()); + + $messages = $validation->validate( + [ + 'start_date' => '2022-12-31', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'start_date' => '19450101', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + } + + /** + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 */ - public function filterValidationValidatorDateValidate(IntegrationTester $I) + public function filterValidationValidatorDateValidateMultipleField(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\Date - validate()'); + $I->wantToTest("Validation\Validator\Date - validate() - multiple field"); + + $validation = new Validation(); + + $validationMessages = [ + 'start_date' => 'start_date must be date.', + 'end_date' => 'end_date must by date.', + ]; + + $validation->add( + ['start_date', 'end_date'], + new Date( + [ + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'start_date' => '2022-12-31', + 'end_date' => '2023-01-01', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + + $messages = $validation->validate( + [ + 'start_date' => '20230101', + 'end_date' => '2022-12-31', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['start_date']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'start_date' => '20230101', + 'end_date' => '20230101', + ] + ); + + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['start_date']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['end_date']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests date validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorDateSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'date', + new Date() + ); + + + $messages = $validation->validate( + [ + 'date' => '2016-06-05', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + - $I->skipTest('Need implementation'); + $messages = $validation->validate( + [ + 'date' => '2016-06-32', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + } + + /** + * Tests date validator with multiple field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorDateMultipleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'date' => 'Date must be correct date format Y-m-d.', + 'anotherDate' => 'AnotherDate must be correct date format d-m-Y.', + ]; + + $validation->add( + ['date', 'anotherDate'], + new Date( + [ + 'format' => [ + 'date' => 'Y-m-d', + 'anotherDate' => 'd-m-Y', + ], + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'date' => '2016-06-05', + 'anotherDate' => '05-06-2017', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + $messages = $validation->validate( + [ + 'date' => '2016-06-32', + 'anotherDate' => '05-06-2017', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $expected = $validationMessages['date']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'date' => '2016-06-32', + 'anotherDate' => '32-06-2017', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $expected = $validationMessages['date']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherDate']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests detect valid dates + * + * @author Gustavo Verzola + * @since 2015-03-09 + * + * @dataProvider getValidDates + */ + public function filterValidationValidatorDateDetectValidDates(IntegrationTester $I, Example $example) + { + $date = $example[0]; + $format = $example[1]; + + $validation = new Validation(); + + $validation->add( + 'date', + new Date( + [ + 'format' => $format, + ] + ) + ); + + $messages = $validation->validate( + [ + 'date' => $date, + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + } + + /** + * Tests detect invalid dates + * + * @author Gustavo Verzola + * @since 2015-03-09 + * + * @dataProvider getInvalidDates + */ + public function filterValidationValidatorDateDetectInvalidDates(IntegrationTester $I, Example $example) + { + $date = $example[0]; + $format = $example[1]; + + $validation = new Validation(); + + $validation->add( + 'date', + new Date( + [ + 'format' => $format, + ] + ) + ); + + $expected = new Messages( + [ + new Message( + 'Field date is not a valid date', + 'date', + Date::class, + 0 + ), + ] + ); + + $actual = $validation->validate( + [ + 'date' => $date, + ] + ); + + $I->assertEquals($expected, $actual); + } + + protected function getValidDates(): array + { + return [ + ['2012-01-01', 'Y-m-d'], + ['2013-31-12', 'Y-d-m'], + ['01/01/2014', 'd/m/Y'], + ['12@12@2015', 'd@m@Y'], + ]; + } + + protected function getInvalidDates(): array + { + return [ + ['', 'Y-m-d'], + [false, 'Y-m-d'], + [null, 'Y-m-d'], + [new stdClass(), 'Y-m-d'], + ['2015-13-01', 'Y-m-d'], + ['2015-01-32', 'Y-m-d'], + ['2015-01', 'Y-m-d'], + ['2015-01-01', 'd-m-Y'], + ]; } } diff --git a/tests/integration/Filter/Validation/Validator/DateCest.php b/tests/integration/Filter/Validation/Validator/DateCest.php deleted file mode 100644 index 39a44d4395b..00000000000 --- a/tests/integration/Filter/Validation/Validator/DateCest.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use Codeception\Example; -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Date; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; -use stdClass; - -class DateCest -{ - /** - * Tests date validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'date', - new Date() - ); - - - $messages = $validation->validate( - [ - 'date' => '2016-06-05', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'date' => '2016-06-32', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - } - - /** - * Tests date validator with multiple field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'date' => 'Date must be correct date format Y-m-d.', - 'anotherDate' => 'AnotherDate must be correct date format d-m-Y.', - ]; - - $validation->add( - ['date', 'anotherDate'], - new Date( - [ - 'format' => [ - 'date' => 'Y-m-d', - 'anotherDate' => 'd-m-Y', - ], - 'message' => $validationMessages, - ] - ) - ); - - $messages = $validation->validate( - [ - 'date' => '2016-06-05', - 'anotherDate' => '05-06-2017', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - $messages = $validation->validate( - [ - 'date' => '2016-06-32', - 'anotherDate' => '05-06-2017', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $expected = $validationMessages['date']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate( - [ - 'date' => '2016-06-32', - 'anotherDate' => '32-06-2017', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $expected = $validationMessages['date']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['anotherDate']; - $actual = $messages->offsetGet(1)->getMessage(); - $I->assertEquals($expected, $actual); - } - - /** - * Tests detect valid dates - * - * @author Gustavo Verzola - * @since 2015-03-09 - * - * @dataProvider shouldDetectValidDatesProvider - */ - public function shouldDetectValidDates(IntegrationTester $I, Example $example) - { - $date = $example[0]; - $format = $example[1]; - - $validation = new Validation(); - - $validation->add( - 'date', - new Date( - [ - 'format' => $format, - ] - ) - ); - - $messages = $validation->validate( - [ - 'date' => $date, - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } - - /** - * Tests detect invalid dates - * - * @author Gustavo Verzola - * @since 2015-03-09 - * - * @dataProvider shouldDetectInvalidDatesProvider - */ - public function shouldDetectInvalidDates(IntegrationTester $I, Example $example) - { - $date = $example[0]; - $format = $example[1]; - - $validation = new Validation(); - - $validation->add( - 'date', - new Date( - [ - 'format' => $format, - ] - ) - ); - - $expected = new Messages( - [ - new Message( - 'Field date is not a valid date', - 'date', - Date::class, - 0 - ), - ] - ); - - $actual = $validation->validate( - [ - 'date' => $date, - ] - ); - - $I->assertEquals($expected, $actual); - } - - protected function shouldDetectValidDatesProvider(): array - { - return [ - ['2012-01-01', 'Y-m-d'], - ['2013-31-12', 'Y-d-m'], - ['01/01/2014', 'd/m/Y'], - ['12@12@2015', 'd@m@Y'], - ]; - } - - protected function shouldDetectInvalidDatesProvider(): array - { - return [ - ['', 'Y-m-d'], - [false, 'Y-m-d'], - [null, 'Y-m-d'], - [new stdClass(), 'Y-m-d'], - ['2015-13-01', 'Y-m-d'], - ['2015-01-32', 'Y-m-d'], - ['2015-01', 'Y-m-d'], - ['2015-01-01', 'd-m-Y'], - ]; - - foreach ($dates as $item) { - $date = $item[0]; - $format = $item[1]; - - $validation = new Validation(); - - $validation->add( - 'date', - new Date( - [ - 'format' => $format, - ] - ) - ); - - $expected = new Messages( - [ - new Message( - 'Field date is not a valid date', - 'date', - Date::class, - 0 - ), - ] - ); - - $actual = $validation->validate( - [ - 'date' => $date, - ] - ); - - $I->assertEquals($expected, $actual); - } - } -} diff --git a/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php index b6002ed08ab..4fbef5b6595 100644 --- a/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php @@ -13,7 +13,14 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\Digit; +use Codeception\Example; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\Digit; +use stdClass; + +use const PHP_INT_MAX; /** * Class ValidateCest @@ -21,15 +28,188 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\Digit :: validate() + * Tests Phalcon\Filter\Validation\Validator\Digit :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 */ - public function filterValidationValidatorDigitValidate(IntegrationTester $I) + public function filterValidationValidatorDigitValidateEmpty(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\Digit - validate()'); + $I->wantToTest("Validation\Validator\Digit - validate() - empty"); + + $validation = new Validation(); + $validator = new Digit(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + + /** + * Tests digit validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorDigitSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'amount', + new Digit() + ); + + + $messages = $validation->validate( + [ + 'amount' => '123', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'amount' => '123abc', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + } + + /** + * Tests digit validator with multiple field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorDigitMultipleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'amount' => 'Amount must be digit.', + 'price' => 'Price must be digit.', + ]; - $I->skipTest('Need implementation'); + $validation->add( + ['amount', 'price'], + new Digit( + [ + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'amount' => '123', + 'price' => '123', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'amount' => '123abc', + 'price' => '123', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['amount'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'amount' => '123abc', + 'price' => '123abc', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['amount'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['price'], + $messages->offsetGet(1)->getMessage() + ); + } + + /** + * @dataProvider shouldValidateIntOrStringOfDigitsProvider + */ + public function filterValidationValidatorDigitShouldValidateIntOrStringOfDigits(IntegrationTester $I, Example $example) + { + $digit = $example[0]; + + $validation = new Validation(); + + $validation->add( + 'amount', + new Digit() + ); + + $messages = $validation->validate( + [ + 'amount' => $digit, + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + } + + private function shouldValidateIntOrStringOfDigitsProvider() + { + return [ + ['123'], + [123], + [PHP_INT_MAX], + [0xFFFFFF], + [100000], + [-100000], + [0], + ['0'], + ['00001233422003400'], + ]; } } diff --git a/tests/integration/Filter/Validation/Validator/DigitCest.php b/tests/integration/Filter/Validation/Validator/DigitCest.php deleted file mode 100644 index abc967a2332..00000000000 --- a/tests/integration/Filter/Validation/Validator/DigitCest.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use Codeception\Example; -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Digit; - -class DigitCest -{ - /** - * Tests digit validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'amount', - new Digit() - ); - - - $messages = $validation->validate( - [ - 'amount' => '123', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'amount' => '123abc', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - } - - /** - * Tests digit validator with multiple field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'amount' => 'Amount must be digit.', - 'price' => 'Price must be digit.', - ]; - - $validation->add( - ['amount', 'price'], - new Digit( - [ - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'amount' => '123', - 'price' => '123', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'amount' => '123abc', - 'price' => '123', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['amount'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'amount' => '123abc', - 'price' => '123abc', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['amount'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['price'], - $messages->offsetGet(1)->getMessage() - ); - } - - /** - * @dataProvider shouldValidateIntOrStringOfDigitsProvider - */ - public function filterValidationValidatorShouldValidateIntOrStringOfDigits(IntegrationTester $I, Example $example) - { - $digit = $example[0]; - - $validation = new Validation(); - - $validation->add( - 'amount', - new Digit() - ); - - $messages = $validation->validate( - [ - 'amount' => $digit, - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } - - private function shouldValidateIntOrStringOfDigitsProvider() - { - return [ - ['123'], - [123], - [PHP_INT_MAX], - [0xFFFFFF], - [100000], - [-100000], - [0], - ['0'], - ['00001233422003400'], - ]; - } -} diff --git a/tests/integration/Filter/Validation/Validator/Email/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Email/ValidateCest.php index 5d38a1e6738..3e8ea3853b4 100644 --- a/tests/integration/Filter/Validation/Validator/Email/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Email/ValidateCest.php @@ -14,6 +14,12 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\Email; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\Email; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +27,313 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\Email :: validate() + * Tests Phalcon\Filter\Validation\Validator\Email :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 + */ + public function filterValidationValidatorEmailValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Email - validate() - empty"); + + $validation = new Validation(); + $validator = new Email(['allowEmpty' => true,]); + $validation->add('email_one', $validator); + $entity = new stdClass(); + $entity->email_one = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'email_one'); + $I->assertTrue($result); + } + + /** + * Tests Phalcon\Filter\Validation\Validator\Email :: validate() - single field + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorEmailValidateSingleField(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Email - validate() - single field"); + + $validation = new Validation(); + $validation->add('email_one', new Email()); + + $messages = $validation->validate( + [ + 'email_one' => 'team@phalcon.io', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'email_one' => 'random-text', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + } + + /** + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorEmailValidateMultipleField(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Email - validate() - multiple field"); + + $validation = new Validation(); + + $validationMessages = [ + 'email_one' => 'Email One must be email.', + 'email_two' => 'Email Two must by email.', + ]; + + $validation->add( + ['email_one', 'email_two'], + new Email( + [ + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'email_one' => 'team@phalcon.io', + 'email_two' => 'team2@phalcon.io', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + + $messages = $validation->validate( + [ + 'email_one' => 'random-text', + 'email_two' => 'team@phalcon.io', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['email_one']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'email_one' => 'random-text', + 'email_two' => 'random-text', + ] + ); + + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['email_one']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['email_two']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests email validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorEmailSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'email', + new Email() + ); + + + $messages = $validation->validate( + [ + 'email' => 'test@somemail.com', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'email' => 'rootlocalhost', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $expected = new Messages( + [ + new Message( + 'Field email must be an email address', + 'email', + Email::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + } + + /** + * Tests email validator with multiple field + * + * @author Wojciech Ślawski + * @since 2016-06-05 */ - public function filterValidationValidatorEmailValidate(IntegrationTester $I) + public function filterValidationValidatorEmailMultipleField(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\Email - validate()'); + $validation = new Validation(); + + $validationMessages = [ + 'email' => 'Email must be correct email.', + 'anotherEmail' => 'AnotherEmail must be correct email.', + ]; + + $validation->add( + [ + 'email', + 'anotherEmail', + ], + new Email( + [ + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'email' => 'test@somemail.com', + 'anotherEmail' => 'test@somemail.com', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'email' => 'rootlocalhost', + 'anotherEmail' => 'test@somemail.com', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['email'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'email' => 'rootlocalhost', + 'anotherEmail' => 'rootlocalhost', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['email'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['anotherEmail'], + $messages->offsetGet(1)->getMessage() + ); + } + + public function filterValidationValidatorEmailCustomMessage(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'email', + new Email( + [ + 'message' => 'The email is not valid', + ] + ) + ); + + $actual = $validation->validate([]); + $expected = new Messages( + [ + new Message( + 'The email is not valid', + 'email', + Email::class, + 0 + ), + ] + ); + $I->assertEquals($expected, $actual); + + $actual = $validation->validate(['email' => 'x=1']); + $I->assertEquals($expected, $actual); - $I->skipTest('Need implementation'); + $messages = $validation->validate(['email' => 'x.x@hotmail.com']); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/EmailCest.php b/tests/integration/Filter/Validation/Validator/EmailCest.php deleted file mode 100644 index 49e90101205..00000000000 --- a/tests/integration/Filter/Validation/Validator/EmailCest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Email; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class EmailCest -{ - /** - * Tests email validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'email', - new Email() - ); - - - $messages = $validation->validate( - [ - 'email' => 'test@somemail.com', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'email' => 'rootlocalhost', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $expected = new Messages( - [ - new Message( - 'Field email must be an email address', - 'email', - Email::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - } - - /** - * Tests email validator with multiple field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'email' => 'Email must be correct email.', - 'anotherEmail' => 'AnotherEmail must be correct email.', - ]; - - $validation->add( - [ - 'email', - 'anotherEmail', - ], - new Email( - [ - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'email' => 'test@somemail.com', - 'anotherEmail' => 'test@somemail.com', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'email' => 'rootlocalhost', - 'anotherEmail' => 'test@somemail.com', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['email'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'email' => 'rootlocalhost', - 'anotherEmail' => 'rootlocalhost', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['email'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['anotherEmail'], - $messages->offsetGet(1)->getMessage() - ); - } - - public function filterValidationValidatorCustomMessage(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'email', - new Email( - [ - 'message' => 'The email is not valid', - ] - ) - ); - - $actual = $validation->validate([]); - $expected = new Messages( - [ - new Message( - 'The email is not valid', - 'email', - Email::class, - 0 - ), - ] - ); - $I->assertEquals($expected, $actual); - - $actual = $validation->validate(['email' => 'x=1']); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['email' => 'x.x@hotmail.com']); - $expected = 0; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - } -} diff --git a/tests/integration/Filter/Validation/Validator/ExclusionIn/ValidateCest.php b/tests/integration/Filter/Validation/Validator/ExclusionIn/ValidateCest.php index ea84ee2a585..56e8b75909d 100644 --- a/tests/integration/Filter/Validation/Validator/ExclusionIn/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/ExclusionIn/ValidateCest.php @@ -14,6 +14,12 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\ExclusionIn; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\ExclusionIn; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +27,309 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\ExclusionIn :: validate() + * Tests Phalcon\Filter\Validation\Validator\ExclusionIn :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 + */ + public function filterValidationValidatorExclusionInValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\ExclusionIn - validate() - empty"); + + $validation = new Validation(); + $validator = new ExclusionIn(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + + /** + * Tests Phalcon\Filter\Validation\Validator\ExclusionIn :: validate() - single field + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorExclusionInExceptions(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\ExclusionIn - validate() - exceptions"); + + $I->expectThrowable( + new Exception("Option 'domain' must be an array"), + function () { + $validation = new Validation(); + $validator = new ExclusionIn( + [ + "message" => "The status must not be A or B", + "domain" => "A", + ] + ); + $validation->add('status', $validator); + $entity = new stdClass(); + $entity->status = ''; + + $validation->bind($entity, []); + $validator->validate($validation, 'status'); + } + ); + + $I->expectThrowable( + new Exception("Option 'strict' must be a bool"), + function () { + $validation = new Validation(); + $validator = new ExclusionIn( + [ + "message" => "The status must not be A or B", + "domain" => [ + "A", + "B", + ], + "strict" => "x", + ] + ); + + $validation->add('status', $validator); + $entity = new stdClass(); + $entity->status = ''; + + $validation->bind($entity, []); + $validator->validate($validation, 'status'); + } + ); + } + /** + * Tests exclusion in validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorExclusionInSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'status', + new ExclusionIn( + [ + 'domain' => ['A', 'I'], + ] + ) + ); + + $messages = $validation->validate( + [ + 'status' => 'A', + ] + ); + + $expected = new Messages( + [ + new Message( + 'Field status must not be a part of list: A, I', + 'status', + ExclusionIn::class, + 0 + ), + ] + ); + $actual = $messages; + $I->assertEquals($expected, $actual); + + $messages = $validation->validate(['status' => 'A']); + $actual = $messages; + $I->assertEquals($expected, $actual); + + $messages = $validation->validate(['status' => 'X']); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + } + + /** + * Tests exclusion in validator with multiple field and single domain + * + * @author Wojciech Ślawski + * @since 2016-06-05 */ - public function filterValidationValidatorExclusioninValidate(IntegrationTester $I) + public function filterValidationValidatorExclusionInMultipleFieldSingleDomain(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\ExclusionIn - validate()'); + $validation = new Validation(); + + $validationMessages = [ + 'type' => 'Type cant be mechanic or cyborg.', + 'anotherType' => 'AnotherType cant by mechanic or cyborg.', + ]; + + $validation->add( + [ + 'type', + 'anotherType', + ], + new ExclusionIn( + [ + 'domain' => ['mechanic', 'cyborg'], + 'message' => $validationMessages, + ] + ) + ); + $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'hydraulic']); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'hydraulic']); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'mechanic']); + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherType']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests exclusion in validator with multiple field and multiple domain + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorExclusionInMultipleFieldMultipleDomain(IntegrationTester $I) + { + $validation = new Validation(); + $validationMessages = [ + 'type' => 'Type cant be mechanic or cyborg.', + 'anotherType' => 'AnotherType cant by mechanic or hydraulic.', + ]; + $validation->add( + [ + 'type', + 'anotherType', + ], + new ExclusionIn( + [ + 'domain' => [ + 'type' => ['mechanic', 'cyborg'], + 'anotherType' => ['mechanic', 'hydraulic'], + ], + 'message' => $validationMessages, + ] + ) + ); + $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'cyborg']); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'cyborg']); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'mechanic']); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherType']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'mechanic']); + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherType']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + public function filterValidationValidatorExclusionInCustomMessage(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'status', + new ExclusionIn( + [ + 'message' => 'The status must not be A=Active or I=Inactive', + 'domain' => ['A', 'I'], + ] + ) + ); + + + $messages = $validation->validate( + [ + 'status' => 'A', + ] + ); + + $expected = new Messages( + [ + new Message( + 'The status must not be A=Active or I=Inactive', + 'status', + ExclusionIn::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + + $messages = $validation->validate( + [ + 'status' => 'A', + ] + ); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate( + [ + 'status' => 'X', + ] + ); - $I->skipTest('Need implementation'); + $I->assertSame( + 0, + $messages->count() + ); } } diff --git a/tests/integration/Filter/Validation/Validator/ExclusionInCest.php b/tests/integration/Filter/Validation/Validator/ExclusionInCest.php deleted file mode 100644 index 20e6e0cf4e9..00000000000 --- a/tests/integration/Filter/Validation/Validator/ExclusionInCest.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\ExclusionIn; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class ExclusionInCest -{ - /** - * Tests exclusion in validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'status', - new ExclusionIn( - [ - 'domain' => ['A', 'I'], - ] - ) - ); - - $messages = $validation->validate( - [ - 'status' => 'A', - ] - ); - - $expected = new Messages( - [ - new Message( - 'Field status must not be a part of list: A, I', - 'status', - ExclusionIn::class, - 0 - ), - ] - ); - $actual = $messages; - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['status' => 'A']); - $actual = $messages; - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['status' => 'X']); - $expected = 0; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - } - - /** - * Tests exclusion in validator with multiple field and single domain - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldSingleDomain(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'type' => 'Type cant be mechanic or cyborg.', - 'anotherType' => 'AnotherType cant by mechanic or cyborg.', - ]; - - $validation->add( - [ - 'type', - 'anotherType', - ], - new ExclusionIn( - [ - 'domain' => ['mechanic', 'cyborg'], - 'message' => $validationMessages, - ] - ) - ); - $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'hydraulic']); - $expected = 0; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'hydraulic']); - $expected = 1; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'mechanic']); - $expected = 2; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['anotherType']; - $actual = $messages->offsetGet(1)->getMessage(); - $I->assertEquals($expected, $actual); - } - - /** - * Tests exclusion in validator with multiple field and multiple domain - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldMultipleDomain(IntegrationTester $I) - { - $validation = new Validation(); - $validationMessages = [ - 'type' => 'Type cant be mechanic or cyborg.', - 'anotherType' => 'AnotherType cant by mechanic or hydraulic.', - ]; - $validation->add( - [ - 'type', - 'anotherType', - ], - new ExclusionIn( - [ - 'domain' => [ - 'type' => ['mechanic', 'cyborg'], - 'anotherType' => ['mechanic', 'hydraulic'], - ], - 'message' => $validationMessages, - ] - ) - ); - $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'cyborg']); - $expected = 0; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'cyborg']); - $expected = 1; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['type' => 'hydraulic', 'anotherType' => 'mechanic']); - $expected = 1; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['anotherType']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate(['type' => 'cyborg', 'anotherType' => 'mechanic']); - $expected = 2; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['anotherType']; - $actual = $messages->offsetGet(1)->getMessage(); - $I->assertEquals($expected, $actual); - } - - public function filterValidationValidatorCustomMessage(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'status', - new ExclusionIn( - [ - 'message' => 'The status must not be A=Active or I=Inactive', - 'domain' => ['A', 'I'], - ] - ) - ); - - - $messages = $validation->validate( - [ - 'status' => 'A', - ] - ); - - $expected = new Messages( - [ - new Message( - 'The status must not be A=Active or I=Inactive', - 'status', - ExclusionIn::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate( - [ - 'status' => 'A', - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate( - [ - 'status' => 'X', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } -} diff --git a/tests/integration/Filter/Validation/Validator/File/CustomMessagesCest.php b/tests/integration/Filter/Validation/Validator/File/CustomMessagesCest.php index 9adeaf9dfa6..51d1c86776b 100644 --- a/tests/integration/Filter/Validation/Validator/File/CustomMessagesCest.php +++ b/tests/integration/Filter/Validation/Validator/File/CustomMessagesCest.php @@ -49,9 +49,9 @@ public function filterValidationValidatorFileCustomMessages(IntegrationTester $I $messageIniSize = $validator->getMessageIniSize(); $messageValid = $validator->getMessageValid(); - $I->assertEquals($options['messageFileEmpty'], $messageFileEmpty); - $I->assertEquals($options['messageIniSize'], $messageIniSize); - $I->assertEquals($options['messageValid'], $messageValid); + $I->assertSame($options['messageFileEmpty'], $messageFileEmpty); + $I->assertSame($options['messageIniSize'], $messageIniSize); + $I->assertSame($options['messageValid'], $messageValid); } } } diff --git a/tests/integration/Filter/Validation/Validator/GetOptionCest.php b/tests/integration/Filter/Validation/Validator/GetOptionCest.php deleted file mode 100644 index 0526d31c5d5..00000000000 --- a/tests/integration/Filter/Validation/Validator/GetOptionCest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; - -/** - * Class GetOptionCest - */ -class GetOptionCest -{ - /** - * Tests Phalcon\Filter\Validation\Validator :: getOption() - * - * @author Phalcon Team - * @since 2018-11-13 - */ - public function filterValidationValidatorGetOption(IntegrationTester $I) - { - $I->wantToTest('Validation\Validator - getOption()'); - $I->skipTest('Need implementation'); - } -} diff --git a/tests/integration/Filter/Validation/Validator/HasOptionCest.php b/tests/integration/Filter/Validation/Validator/HasOptionCest.php deleted file mode 100644 index c1007b20879..00000000000 --- a/tests/integration/Filter/Validation/Validator/HasOptionCest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; - -/** - * Class HasOptionCest - */ -class HasOptionCest -{ - /** - * Tests Phalcon\Filter\Validation\Validator :: hasOption() - * - * @author Phalcon Team - * @since 2018-11-13 - */ - public function filterValidationValidatorHasOption(IntegrationTester $I) - { - $I->wantToTest('Validation\Validator - hasOption()'); - $I->skipTest('Need implementation'); - } -} diff --git a/tests/integration/Filter/Validation/Validator/Identical/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Identical/ValidateCest.php index 236e5334e4f..99eae10f94c 100644 --- a/tests/integration/Filter/Validation/Validator/Identical/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Identical/ValidateCest.php @@ -14,6 +14,12 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\Identical; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\Identical; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +27,379 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\Identical :: validate() + * Tests Phalcon\Filter\Validation\Validator\Identical :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 + */ + public function filterValidationValidatorIdenticalValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Identical - validate() - empty"); + + $validation = new Validation(); + $validator = new Identical(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + + /** + * Tests identical validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorIdenticalSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'name', + new Identical( + [ + 'accepted' => 'SomeValue', + ] + ) + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + + $expected = new Messages( + [ + new Message( + 'Field name does not have the expected value', + 'name', + Identical::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + } + + /** + * Tests identical validator with multiple field and single accepted + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorIdenticalMultipleFieldSingleAccepted(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name must be SomeValue.', + 'anotherName' => 'AnotherName must be SomeValue.', + ]; + + $validation->add( + [ + 'name', + 'anotherName', + ], + new Identical( + [ + 'accepted' => 'SomeValue', + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'anotherName' => 'SomeValue', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeValue', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeValue123', + ] + ); + + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherName']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests identical validator with multiple field and single accepted + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorIdenticalMultipleFieldSingleValue(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name must be SomeValue.', + 'anotherName' => 'AnotherName must be SomeValue.', + ]; + + $validation->add( + [ + 'name', + 'anotherName', + ], + new Identical( + [ + 'value' => 'SomeValue', + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'anotherName' => 'SomeValue', + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeValue', + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeValue123', + ] + ); + + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['anotherName']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests identical validator with multiple field and multiple accepted + * + * @author Wojciech Ślawski + * @since 2016-06-05 */ - public function filterValidationValidatorIdenticalValidate(IntegrationTester $I) + public function filterValidationValidatorIdenticalMultipleFieldMultipleAccepted(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\Identical - validate()'); + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name must be SomeValue.', + 'anotherName' => 'AnotherName must be SomeAnotherValue.', + ]; + + $validation->add( + [ + 'name', + 'anotherName', + ], + new Identical( + [ + 'accepted' => [ + 'name' => 'SomeValue', + 'anotherName' => 'SomeAnotherValue', + ], + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'anotherName' => 'SomeAnotherValue', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeAnotherValue', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'anotherName' => 'SomeAnotherValue123', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['anotherName'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue123', + 'anotherName' => 'SomeAnotherValue123', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['anotherName'], + $messages->offsetGet(1)->getMessage() + ); + } + + public function filterValidationValidatorIdenticalCustomMessage(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'name', + new Identical( + [ + 'accepted' => 'Peter', + 'message' => 'The name must be peter', + ] + ) + ); + + + $messages = $validation->validate( + [] + ); + + $expected = new Messages( + [ + new Message( + 'The name must be peter', + 'name', + Identical::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate( + [ + 'name' => 'Peter', + ] + ); - $I->skipTest('Need implementation'); + $I->assertSame( + 0, + $messages->count() + ); } } diff --git a/tests/integration/Filter/Validation/Validator/IdenticalCest.php b/tests/integration/Filter/Validation/Validator/IdenticalCest.php deleted file mode 100644 index 73acc5af325..00000000000 --- a/tests/integration/Filter/Validation/Validator/IdenticalCest.php +++ /dev/null @@ -1,312 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Identical; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class IdenticalCest -{ - /** - * Tests identical validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'name', - new Identical( - [ - 'accepted' => 'SomeValue', - ] - ) - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue123', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - - $expected = new Messages( - [ - new Message( - 'Field name does not have the expected value', - 'name', - Identical::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - } - - /** - * Tests identical validator with multiple field and single accepted - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldSingleAccepted(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'name' => 'Name must be SomeValue.', - 'anotherName' => 'AnotherName must be SomeValue.', - ]; - - $validation->add( - [ - 'name', - 'anotherName', - ], - new Identical( - [ - 'accepted' => 'SomeValue', - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'anotherName' => 'SomeValue', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue123', - 'anotherName' => 'SomeValue', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue123', - 'anotherName' => 'SomeValue123', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['anotherName'], - $messages->offsetGet(1)->getMessage() - ); - } - - /** - * Tests identical validator with multiple field and multiple accepted - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldMultipleAccepted(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'name' => 'Name must be SomeValue.', - 'anotherName' => 'AnotherName must be SomeAnotherValue.', - ]; - - $validation->add( - [ - 'name', - 'anotherName', - ], - new Identical( - [ - 'accepted' => [ - 'name' => 'SomeValue', - 'anotherName' => 'SomeAnotherValue', - ], - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'anotherName' => 'SomeAnotherValue', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue123', - 'anotherName' => 'SomeAnotherValue', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'anotherName' => 'SomeAnotherValue123', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['anotherName'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue123', - 'anotherName' => 'SomeAnotherValue123', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['anotherName'], - $messages->offsetGet(1)->getMessage() - ); - } - - public function filterValidationValidatorCustomMessage(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'name', - new Identical( - [ - 'accepted' => 'Peter', - 'message' => 'The name must be peter', - ] - ) - ); - - - $messages = $validation->validate( - [] - ); - - $expected = new Messages( - [ - new Message( - 'The name must be peter', - 'name', - Identical::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate( - [ - 'name' => 'Peter', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } -} diff --git a/tests/integration/Filter/Validation/Validator/InclusionIn/ValidateCest.php b/tests/integration/Filter/Validation/Validator/InclusionIn/ValidateCest.php index 59a31f8a8db..c8842f7cea4 100644 --- a/tests/integration/Filter/Validation/Validator/InclusionIn/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/InclusionIn/ValidateCest.php @@ -14,6 +14,10 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\InclusionIn; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Validator\InclusionIn; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; /** * Class ValidateCest @@ -21,15 +25,289 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\InclusionIn :: validate() + * Tests inclusion in validator with single field * - * @author Phalcon Team - * @since 2018-11-13 + * @author Wojciech Ślawski + * @since 2016-06-05 */ - public function filterValidationValidatorInclusioninValidate(IntegrationTester $I) + public function filterValidationValidatorInclusioninSingleField(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\InclusionIn - validate()'); + $validation = new Validation(); - $I->skipTest('Need implementation'); + $validation->add( + 'status', + new InclusionIn( + [ + 'domain' => ['A', 'I'], + ] + ) + ); + + + $messages = $validation->validate( + [] + ); + + $expected = new Messages( + [ + new Message( + 'Field status must be a part of list: A, I', + 'status', + InclusionIn::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate( + [ + 'status' => 'X', + ] + ); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate( + [ + 'status' => 'A', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + } + + /** + * Tests inclusion in validator with single multiple field and single domain + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorInclusioninMultipleFieldSingleDomain(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'type' => 'Type must be mechanical or cyborg.', + 'anotherType' => 'AnotherType must be mechanical or cyborg.', + ]; + + $validation->add( + [ + 'type', + 'anotherType', + ], + new InclusionIn( + [ + 'domain' => ['mechanical', 'cyborg'], + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'type' => 'cyborg', + 'anotherType' => 'cyborg', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'type' => 'hydraulic', + 'anotherType' => 'cyborg', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'type' => 'hydraulic', + 'anotherType' => 'hydraulic', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['anotherType'], + $messages->offsetGet(1)->getMessage() + ); + } + + /** + * Tests inclusion in validator with single multiple field and domain + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorInclusioninMultipleFieldMultipleDomain(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'type' => 'Type must be mechanic or cyborg.', + 'anotherType' => 'AnotherType must be mechanic or hydraulic.', + ]; + + $validation->add( + [ + 'type', + 'anotherType', + ], + new InclusionIn( + [ + 'domain' => [ + 'type' => ['cyborg', 'mechanic'], + 'anotherType' => ['mechanic', 'hydraulic'], + ], + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'type' => 'cyborg', + 'anotherType' => 'mechanic', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'type' => 'hydraulic', + 'anotherType' => 'mechanic', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + + $messages = $validation->validate( + [ + 'type' => 'mechanic', + 'anotherType' => 'cyborg', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $expected = $validationMessages['anotherType']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + + $messages = $validation->validate( + [ + 'type' => 'hydraulic', + 'anotherType' => 'cyborg', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['anotherType'], + $messages->offsetGet(1)->getMessage() + ); + } + + public function filterValidationValidatorInclusioninCustomMessage(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'status', + new InclusionIn( + [ + 'message' => 'The status must be A=Active or I=Inactive', + 'domain' => ['A', 'I'], + ] + ) + ); + + + $messages = $validation->validate( + [] + ); + + $expected = new Messages( + [ + new Message( + 'The status must be A=Active or I=Inactive', + 'status', + InclusionIn::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + + $messages = $validation->validate(['status' => 'x=1']); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate(['status' => 'A']); + + $I->assertSame( + 0, + $messages->count() + ); } } diff --git a/tests/integration/Filter/Validation/Validator/InclusionInCest.php b/tests/integration/Filter/Validation/Validator/InclusionInCest.php deleted file mode 100644 index 9a16e5f1e4d..00000000000 --- a/tests/integration/Filter/Validation/Validator/InclusionInCest.php +++ /dev/null @@ -1,317 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\InclusionIn; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class InclusionInCest -{ - /** - * Tests inclusion in validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'status', - new InclusionIn( - [ - 'domain' => ['A', 'I'], - ] - ) - ); - - - $messages = $validation->validate( - [] - ); - - $expected = new Messages( - [ - new Message( - 'Field status must be a part of list: A, I', - 'status', - InclusionIn::class, - 0 - ), - ] - ); - - $I->assertEquals( - $expected, - $messages - ); - - - $messages = $validation->validate( - [ - 'status' => 'X', - ] - ); - - $I->assertEquals( - $expected, - $messages - ); - - - $messages = $validation->validate( - [ - 'status' => 'A', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } - - /** - * Tests inclusion in validator with single multiple field and single domain - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldSingleDomain(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'type' => 'Type must be mechanical or cyborg.', - 'anotherType' => 'AnotherType must be mechanical or cyborg.', - ]; - - $validation->add( - [ - 'type', - 'anotherType', - ], - new InclusionIn( - [ - 'domain' => ['mechanical', 'cyborg'], - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'type' => 'cyborg', - 'anotherType' => 'cyborg', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'type' => 'hydraulic', - 'anotherType' => 'cyborg', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'type' => 'hydraulic', - 'anotherType' => 'hydraulic', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['anotherType'], - $messages->offsetGet(1)->getMessage() - ); - } - - /** - * Tests inclusion in validator with single multiple field and domain - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldMultipleDomain(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'type' => 'Type must be mechanic or cyborg.', - 'anotherType' => 'AnotherType must be mechanic or hydraulic.', - ]; - - $validation->add( - [ - 'type', - 'anotherType', - ], - new InclusionIn( - [ - 'domain' => [ - 'type' => ['cyborg', 'mechanic'], - 'anotherType' => ['mechanic', 'hydraulic'], - ], - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'type' => 'cyborg', - 'anotherType' => 'mechanic', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'type' => 'hydraulic', - 'anotherType' => 'mechanic', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - - $messages = $validation->validate( - [ - 'type' => 'mechanic', - 'anotherType' => 'cyborg', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $expected = $validationMessages['anotherType']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - - $messages = $validation->validate( - [ - 'type' => 'hydraulic', - 'anotherType' => 'cyborg', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['anotherType'], - $messages->offsetGet(1)->getMessage() - ); - } - - public function filterValidationValidatorCustomMessage(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'status', - new InclusionIn( - [ - 'message' => 'The status must be A=Active or I=Inactive', - 'domain' => ['A', 'I'], - ] - ) - ); - - - $messages = $validation->validate( - [] - ); - - $expected = new Messages( - [ - new Message( - 'The status must be A=Active or I=Inactive', - 'status', - InclusionIn::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate(['status' => 'x=1']); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate(['status' => 'A']); - - $I->assertEquals( - 0, - $messages->count() - ); - } -} diff --git a/tests/integration/Filter/Validation/Validator/Ip/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Ip/ValidateCest.php index c89eca871d6..75e08626149 100644 --- a/tests/integration/Filter/Validation/Validator/Ip/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Ip/ValidateCest.php @@ -80,7 +80,7 @@ public function filterValidationValidatorIpSingleField(IntegrationTester $I) $I->assertNotEmpty($messages); - $I->assertEquals( + $I->assertSame( 'This is a test message', (string) $messages[0] ); diff --git a/tests/integration/Filter/Validation/Validator/Numericality/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Numericality/ValidateCest.php index 76ec0c589ec..72c3c4e9771 100644 --- a/tests/integration/Filter/Validation/Validator/Numericality/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Numericality/ValidateCest.php @@ -16,6 +16,7 @@ use Codeception\Example; use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\Numericality; use stdClass; @@ -24,10 +25,36 @@ */ class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Numericality :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorNumericalityValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Numericality - validate() - empty"); + + $validation = new Validation(); + $validator = new Numericality(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\Numericality :: validate() * - * @dataProvider getExamples + * @dataProvider getMixedExamples * * @author Phalcon Team * @since 2018-11-13 @@ -44,10 +71,149 @@ public function filterValidationValidatorNumericalityValidate(IntegrationTester $validator = new Numericality(); $actual = $validator->validate($validation, 'price'); - $I->assertEquals($actual, $example[1]); + $I->assertSame($actual, $example[1]); + } + + /** + * Tests numericality validator with single field + * + * @author Wojciech Ślawski + * @author Andrey Izman + * @since 2016-06-05 + * + * @dataProvider getExamples + */ + public function filterValidationValidatorNumericalitySingleField(IntegrationTester $I, Example $example) + { + $validation = new Validation(); + $validation->add('amount', new Numericality()); + + $amount = $example['amount']; + $expected = $example['expected']; + $messages = $validation->validate( + [ + 'amount' => $amount, + ] + ); + + $actual = $messages->count(); + $I->assertSame($expected, $actual); } + /** + * Tests numericality validator with multiple field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorNumericalityMultipleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'amount' => 'Amount must be digit.', + 'price' => 'Price must be digit.', + ]; + + $validation->add( + [ + 'amount', + 'price', + ], + new Numericality( + [ + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'amount' => 123, + 'price' => 123, + ] + ); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'amount' => '123abc', + 'price' => 123, + ] + ); + + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['amount']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'amount' => '123abc', + 'price' => '123abc', + ] + ); + + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['amount']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['price']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * @return array + */ private function getExamples(): array + { + return [ + [ + 'amount' => 123, + 'expected' => 0, + ], + [ + 'amount' => 123.12, + 'expected' => 0, + ], + [ + 'amount' => '-12,000', + 'expected' => 0, + ], + [ + 'amount' => '-12,0@0', + 'expected' => 1, + ], + [ + 'amount' => '-12,0@@0', + 'expected' => 1, + ], + [ + 'amount' => '123abc', + 'expected' => 1, + ], + [ + 'amount' => '123.12e3', + 'expected' => 1, + ], + ]; + } + + /** + * @return array[] + */ + private function getMixedExamples(): array { return [ [1, true], diff --git a/tests/integration/Filter/Validation/Validator/NumericalityCest.php b/tests/integration/Filter/Validation/Validator/NumericalityCest.php deleted file mode 100644 index 05a40c23431..00000000000 --- a/tests/integration/Filter/Validation/Validator/NumericalityCest.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use Codeception\Example; -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Numericality; - -class NumericalityCest -{ - /** - * Tests numericality validator with single field - * - * @author Wojciech Ślawski - * @author Andrey Izman - * @since 2016-06-05 - * - * @dataProvider getExamples - */ - public function filterValidationValidatorSingleField(IntegrationTester $I, Example $example) - { - $validation = new Validation(); - $validation->add('amount', new Numericality()); - - $amount = $example['amount']; - $expected = $example['expected']; - $messages = $validation->validate( - [ - 'amount' => $amount, - ] - ); - - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - } - - /** - * Tests numericality validator with multiple field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'amount' => 'Amount must be digit.', - 'price' => 'Price must be digit.', - ]; - - $validation->add( - [ - 'amount', - 'price', - ], - new Numericality( - [ - 'message' => $validationMessages, - ] - ) - ); - - $messages = $validation->validate( - [ - 'amount' => 123, - 'price' => 123, - ] - ); - - $expected = 0; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate( - [ - 'amount' => '123abc', - 'price' => 123, - ] - ); - - $expected = 1; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['amount']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate( - [ - 'amount' => '123abc', - 'price' => '123abc', - ] - ); - - $expected = 2; - $actual = $messages->count(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['amount']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['price']; - $actual = $messages->offsetGet(1)->getMessage(); - $I->assertEquals($expected, $actual); - } - - /** - * @return array - */ - private function getExamples(): array - { - return [ - [ - 'amount' => 123, - 'expected' => 0, - ], - [ - 'amount' => 123.12, - 'expected' => 0, - ], - [ - 'amount' => '-12,000', - 'expected' => 0, - ], - [ - 'amount' => '-12,0@0', - 'expected' => 1, - ], - [ - 'amount' => '-12,0@@0', - 'expected' => 1, - ], - [ - 'amount' => '123abc', - 'expected' => 1, - ], - [ - 'amount' => '123.12e3', - 'expected' => 1, - ], - ]; - } -} diff --git a/tests/integration/Filter/Validation/Validator/PresenceOf/ValidateCest.php b/tests/integration/Filter/Validation/Validator/PresenceOf/ValidateCest.php index f07b1125d8e..c0366d2990e 100644 --- a/tests/integration/Filter/Validation/Validator/PresenceOf/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/PresenceOf/ValidateCest.php @@ -13,7 +13,14 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\PresenceOf; +use Codeception\Example; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\PresenceOf; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +28,276 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\PresenceOf :: validate() + * Tests Phalcon\Filter\Validation\Validator\PresenceOf :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorPresenceOfValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\PresenceOf - validate() - empty"); + + $validation = new Validation(); + $validator = new PresenceOf(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + + /** + * Tests presence of validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + * + * @dataProvider getSingleFieldExamples + */ + public function filterValidationValidatorPresenceOfSingleField(IntegrationTester $I, Example $example) + { + $validation = new Validation(); + + $validation->add( + 'name', + new PresenceOf() + ); + + $messages = $validation->validate( + [ + 'name' => $example['name'], + ] + ); + + $I->assertSame( + $example['expected'], + $messages->count() + ); + } + + /** + * Tests presence of validator with multiple field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorPresenceOfMultipleFields(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name cant be empty.', + 'type' => 'Type cant be empty.', + ]; + + $validation->add( + ['name', 'type'], + new PresenceOf( + [ + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'type' => 'SomeValue', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'name' => '', + 'type' => 'SomeValue', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + $expected = new Messages( + [ + new Message( + 'Name cant be empty.', + 'name', + PresenceOf::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + + $messages = $validation->validate( + [ + 'name' => '', + 'type' => '', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(1)->getMessage() + ); + + $expected = new Messages( + [ + new Message( + 'Name cant be empty.', + 'name', + PresenceOf::class, + 0 + ), + new Message( + 'Type cant be empty.', + 'type', + PresenceOf::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + } + + /** + * Tests mixed fields + * + * @author Phalcon Team + * @since 2013-03-01 + */ + public function filterValidationValidatorPresenceOfMixedFields(IntegrationTester $I) + { + $validation = new Validation(); + + $validation + ->add('name', new PresenceOf(['message' => 'The name is required'])) + ->add('email', new PresenceOf(['message' => 'The email is required'])) + ->add('login', new PresenceOf(['message' => 'The login is required'])) + ; + + $expected = new Messages( + [ + new Message( + 'The name is required', + 'name', + PresenceOf::class, + 0 + ), + new Message( + 'The email is required', + 'email', + PresenceOf::class, + 0 + ), + new Message( + 'The login is required', + 'login', + PresenceOf::class, + 0 + ), + ] + ); + + $actual = $validation->validate( + [] + ); + + $I->assertEquals($expected, $actual); + } + + /** + * Tests cancel validation on first fail * * @author Phalcon Team - * @since 2018-11-13 + * @since 2013-03-01 */ - public function filterValidationValidatorPresenceofValidate(IntegrationTester $I) + public function filterValidationValidatorPresenceOfCancelOnFail(IntegrationTester $I) + { + $validation = new Validation(); + + $validation + ->add('name', new PresenceOf(['message' => 'The name is required'])) + ->add('email', new PresenceOf([ + 'message' => 'The email is required', + 'cancelOnFail' => true, + ])) + ->add('login', new PresenceOf(['message' => 'The login is required'])) + ; + + $expected = new Messages( + [ + new Message( + 'The name is required', + 'name', + PresenceOf::class + ), + new Message( + 'The email is required', + 'email', + PresenceOf::class + ), + new Message( + 'The login is required', + 'login', + PresenceOf::class + ), + ] + ); + + $actual = $validation->validate( + [] + ); + + $I->assertEquals($expected, $actual); + } + + private function getSingleFieldExamples(): array { - $I->wantToTest('Validation\Validator\PresenceOf - validate()'); + return [ + [ + 'name' => 'SomeValue', + 'expected' => 0, + ], - $I->skipTest('Need implementation'); + [ + 'name' => '', + 'expected' => 1, + ], + ]; } } diff --git a/tests/integration/Filter/Validation/Validator/PresenceOfCest.php b/tests/integration/Filter/Validation/Validator/PresenceOfCest.php deleted file mode 100644 index 91b641117db..00000000000 --- a/tests/integration/Filter/Validation/Validator/PresenceOfCest.php +++ /dev/null @@ -1,270 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use Codeception\Example; -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\PresenceOf; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class PresenceOfCest -{ - /** - * Tests presence of validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - * - * @dataProvider shouldValidateSingleFieldProvider - */ - public function shouldValidateSingleField(IntegrationTester $I, Example $example) - { - $validation = new Validation(); - - $validation->add( - 'name', - new PresenceOf() - ); - - $messages = $validation->validate( - [ - 'name' => $example['name'], - ] - ); - - $I->assertEquals( - $example['expected'], - $messages->count() - ); - } - - /** - * Tests presence of validator with multiple field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function shouldValidateMultipleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'name' => 'Name cant be empty.', - 'type' => 'Type cant be empty.', - ]; - - $validation->add( - ['name', 'type'], - new PresenceOf( - [ - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'type' => 'SomeValue', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'name' => '', - 'type' => 'SomeValue', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - $expected = new Messages( - [ - new Message( - 'Name cant be empty.', - 'name', - PresenceOf::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate( - [ - 'name' => '', - 'type' => '', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(1)->getMessage() - ); - - $expected = new Messages( - [ - new Message( - 'Name cant be empty.', - 'name', - PresenceOf::class, - 0 - ), - new Message( - 'Type cant be empty.', - 'type', - PresenceOf::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - } - - /** - * Tests mixed fields - * - * @author Phalcon Team - * @since 2013-03-01 - */ - public function shouldValidateMixedFields(IntegrationTester $I) - { - $validation = new Validation(); - - $validation - ->add('name', new PresenceOf(['message' => 'The name is required'])) - ->add('email', new PresenceOf(['message' => 'The email is required'])) - ->add('login', new PresenceOf(['message' => 'The login is required'])) - ; - - $expected = new Messages( - [ - new Message( - 'The name is required', - 'name', - PresenceOf::class, - 0 - ), - new Message( - 'The email is required', - 'email', - PresenceOf::class, - 0 - ), - new Message( - 'The login is required', - 'login', - PresenceOf::class, - 0 - ), - ] - ); - - $actual = $validation->validate( - [] - ); - - $I->assertEquals($expected, $actual); - } - - /** - * Tests cancel validation on first fail - * - * @author Phalcon Team - * @since 2013-03-01 - */ - public function shouldCancelOnFail(IntegrationTester $I) - { - $validation = new Validation(); - - $validation - ->add('name', new PresenceOf(['message' => 'The name is required'])) - ->add('email', new PresenceOf([ - 'message' => 'The email is required', - 'cancelOnFail' => true, - ])) - ->add('login', new PresenceOf(['message' => 'The login is required'])) - ; - - $expected = new Messages( - [ - new Message( - 'The name is required', - 'name', - PresenceOf::class - ), - new Message( - 'The email is required', - 'email', - PresenceOf::class - ), - new Message( - 'The login is required', - 'login', - PresenceOf::class - ), - ] - ); - - $actual = $validation->validate( - [] - ); - - $I->assertEquals($expected, $actual); - } - - private function shouldValidateSingleFieldProvider(): array - { - return [ - [ - 'name' => 'SomeValue', - 'expected' => 0, - ], - - [ - 'name' => '', - 'expected' => 1, - ], - ]; - } -} diff --git a/tests/integration/Filter/Validation/Validator/Regex/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Regex/ValidateCest.php index 0756b5c8955..29978b7716f 100644 --- a/tests/integration/Filter/Validation/Validator/Regex/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Regex/ValidateCest.php @@ -14,6 +14,12 @@ namespace Phalcon\Tests\Integration\Filter\Validation\Validator\Regex; use IntegrationTester; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Validator\Regex; +use Phalcon\Messages\Message; +use Phalcon\Messages\Messages; +use stdClass; /** * Class ValidateCest @@ -21,15 +27,303 @@ class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\Regex :: validate() + * Tests Phalcon\Filter\Validation\Validator\Regex :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2018-11-13 + * @since 2023-08-03 + */ + public function filterValidationValidatorRegexValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Regex - validate() - empty"); + + $validation = new Validation(); + $validator = new Regex(['allowEmpty' => true,]); + $validation->add('price', $validator); + $entity = new stdClass(); + $entity->price = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'price'); + $I->assertTrue($result); + } + + /** + * Tests regex validator with single field + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorRegexSingleField(IntegrationTester $I) + { + $validation = new Validation(); + + $validation->add( + 'car_plate', + new Regex( + [ + 'pattern' => '/[A-Z]{3}\-[0-9]{3}/', + ] + ) + ); + + $messages = $validation->validate( + [] + ); + + $expected = new Messages( + [ + new Message( + 'Field car_plate does not match the required format', + 'car_plate', + Regex::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + $messages = $validation->validate( + [ + 'car_plate' => 'XYZ-123', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + } + + /** + * Tests regex validator with multiple field and single pattern + * + * @author Wojciech Ślawski + * @since 2016-06-05 + */ + public function filterValidationValidatorRegexMultipleFieldSinglePattern(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name can be only lowercase letters.', + 'type' => 'Type can be only lowercase letters.', + ]; + + $validation->add( + [ + 'name', + 'type', + ], + new Regex( + [ + 'pattern' => '/^[a-z]+$/', + 'message' => $validationMessages, + ] + ) + ); + + $messages = $validation->validate( + [ + 'name' => 'somevalue', + 'type' => 'somevalue', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'type' => 'somevalue', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'type' => 'SomeValue', + ] + ); + + + $I->assertSame( + 2, + $messages->count() + ); + + $expected = $validationMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMessages['type']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + /** + * Tests regex validator with multiple field and pattern + * + * @author Wojciech Ślawski + * @since 2016-06-05 */ - public function filterValidationValidatorRegexValidate(IntegrationTester $I) + public function filterValidationValidatorRegexMultipleFieldMultiplePattern(IntegrationTester $I) + { + $validation = new Validation(); + + $validationMessages = [ + 'name' => 'Name can be only lowercase letters.', + 'type' => 'Type can be only uppercase letters.', + ]; + + $validation->add( + [ + 'name', + 'type', + ], + new Regex( + [ + 'pattern' => [ + 'name' => '/^[a-z]+$/', + 'type' => '/^[A-Z]+$/', + ], + 'message' => $validationMessages, + ] + ) + ); + + + $messages = $validation->validate( + [ + 'name' => 'somevalue', + 'type' => 'SOMEVALUE', + ] + ); + + $I->assertSame( + 0, + $messages->count() + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'type' => 'SOMEVALUE', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'name' => 'somevalue', + 'type' => 'somevalue', + ] + ); + + $I->assertSame( + 1, + $messages->count() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(0)->getMessage() + ); + + + $messages = $validation->validate( + [ + 'name' => 'SomeValue', + 'type' => 'SomeValue', + ] + ); + + $I->assertSame( + 2, + $messages->count() + ); + + $I->assertSame( + $validationMessages['name'], + $messages->offsetGet(0)->getMessage() + ); + + $I->assertSame( + $validationMessages['type'], + $messages->offsetGet(1)->getMessage() + ); + } + + public function filterValidationValidatorRegexCustomMessage(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\Regex - validate()'); + $validation = new Validation(); + + $validation->add( + 'car_plate', + new Regex( + [ + 'pattern' => '/[A-Z]{3}\-[0-9]{3}/', + 'message' => 'The car plate is not valid', + ] + ) + ); + + + $messages = $validation->validate( + [] + ); + + $expected = new Messages( + [ + new Message( + 'The car plate is not valid', + 'car_plate', + Regex::class, + 0 + ), + ] + ); + + $I->assertEquals($expected, $messages); + + + $messages = $validation->validate( + [ + 'car_plate' => 'XYZ-123', + ] + ); - $I->skipTest('Need implementation'); + $I->assertSame( + 0, + $messages->count() + ); } } diff --git a/tests/integration/Filter/Validation/Validator/RegexCest.php b/tests/integration/Filter/Validation/Validator/RegexCest.php deleted file mode 100644 index 62349711b30..00000000000 --- a/tests/integration/Filter/Validation/Validator/RegexCest.php +++ /dev/null @@ -1,296 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; -use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Validator\Regex; -use Phalcon\Messages\Message; -use Phalcon\Messages\Messages; - -class RegexCest -{ - /** - * Tests regex validator with single field - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorSingleField(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'car_plate', - new Regex( - [ - 'pattern' => '/[A-Z]{3}\-[0-9]{3}/', - ] - ) - ); - - $messages = $validation->validate( - [] - ); - - $expected = new Messages( - [ - new Message( - 'Field car_plate does not match the required format', - 'car_plate', - Regex::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - $messages = $validation->validate( - [ - 'car_plate' => 'XYZ-123', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } - - /** - * Tests regex validator with multiple field and single pattern - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldSinglePattern(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'name' => 'Name can be only lowercase letters.', - 'type' => 'Type can be only lowercase letters.', - ]; - - $validation->add( - [ - 'name', - 'type', - ], - new Regex( - [ - 'pattern' => '/^[a-z]+$/', - 'message' => $validationMessages, - ] - ) - ); - - $messages = $validation->validate( - [ - 'name' => 'somevalue', - 'type' => 'somevalue', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'type' => 'somevalue', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $expected = $validationMessages['name']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'type' => 'SomeValue', - ] - ); - - - $I->assertEquals( - 2, - $messages->count() - ); - - $expected = $validationMessages['name']; - $actual = $messages->offsetGet(0)->getMessage(); - $I->assertEquals($expected, $actual); - - $expected = $validationMessages['type']; - $actual = $messages->offsetGet(1)->getMessage(); - $I->assertEquals($expected, $actual); - } - - /** - * Tests regex validator with multiple field and pattern - * - * @author Wojciech Ślawski - * @since 2016-06-05 - */ - public function filterValidationValidatorMultipleFieldMultiplePattern(IntegrationTester $I) - { - $validation = new Validation(); - - $validationMessages = [ - 'name' => 'Name can be only lowercase letters.', - 'type' => 'Type can be only uppercase letters.', - ]; - - $validation->add( - [ - 'name', - 'type', - ], - new Regex( - [ - 'pattern' => [ - 'name' => '/^[a-z]+$/', - 'type' => '/^[A-Z]+$/', - ], - 'message' => $validationMessages, - ] - ) - ); - - - $messages = $validation->validate( - [ - 'name' => 'somevalue', - 'type' => 'SOMEVALUE', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'type' => 'SOMEVALUE', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'name' => 'somevalue', - 'type' => 'somevalue', - ] - ); - - $I->assertEquals( - 1, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(0)->getMessage() - ); - - - $messages = $validation->validate( - [ - 'name' => 'SomeValue', - 'type' => 'SomeValue', - ] - ); - - $I->assertEquals( - 2, - $messages->count() - ); - - $I->assertEquals( - $validationMessages['name'], - $messages->offsetGet(0)->getMessage() - ); - - $I->assertEquals( - $validationMessages['type'], - $messages->offsetGet(1)->getMessage() - ); - } - - public function filterValidationValidatorCustomMessage(IntegrationTester $I) - { - $validation = new Validation(); - - $validation->add( - 'car_plate', - new Regex( - [ - 'pattern' => '/[A-Z]{3}\-[0-9]{3}/', - 'message' => 'The car plate is not valid', - ] - ) - ); - - - $messages = $validation->validate( - [] - ); - - $expected = new Messages( - [ - new Message( - 'The car plate is not valid', - 'car_plate', - Regex::class, - 0 - ), - ] - ); - - $I->assertEquals($expected, $messages); - - - $messages = $validation->validate( - [ - 'car_plate' => 'XYZ-123', - ] - ); - - $I->assertEquals( - 0, - $messages->count() - ); - } -} diff --git a/tests/integration/Filter/Validation/Validator/SetOptionCest.php b/tests/integration/Filter/Validation/Validator/SetOptionCest.php deleted file mode 100644 index e2e5ae772e0..00000000000 --- a/tests/integration/Filter/Validation/Validator/SetOptionCest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; - -/** - * Class SetOptionCest - */ -class SetOptionCest -{ - /** - * Tests Phalcon\Filter\Validation\Validator :: setOption() - * - * @author Phalcon Team - * @since 2018-11-13 - */ - public function filterValidationValidatorSetOption(IntegrationTester $I) - { - $I->wantToTest('Validation\Validator - setOption()'); - $I->skipTest('Need implementation'); - } -} diff --git a/tests/integration/Filter/Validation/Validator/StringLength/GetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/GetTemplateCest.php index a1ee6273569..979cac4bd37 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/GetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/GetTemplateCest.php @@ -32,7 +32,7 @@ public function filterValidationValidatorStringLengthGetTemplate(IntegrationTest $expected = 'The field :field is not valid for ' . StringLength::class; - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplate(), 'Default template message' @@ -44,7 +44,7 @@ public function filterValidationValidatorStringLengthGetTemplate(IntegrationTest $I->assertInstanceOf(StringLength::class, $actual, 'Instance of StringLenght'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplate(), 'Get equals template message' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetOptionCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetOptionCest.php index 8cce59b96c2..7140dd63ee7 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetOptionCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetOptionCest.php @@ -30,7 +30,7 @@ public function filterValidationValidatorStringLengthMaxGetOption(IntegrationTes $validator = new Max(); - $I->assertEquals(null, $validator->getOption('max'), 'Max option is null by default'); + $I->assertSame(null, $validator->getOption('max'), 'Max option is null by default'); $expected = 1234; $validator->setOption('max', $expected); @@ -38,6 +38,6 @@ public function filterValidationValidatorStringLengthMaxGetOption(IntegrationTes $expected = '1234'; $validator->setOption('max', $expected); - $I->assertEquals($expected, $validator->getOption('max'), 'Max option is "1234"'); + $I->assertSame($expected, $validator->getOption('max'), 'Max option is "1234"'); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplateCest.php index 52ee5986b2c..3327e7fb718 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplateCest.php @@ -31,16 +31,16 @@ public function filterValidationValidatorStringLengthMaxGetTemplate(IntegrationT $validator = new Max(); $expected = 'Field :field must not exceed :max characters long'; - $I->assertEquals($expected, $validator->getTemplate(), 'Default template message for Max'); + $I->assertSame($expected, $validator->getTemplate(), 'Default template message for Max'); $validator->setTemplate(''); $expected = 'The field :field is not valid for ' . Max::class; - $I->assertEquals($expected, $validator->getTemplate(), 'Default template message'); + $I->assertSame($expected, $validator->getTemplate(), 'Default template message'); $expected = 'New custom template'; $validator->setTemplate($expected); - $I->assertEquals($expected, $validator->getTemplate(), 'New template message'); + $I->assertSame($expected, $validator->getTemplate(), 'New template message'); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplatesCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplatesCest.php index bcb415c259b..bef06d27af5 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplatesCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/GetTemplatesCest.php @@ -54,12 +54,12 @@ public function filterValidationValidatorStringLengthMaxGetTemplates(Integration ); $I->assertTrue(is_array($validator->getTemplates()), 'Multi templates have to be an array'); - $I->assertEquals( + $I->assertSame( $messageLastName, $validator->getTemplate('name_last'), 'Last name template' ); - $I->assertEquals( + $I->assertSame( $messageFirstName, $validator->getTemplate('name_first'), 'First name template' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/MessageFactoryCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/MessageFactoryCest.php index ae6c34b9ae9..6694928f984 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/MessageFactoryCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/MessageFactoryCest.php @@ -47,8 +47,8 @@ public function filterValidationValidatorStringLengthMaxMessageFactory(Integrati $messages = $validation->validate(['last_name' => 'A name too long']); - $I->assertInstanceOf(Messages::class, $messages, 'Failed validation instance of Messages\Messages'); - $I->assertEquals(1, $messages->count(), 'Has 1 Message'); + $I->assertInstanceOf(Messages::class, $messages); + $I->assertSame(1, $messages->count(), 'Has 1 Message'); $actual = $validator->messageFactory( $validation, @@ -62,7 +62,7 @@ public function filterValidationValidatorStringLengthMaxMessageFactory(Integrati Max::class ); - $I->assertInstanceOf(Message::class, $actual, 'Failed validation message instanceof Message'); - $I->assertEquals($expected, $actual, 'Failed validation message and factory message are the same'); + $I->assertInstanceOf(Message::class, $actual); + $I->assertEquals($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplateCest.php index c8937b6c1c6..e80653566ce 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplateCest.php @@ -36,7 +36,7 @@ public function filterValidationValidatorStringLengthMaxSetTemplate(IntegrationT $I->assertInstanceOf(Max::class, $actual, 'Instance of Max'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplate(), 'Get equals template message' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplatesCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplatesCest.php index 40c0e24bd21..133c9418786 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplatesCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/SetTemplatesCest.php @@ -40,7 +40,7 @@ public function filterValidationValidatorStringLengthMaxSetTemplates(Integration $I->assertInstanceOf(Max::class, $actual, 'Instance of Max'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplates(), 'Get equals templates' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php index 53b379e0197..e3307168d55 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php @@ -15,19 +15,36 @@ use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\StringLength\Max; +use stdClass; class ValidateCest { /** - * Tests Phalcon\Filter\Validation\Validator\StringLength\Max :: validate() + * Tests Phalcon\Filter\Validation\Validator\Min :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception * * @author Phalcon Team - * @since 2019-05-23 + * @since 2023-08-03 */ - public function filterValidationValidatorStringLengthMaxValidate(IntegrationTester $I) + public function filterValidationValidatorMaxValidateEmpty(IntegrationTester $I) { - $I->wantToTest('Validation\Validator\StringLength\Max - validate()'); + $I->wantToTest("Validation\Validator\Max - validate() - empty"); + + $validation = new Validation(); + $validator = new Max(['allowEmpty' => true,]); + $validation->add('name', $validator); + $entity = new stdClass(); + $entity->name = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'name'); + $I->assertTrue($result); } /** @@ -59,7 +76,7 @@ public function filterValidationValidatorMaxStringLengthValidateSingleField(Inte ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -71,7 +88,7 @@ public function filterValidationValidatorMaxStringLengthValidateSingleField(Inte ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -107,7 +124,7 @@ public function filterValidationValidatorMaxOrEqualStringLengthValidateSingleFie ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -118,7 +135,7 @@ public function filterValidationValidatorMaxOrEqualStringLengthValidateSingleFie ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -130,7 +147,7 @@ public function filterValidationValidatorMaxOrEqualStringLengthValidateSingleFie ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetOptionCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetOptionCest.php index 7b016e1b804..344beaebfe0 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetOptionCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetOptionCest.php @@ -30,7 +30,7 @@ public function filterValidationValidatorStringLengthMinGetOption(IntegrationTes $validator = new Min(); - $I->assertEquals(null, $validator->getOption('min'), 'Min option is null by default'); + $I->assertSame(null, $validator->getOption('min'), 'Min option is null by default'); $expected = 1234; $validator->setOption('min', $expected); @@ -38,6 +38,6 @@ public function filterValidationValidatorStringLengthMinGetOption(IntegrationTes $expected = '1234'; $validator->setOption('min', $expected); - $I->assertEquals($expected, $validator->getOption('min'), 'Min option is "1234"'); + $I->assertSame($expected, $validator->getOption('min'), 'Min option is "1234"'); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplateCest.php index b0f784151e8..1bf9b47369d 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplateCest.php @@ -31,16 +31,16 @@ public function filterValidationValidatorStringLengthMinGetTemplate(IntegrationT $validator = new Min(); $expected = 'Field :field must be at least :min characters long'; - $I->assertEquals($expected, $validator->getTemplate(), 'Default template message for Min'); + $I->assertSame($expected, $validator->getTemplate(), 'Default template message for Min'); $validator->setTemplate(''); $expected = 'The field :field is not valid for ' . Min::class; - $I->assertEquals($expected, $validator->getTemplate(), 'Default template message'); + $I->assertSame($expected, $validator->getTemplate(), 'Default template message'); $expected = 'New custom template'; $validator->setTemplate($expected); - $I->assertEquals($expected, $validator->getTemplate(), 'New template message'); + $I->assertSame($expected, $validator->getTemplate(), 'New template message'); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplatesCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplatesCest.php index 45a0f19208c..608258b2208 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplatesCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/GetTemplatesCest.php @@ -54,12 +54,12 @@ public function filterValidationValidatorStringLengthMinGetTemplates(Integration ); $I->assertTrue(is_array($validator->getTemplates()), 'Multi templates have to be an array'); - $I->assertEquals( + $I->assertSame( $messageLastName, $validator->getTemplate('name_last'), 'Last name template' ); - $I->assertEquals( + $I->assertSame( $messageFirstName, $validator->getTemplate('name_first'), 'First name template' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/MessageFactoryCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/MessageFactoryCest.php index 7ea7c217403..99a3d12798a 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/MessageFactoryCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/MessageFactoryCest.php @@ -47,8 +47,8 @@ public function filterValidationValidatorStringLengthMinMessageFactory(Integrati $messages = $validation->validate(['last_name' => 'A name too short']); - $I->assertInstanceOf(Messages::class, $messages, 'Failed validation instance of Messages\Messages'); - $I->assertEquals(1, $messages->count(), 'Has 1 Message'); + $I->assertInstanceOf(Messages::class, $messages); + $I->assertSame(1, $messages->count()); $actual = $validator->messageFactory( $validation, @@ -62,7 +62,7 @@ public function filterValidationValidatorStringLengthMinMessageFactory(Integrati Min::class ); - $I->assertInstanceOf(Message::class, $actual, 'Failed validation message instanceof Message'); - $I->assertEquals($expected, $actual, 'Failed validation message and factory message are the same'); + $I->assertInstanceOf(Message::class, $actual); + $I->assertEquals($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplateCest.php index 86c8aec430a..08887c90220 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplateCest.php @@ -36,7 +36,7 @@ public function filterValidationValidatorStringLengthMinSetTemplate(IntegrationT $I->assertInstanceOf(Min::class, $actual, 'Instance of Min'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplate(), 'Get equals template message' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplatesCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplatesCest.php index 80d139c5c1d..4338b074c96 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplatesCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/SetTemplatesCest.php @@ -40,7 +40,7 @@ public function filterValidationValidatorStringLengthMinSetTemplates(Integration $I->assertInstanceOf(Min::class, $actual, 'Instance of Min'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplates(), 'Get equals templates' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php index 54af3b6b2b9..cfb14f475a3 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php @@ -15,10 +15,38 @@ use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\StringLength\Min; +use stdClass; class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Min :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorMinValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Min - validate() - empty"); + + $validation = new Validation(); + $validator = new Min(['allowEmpty' => true,]); + $validation->add('name', $validator); + $entity = new stdClass(); + $entity->name = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'name'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\StringLength :: validate() - single * field @@ -48,7 +76,7 @@ public function filterValidationValidatorMinStringLengthValidateSingleField(Inte ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -60,7 +88,7 @@ public function filterValidationValidatorMinStringLengthValidateSingleField(Inte ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -96,7 +124,7 @@ public function filterValidationValidatorMinOrEqualStringLengthValidateSingleFie ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -108,7 +136,7 @@ public function filterValidationValidatorMinOrEqualStringLengthValidateSingleFie ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/StringLength/SetTemplateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/SetTemplateCest.php index 2bcab559422..c9df2fb214f 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/SetTemplateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/SetTemplateCest.php @@ -36,7 +36,7 @@ public function filterValidationValidatorStringLengthSetTemplate(IntegrationTest $I->assertInstanceOf(StringLength::class, $actual, 'Instance of StringLenght'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplate(), 'Get equals template message' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/SetTemplatesCest.php b/tests/integration/Filter/Validation/Validator/StringLength/SetTemplatesCest.php index b89b1d3799d..a2fda7beaeb 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/SetTemplatesCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/SetTemplatesCest.php @@ -40,7 +40,7 @@ public function filterValidationValidatorStringLengthSetTemplates(IntegrationTes $I->assertInstanceOf(StringLength::class, $actual, 'Instance of StringLenght'); - $I->assertEquals( + $I->assertSame( $expected, $validator->getTemplates(), 'Get equals templates' diff --git a/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php index 0f4e9ff6f94..06508262015 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php @@ -56,7 +56,7 @@ public function filterValidationValidatorStringLengthValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -68,7 +68,7 @@ public function filterValidationValidatorStringLengthValidateSingleField(Integra ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); @@ -102,7 +102,7 @@ public function filterValidationValidatorStringLengthValidateMinimum(Integration ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -160,7 +160,7 @@ public function filterValidationValidatorStringLengthValidateMinimumWithCustomMe ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -214,7 +214,7 @@ public function filterValidationValidatorStringLengthValidateMaximum(Integration ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -265,14 +265,13 @@ public function filterValidationValidatorStringLengthValidateMaximumWithCustomMe ) ); - $messages = $validation->validate( [ 'message' => 'Pet', ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -346,7 +345,7 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldSingle ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -359,12 +358,12 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldSingle ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['name'], $messages->offsetGet(0)->getMessage() ); @@ -377,17 +376,17 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldSingle ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['name'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['type'], $messages->offsetGet(1)->getMessage() ); @@ -445,7 +444,7 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldMultip ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -458,12 +457,12 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldMultip ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['name'], $messages->offsetGet(0)->getMessage() ); @@ -476,12 +475,12 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldMultip ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['type'], $messages->offsetGet(0)->getMessage() ); @@ -494,17 +493,17 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldMultip ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['name'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMaximumMessages['type'], $messages->offsetGet(1)->getMessage() ); diff --git a/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php index 1c880a7d9c4..8028330b329 100644 --- a/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php @@ -16,10 +16,13 @@ use Codeception\Example; use IntegrationTester; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\Validator\Url; use Phalcon\Messages\Message; use Phalcon\Messages\Messages; +use stdClass; + use const FILTER_FLAG_PATH_REQUIRED; use const FILTER_FLAG_QUERY_REQUIRED; @@ -28,6 +31,32 @@ */ class ValidateCest { + /** + * Tests Phalcon\Filter\Validation\Validator\Url :: validate() - empty + * + * @param IntegrationTester $I + * + * @return void + * @throws Exception + * + * @author Phalcon Team + * @since 2023-08-03 + */ + public function filterValidationValidatorUrlValidateEmpty(IntegrationTester $I) + { + $I->wantToTest("Validation\Validator\Url - validate() - empty"); + + $validation = new Validation(); + $validator = new Url(['allowEmpty' => true,]); + $validation->add('url', $validator); + $entity = new stdClass(); + $entity->url = ''; + + $validation->bind($entity, []); + $result = $validator->validate($validation, 'url'); + $I->assertTrue($result); + } + /** * Tests Phalcon\Filter\Validation\Validator\Url :: validate() - single field * @@ -40,15 +69,10 @@ public function filterValidationValidatorUrlSingleField(IntegrationTester $I) $validation = new Validation(); - $validation->add( - 'url', - new Url() - ); + $validation->add('url', new Url()); - $messages = $validation->validate( - [] - ); + $messages = $validation->validate([]); $expected = new Messages( [ @@ -79,7 +103,7 @@ public function filterValidationValidatorUrlSingleField(IntegrationTester $I) ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -121,7 +145,7 @@ public function filterValidationValidatorUrlMultipleField(IntegrationTester $I) ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -133,12 +157,12 @@ public function filterValidationValidatorUrlMultipleField(IntegrationTester $I) ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['url'], $messages->offsetGet(0)->getMessage() ); @@ -150,17 +174,17 @@ public function filterValidationValidatorUrlMultipleField(IntegrationTester $I) ] ); - $I->assertEquals( + $I->assertSame( 2, $messages->count() ); - $I->assertEquals( + $I->assertSame( $validationMessages['url'], $messages->offsetGet(0)->getMessage() ); - $I->assertEquals( + $I->assertSame( $validationMessages['anotherUrl'], $messages->offsetGet(1)->getMessage() ); @@ -220,7 +244,7 @@ public function filterValidationValidatorUrlCustomMessage(IntegrationTester $I) ] ); - $I->assertEquals( + $I->assertSame( 0, $messages->count() ); @@ -255,7 +279,7 @@ public function filterValidationValidatorUrlFlags(IntegrationTester $I, Example ] ); - $I->assertEquals( + $I->assertSame( 1, $messages->count() ); diff --git a/tests/integration/Filter/Validation/Validator/ValidateCest.php b/tests/integration/Filter/Validation/Validator/ValidateCest.php deleted file mode 100644 index bea137ad5c4..00000000000 --- a/tests/integration/Filter/Validation/Validator/ValidateCest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Tests\Integration\Filter\Validation\Validator; - -use IntegrationTester; - -/** - * Class ValidateCest - */ -class ValidateCest -{ - /** - * Tests Phalcon\Filter\Validation\Validator :: validate() - * - * @author Phalcon Team - * @since 2018-11-13 - */ - public function filterValidationValidatorValidate(IntegrationTester $I) - { - $I->wantToTest('Validation\Validator - validate()'); - $I->skipTest('Need implementation'); - } -} From e837d981bcb152ed0249b45859ff500a9f3b3bad Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 17:01:23 -0400 Subject: [PATCH 13/29] fixing changelog --- CHANGELOG-5.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 1b9ca4e6aa4..87d43a71684 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -10,6 +10,7 @@ ## [5.2.3](https://github.com/phalcon/cphalcon/releases/tag/v5.2.3) (2023-07-26) ### Fixed +- - Tried to reproduce the behavior described in #16244 but had no success. [#16244](https://github.com/phalcon/cphalcon/issues/16244) - Extended `Phalcon\Di\Injectable` from `stdClass` to remove the deprecation warning (dynamic properties) for PHP 8.2 [#16308](https://github.com/phalcon/cphalcon/issues/16308) - Corrected the return type of `Phalcon\Mvc\View::getVar()` so that stubs can be accurate. [#16276](https://github.com/phalcon/cphalcon/issues/16276) @@ -18,6 +19,7 @@ - Fixed `Phalcon\Http\Request::getJsonRawBody` to protect from empty body [#16373](https://github.com/phalcon/cphalcon/issues/16373) ### Added + - Added `getAdapter()` in `Phalcon\Mvc\Model\Metadata` to retrieve the internal cache adapter if necessary. [#16244](https://github.com/phalcon/cphalcon/issues/16244) - Added `Phalcon\Storage\Adapter\Weak` implemented with WeakReference has a cache/retrieval solution for objects not yet collected by the Garbage Collection. [#16372](https://github.com/phalcon/cphalcon/issues/16372) From 185d6272b72c6683497170f5bcde2b90c501b4b6 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 18:16:44 -0400 Subject: [PATCH 14/29] Added addHeader() in the builder --- phalcon/Encryption/Security/JWT/Builder.zep | 24 ++++++++++++- .../Encryption/Security/JWT/Token/Token.zep | 10 ++++++ phalcon/Encryption/Security/JWT/Validator.zep | 36 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/phalcon/Encryption/Security/JWT/Builder.zep b/phalcon/Encryption/Security/JWT/Builder.zep index 9c8ec2da15a..1ae3a93b66c 100644 --- a/phalcon/Encryption/Security/JWT/Builder.zep +++ b/phalcon/Encryption/Security/JWT/Builder.zep @@ -21,7 +21,14 @@ use Phalcon\Support\Collection\CollectionInterface; use Phalcon\Support\Helper\Json\Encode; /** - * JWT Builder + * Builder + * + * The builder offers + * + * @property CollectionInterface $claims + * @property CollectionInterface $jose + * @property string $passphrase + * @property SignerInterface $signer * * @link https://tools.ietf.org/html/rfc7519 */ @@ -103,6 +110,21 @@ class Builder return this; } + /** + * Adds a custom claim + * + * @param string $name + * @param mixed $value + * + * @return Builder + */ + public function addHeader(string! name, var value) -> + { + this->jose->set(name, value); + + return this; + } + /** * @return array|string */ diff --git a/phalcon/Encryption/Security/JWT/Token/Token.zep b/phalcon/Encryption/Security/JWT/Token/Token.zep index c7922ee2628..e72a895c879 100644 --- a/phalcon/Encryption/Security/JWT/Token/Token.zep +++ b/phalcon/Encryption/Security/JWT/Token/Token.zep @@ -56,6 +56,8 @@ class Token } /** + * Return the registered claims + * * @return Item */ public function getClaims() -> @@ -64,6 +66,8 @@ class Token } /** + * Return the registered headers + * * @return Item */ public function getHeaders() -> @@ -72,6 +76,8 @@ class Token } /** + * Return the payload + * * @return string */ public function getPayload() -> string @@ -80,6 +86,8 @@ class Token } /** + * Return the signature + * * @return Signature */ public function getSignature() -> @@ -88,6 +96,8 @@ class Token } /** + * Return the token + * * @return string */ public function getToken() -> string diff --git a/phalcon/Encryption/Security/JWT/Validator.zep b/phalcon/Encryption/Security/JWT/Validator.zep index c26ad6a3880..06c674d3fec 100644 --- a/phalcon/Encryption/Security/JWT/Validator.zep +++ b/phalcon/Encryption/Security/JWT/Validator.zep @@ -64,11 +64,23 @@ class Validator ]; } + /** + * Return an array with validation errors (if any) + * + * @return array + */ public function getErrors() -> array { return this->errors; } + /** + * Return the value of a claim + * + * @param string $claim + * + * @return mixed + */ public function get(string claim) -> mixed | null { if isset this->claims[claim] { @@ -78,6 +90,14 @@ class Validator return null; } + /** + * Set the value of a claim, for comparison with the token values + * + * @param string $claim + * @param mixed $value + * + * @return Validator + */ public function set(string claim, var value) -> { let this->claims[claim] = value; @@ -86,6 +106,8 @@ class Validator } /** + * Set the token to be validated + * * @param Token $token * * @return Validator @@ -98,6 +120,8 @@ class Validator } /** + * Validate the audience + * * @param string|array $audience * * @return Validator @@ -129,6 +153,8 @@ class Validator } /** + * Validate the expiration time of the token + * * @param int $timestamp * * @return Validator @@ -151,6 +177,8 @@ class Validator } /** + * Validate the id of the token + * * @param string $id * * @return Validator @@ -170,6 +198,8 @@ class Validator } /** + * Validate the issued at (iat) of the token + * * @param int $timestamp * * @return Validator @@ -189,6 +219,8 @@ class Validator } /** + * Validate the issuer of the token + * * @param string $issuer * * @return Validator @@ -208,6 +240,8 @@ class Validator } /** + * Validate the notbefore (nbf) of the token + * * @param int $timestamp * * @return Validator @@ -227,6 +261,8 @@ class Validator } /** + * Validate the signature of the token + * * @param SignerInterface $signer * @param string $passphrase * From 0725c2187ef8d3d1b64c616a6d1a3f47c8be5b73 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 18:17:01 -0400 Subject: [PATCH 15/29] more test coverage for JWT --- tests/unit/Encryption/Crypt/DecryptCest.php | 3 +- tests/unit/Encryption/Crypt/EncryptCest.php | 9 +- .../Crypt/GetAvailableHashAlgorithmsCest.php | 2 +- .../Crypt/GetSetAuthTagLengthCest.php | 3 +- .../Security/JWT/Builder/GetClaimsCest.php | 13 +++ .../Security/JWT/Builder/GetHeadersCest.php | 18 +++- .../JWT/Builder/GetSetAudienceCest.php | 6 +- .../JWT/Builder/GetSetContentTypeCest.php | 3 +- .../JWT/Builder/GetSetIssuedAtCest.php | 3 +- .../Security/JWT/Builder/GetSetIssuerCest.php | 3 +- .../JWT/Builder/GetSetNotBeforeCest.php | 6 +- .../JWT/Builder/GetSetPassphraseCest.php | 6 +- .../JWT/Builder/GetSetSubjectCest.php | 3 +- .../Security/JWT/Builder/GetTokenCest.php | 3 +- .../JWT/Signer/Hmac/ConstructCest.php | 3 +- .../Security/JWT/Token/Parser/ParseCest.php | 41 +++---- .../JWT/Token/Signature/ConstructCest.php | 3 +- .../JWT/Token/Token/GetClaimsCest.php | 4 +- .../JWT/Token/Token/GetHeadersCest.php | 4 +- .../JWT/Token/Token/GetSignatureCest.php | 4 +- .../Security/JWT/Token/Token/ValidateCest.php | 9 +- .../Security/JWT/Token/Token/VerifyCest.php | 101 ++++++++++++++++++ .../Security/JWT/Validator/SetTokenCest.php | 1 - .../JWT/Validator/ValidateAudienceCest.php | 6 +- .../JWT/Validator/ValidateExpirationCest.php | 6 +- .../Security/JWT/Validator/ValidateIdCest.php | 3 +- .../JWT/Validator/ValidateIssuedAtCest.php | 6 +- .../JWT/Validator/ValidateIssuerCest.php | 3 +- .../JWT/Validator/ValidateNotBeforeCest.php | 6 +- .../JWT/Validator/ValidateSignatureCest.php | 12 ++- .../Encryption/Security/Random/UuidCest.php | 3 +- 31 files changed, 223 insertions(+), 73 deletions(-) create mode 100644 tests/unit/Encryption/Security/JWT/Token/Token/VerifyCest.php diff --git a/tests/unit/Encryption/Crypt/DecryptCest.php b/tests/unit/Encryption/Crypt/DecryptCest.php index 81227bb0ebd..5b5baa1c2f7 100644 --- a/tests/unit/Encryption/Crypt/DecryptCest.php +++ b/tests/unit/Encryption/Crypt/DecryptCest.php @@ -29,7 +29,8 @@ class DecryptCest { /** - * Tests Phalcon\Encryption\Crypt :: decrypt() - no exception on key mismatch + * Tests Phalcon\Encryption\Crypt :: decrypt() - no exception on key + * mismatch * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Crypt/EncryptCest.php b/tests/unit/Encryption/Crypt/EncryptCest.php index 89e477163d1..1ce0d41accf 100644 --- a/tests/unit/Encryption/Crypt/EncryptCest.php +++ b/tests/unit/Encryption/Crypt/EncryptCest.php @@ -184,7 +184,8 @@ public function encryptionCryptEncryptGcmCcmWithData(UnitTester $I) } /** - * Tests Phalcon\Encryption\Crypt :: encrypt() - gcm/ccm exception without data + * Tests Phalcon\Encryption\Crypt :: encrypt() - gcm/ccm exception without + * data * * @param UnitTester $I * @@ -222,7 +223,8 @@ function () use ($cipher) { } /** - * Tests Phalcon\Encryption\Crypt :: encrypt() - exception invalid padding size + * Tests Phalcon\Encryption\Crypt :: encrypt() - exception invalid padding + * size * * @param UnitTester $I * @@ -284,7 +286,8 @@ public function encryptionCryptEncryptCryptPadZeroPaddingReturnsInput(UnitTester } /** - * Tests Phalcon\Encryption\Crypt :: encrypt() - cannot calculate Random Pseudo Bytes + * Tests Phalcon\Encryption\Crypt :: encrypt() - cannot calculate Random + * Pseudo Bytes * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Crypt/GetAvailableHashAlgorithmsCest.php b/tests/unit/Encryption/Crypt/GetAvailableHashAlgorithmsCest.php index 1c11978b958..ac1ebe082a0 100644 --- a/tests/unit/Encryption/Crypt/GetAvailableHashAlgorithmsCest.php +++ b/tests/unit/Encryption/Crypt/GetAvailableHashAlgorithmsCest.php @@ -13,7 +13,7 @@ namespace Phalcon\Tests\Unit\Encryption\Crypt; -use Codeception\Util\Stub; +use Codeception\Stub; use Phalcon\Encryption\Crypt; use UnitTester; diff --git a/tests/unit/Encryption/Crypt/GetSetAuthTagLengthCest.php b/tests/unit/Encryption/Crypt/GetSetAuthTagLengthCest.php index 5ee4fa48959..a9e2f6296bd 100644 --- a/tests/unit/Encryption/Crypt/GetSetAuthTagLengthCest.php +++ b/tests/unit/Encryption/Crypt/GetSetAuthTagLengthCest.php @@ -19,7 +19,8 @@ class GetSetAuthTagLengthCest { /** - * Unit Tests Phalcon\Encryption\Crypt :: getAuthTagLength()/setAuthTagLength() + * Unit Tests Phalcon\Encryption\Crypt :: + * getAuthTagLength()/setAuthTagLength() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetClaimsCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetClaimsCest.php index 82d922233d2..ceac299d83b 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetClaimsCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetClaimsCest.php @@ -38,5 +38,18 @@ public function encryptionSecurityJWTBuilderGetClaims(UnitTester $I) $builder = new Builder($signer); $I->assertEmpty($builder->getClaims()); + + $builder = new Builder($signer); + $builder + ->addClaim('aud', 'Phalcon') + ->addClaim('xyz', 'Other') + ; + + $expected = [ + 'aud' => 'Phalcon', + 'xyz' => 'Other', + ]; + $actual = $builder->getClaims(); + $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetHeadersCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetHeadersCest.php index eeefb70dbe2..871a1d85b38 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetHeadersCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetHeadersCest.php @@ -43,7 +43,23 @@ public function encryptionSecurityJWTBuilderGetHeaders(UnitTester $I) 'alg' => $signer->getAlgHeader(), 'typ' => 'JWT', ]; - $actual = $builder->getHeaders(); + $actual = $builder->getHeaders(); + ksort($actual); + $I->assertSame($expected, $actual); + + + $builder = new Builder($signer); + + $builder + ->addHeader('abc', 'custom header') + ; + + $expected = [ + 'abc' => 'custom header', + 'alg' => $signer->getAlgHeader(), + 'typ' => 'JWT', + ]; + $actual = $builder->getHeaders(); ksort($actual); $I->assertSame($expected, $actual); } diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetAudienceCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetAudienceCest.php index 30d3cac22ce..84e427f7bc7 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetAudienceCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetAudienceCest.php @@ -24,7 +24,8 @@ class GetSetAudienceCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getAudience()/setAudience() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getAudience()/setAudience() * * @param UnitTester $I * @@ -52,7 +53,8 @@ public function encryptionSecurityJWTBuilderGetSetAudience(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setAudience() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setAudience() - + * exception * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetContentTypeCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetContentTypeCest.php index 26c5d4842b2..a8e8b661e89 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetContentTypeCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetContentTypeCest.php @@ -23,7 +23,8 @@ class GetSetContentTypeCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getContentType()/setContentType() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getContentType()/setContentType() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuedAtCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuedAtCest.php index 4e1d8e62744..0fb9b94fd66 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuedAtCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuedAtCest.php @@ -23,7 +23,8 @@ class GetSetIssuedAtCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getIssuedAt()/setIssuedAt() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getIssuedAt()/setIssuedAt() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuerCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuerCest.php index 9cbb4b463f8..20f823f0b9d 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuerCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetIssuerCest.php @@ -23,7 +23,8 @@ class GetSetIssuerCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getIssuer()/setIssuer() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getIssuer()/setIssuer() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetNotBeforeCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetNotBeforeCest.php index 37e8ab2fc64..f1b8fb47360 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetNotBeforeCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetNotBeforeCest.php @@ -24,7 +24,8 @@ class GetSetNotBeforeCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getNotBefore()/setNotBefore() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getNotBefore()/setNotBefore() * * @param UnitTester $I * @@ -47,7 +48,8 @@ public function encryptionSecurityJWTBuilderGetSetNotBefore(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setNotBefore() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setNotBefore() - + * exception * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetPassphraseCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetPassphraseCest.php index 8177a7709f9..d01a4e6deda 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetPassphraseCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetPassphraseCest.php @@ -25,7 +25,8 @@ class GetSetPassphraseCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getPassphrase()/setPassphrase() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getPassphrase()/setPassphrase() * * @param UnitTester $I * @@ -49,7 +50,8 @@ public function encryptionSecurityJWTBuilderGetSetPassphrase(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setPassphrase() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: setPassphrase() - + * exception * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetSetSubjectCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetSetSubjectCest.php index de3026f8cc0..595b2153023 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetSetSubjectCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetSetSubjectCest.php @@ -23,7 +23,8 @@ class GetSetSubjectCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getSubject()/setSubject() + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: + * getSubject()/setSubject() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Builder/GetTokenCest.php b/tests/unit/Encryption/Security/JWT/Builder/GetTokenCest.php index 019dcd2aaa8..065375ffe44 100644 --- a/tests/unit/Encryption/Security/JWT/Builder/GetTokenCest.php +++ b/tests/unit/Encryption/Security/JWT/Builder/GetTokenCest.php @@ -48,7 +48,8 @@ public function encryptionSecurityJWTBuilderGetToken(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getToken() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Builder :: getToken() - + * exception * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Signer/Hmac/ConstructCest.php b/tests/unit/Encryption/Security/JWT/Signer/Hmac/ConstructCest.php index 9331eb5926b..0d58cf1cbb2 100644 --- a/tests/unit/Encryption/Security/JWT/Signer/Hmac/ConstructCest.php +++ b/tests/unit/Encryption/Security/JWT/Signer/Hmac/ConstructCest.php @@ -39,7 +39,8 @@ public function encryptionSecurityJWTSignerHmacConstruct(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Signer\Hmac :: __construct() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Signer\Hmac :: __construct() + * - exception * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Token/Parser/ParseCest.php b/tests/unit/Encryption/Security/JWT/Token/Parser/ParseCest.php index 605a2122662..ba2ce20ac64 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Parser/ParseCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Parser/ParseCest.php @@ -67,18 +67,19 @@ public function encryptionSecurityJWTTokenParserParse(UnitTester $I) $I->assertSame(['my-audience'], $claims->get('aud')); $I->assertSame($token->getClaims() - ->get('exp'), $claims->get('exp')); + ->get('exp'), $claims->get('exp')); $I->assertSame('PH-JWT', $claims->get('jti')); $I->assertSame($token->getClaims() - ->get('iat'), $claims->get('iat')); + ->get('iat'), $claims->get('iat')); $I->assertSame('Phalcon JWT', $claims->get('iss')); $I->assertSame($token->getClaims() - ->get('nbf'), $claims->get('nbf')); + ->get('nbf'), $claims->get('nbf')); $I->assertSame('Mary had a little lamb', $claims->get('sub')); } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - no signature + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - no + * signature * * @param UnitTester $I * @@ -116,21 +117,21 @@ public function encryptionSecurityJWTTokenParserParseNoSignature(UnitTester $I) $I->assertSame(['my-audience'], $claims->get('aud')); $I->assertSame($token->getClaims() - ->get('exp'), $claims->get('exp')); + ->get('exp'), $claims->get('exp')); $I->assertSame('PH-JWT', $claims->get('jti')); $I->assertSame($token->getClaims() - ->get('iat'), $claims->get('iat')); + ->get('iat'), $claims->get('iat')); $I->assertSame('Phalcon JWT', $claims->get('iss')); $I->assertSame($token->getClaims() - ->get('nbf'), $claims->get('nbf')); + ->get('nbf'), $claims->get('nbf')); $I->assertSame('Mary had a little lamb', $claims->get('sub')); $I->assertEmpty($signature->getEncoded()); } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - aud not an - * array + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - aud + * not an array * * @param UnitTester $I * @@ -175,19 +176,19 @@ public function encryptionSecurityJWTTokenParserParseAudNotAnArray(UnitTester $I $I->assertSame(['my-audience'], $claims->get('aud')); $I->assertSame($token->getClaims() - ->get('exp'), $claims->get('exp')); + ->get('exp'), $claims->get('exp')); $I->assertSame('PH-JWT', $claims->get('jti')); $I->assertSame($token->getClaims() - ->get('iat'), $claims->get('iat')); + ->get('iat'), $claims->get('iat')); $I->assertSame('Phalcon JWT', $claims->get('iss')); $I->assertSame($token->getClaims() - ->get('nbf'), $claims->get('nbf')); + ->get('nbf'), $claims->get('nbf')); $I->assertSame('Mary had a little lamb', $claims->get('sub')); } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - exception - * claims not array + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - + * exception claims not array * * @param UnitTester $I * @@ -215,8 +216,8 @@ function () { } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - exception - * headers not array + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - + * exception headers not array * * @param UnitTester $I * @@ -247,8 +248,8 @@ function () { } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - exception no - * typ + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - + * exception no typ * * @param UnitTester $I * @@ -280,8 +281,8 @@ function () { } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - exception - * wrong JWT + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Parser :: parse() - + * exception wrong JWT * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Token/Signature/ConstructCest.php b/tests/unit/Encryption/Security/JWT/Token/Signature/ConstructCest.php index d7eab17a78d..8f3fbb14604 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Signature/ConstructCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Signature/ConstructCest.php @@ -22,7 +22,8 @@ class ConstructCest { /** - * Unit Tests Phalcon\Encryption\Security\JWT\Token\Signature :: __construct() + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Signature :: + * __construct() * * @param UnitTester $I * diff --git a/tests/unit/Encryption/Security/JWT/Token/Token/GetClaimsCest.php b/tests/unit/Encryption/Security/JWT/Token/Token/GetClaimsCest.php index 439b0fe0a31..32e6198cce3 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Token/GetClaimsCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Token/GetClaimsCest.php @@ -46,7 +46,9 @@ public function encryptionSecurityJWTTokenTokenGetClaims(UnitTester $I) $I->assertInstanceOf($expected, $actual); $expected = "valid-subject"; - $actual = $token->getClaims()->get('sub'); + $actual = $token->getClaims() + ->get('sub') + ; $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Encryption/Security/JWT/Token/Token/GetHeadersCest.php b/tests/unit/Encryption/Security/JWT/Token/Token/GetHeadersCest.php index 33ea4c65e3d..00b76df2a4c 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Token/GetHeadersCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Token/GetHeadersCest.php @@ -46,7 +46,9 @@ public function encryptionSecurityJWTTokenTokenGetHeaders(UnitTester $I) $I->assertInstanceOf($expected, $actual); $expected = "JWT"; - $actual = $token->getHeaders()->get('typ'); + $actual = $token->getHeaders() + ->get('typ') + ; $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Encryption/Security/JWT/Token/Token/GetSignatureCest.php b/tests/unit/Encryption/Security/JWT/Token/Token/GetSignatureCest.php index 23fe01005ad..6894aa94bed 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Token/GetSignatureCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Token/GetSignatureCest.php @@ -46,7 +46,9 @@ public function encryptionSecurityJWTTokenTokenGetSignature(UnitTester $I) $I->assertInstanceOf($expected, $actual); $expected = "signature-encoded"; - $actual = $token->getSignature()->getEncoded(); + $actual = $token->getSignature() + ->getEncoded() + ; $I->assertSame($expected, $actual); } } diff --git a/tests/unit/Encryption/Security/JWT/Token/Token/ValidateCest.php b/tests/unit/Encryption/Security/JWT/Token/Token/ValidateCest.php index e7b3997cb13..c5e749cd10a 100644 --- a/tests/unit/Encryption/Security/JWT/Token/Token/ValidateCest.php +++ b/tests/unit/Encryption/Security/JWT/Token/Token/ValidateCest.php @@ -14,15 +14,9 @@ use Phalcon\Encryption\Security\JWT\Builder; use Phalcon\Encryption\Security\JWT\Signer\Hmac; use Phalcon\Encryption\Security\JWT\Token\Enum; -use Phalcon\Encryption\Security\JWT\Token\Item; -use Phalcon\Encryption\Security\JWT\Token\Signature; -use Phalcon\Encryption\Security\JWT\Token\Token; use Phalcon\Encryption\Security\JWT\Validator; use UnitTester; -use function strtotime; -use function usleep; - class ValidateCest { /** @@ -54,7 +48,8 @@ public function encryptionSecurityJWTTokenTokenValidate(UnitTester $I) ->setNotBefore($notBefore) ->setSubject('Mary had a little lamb') ->setPassphrase($passphrase) - ->getToken(); + ->getToken() + ; $validator = new Validator($token, 10); diff --git a/tests/unit/Encryption/Security/JWT/Token/Token/VerifyCest.php b/tests/unit/Encryption/Security/JWT/Token/Token/VerifyCest.php new file mode 100644 index 00000000000..204cffb2877 --- /dev/null +++ b/tests/unit/Encryption/Security/JWT/Token/Token/VerifyCest.php @@ -0,0 +1,101 @@ + + * @since 2023-08-09 + */ + public function encryptionSecurityJWTTokenTokenVerify(UnitTester $I) + { + $I->wantToTest('Encryption\Security\JWT\Token\Token - verify()'); + + $signer = new Hmac(); + $builder = new Builder($signer); + $now = time(); + $expiry = $now + 3600; + $issued = $now - 10; + $notBefore = $now - 10; + $passphrase = '&vsJBETaizP3A3VX&TPMJUqi48fJEgN7'; + + $token = $builder + ->setAudience('my-audience') + ->setExpirationTime($expiry) + ->setIssuer('Phalcon JWT') + ->setIssuedAt($issued) + ->setId('PH-JWT') + ->setNotBefore($notBefore) + ->setSubject('Mary had a little lamb') + ->setPassphrase($passphrase) + ->getToken() + ; + + $actual = $token->verify($signer, $passphrase); + $I->assertTrue($actual); + } + + /** + * Unit Tests Phalcon\Encryption\Security\JWT\Token\Token :: verify() wrong algo + * + * @param UnitTester $I + * + * @author Phalcon Team + * @since 2023-08-09 + */ + public function encryptionSecurityJWTTokenTokenVerifyWrongAlgo(UnitTester $I) + { + $I->wantToTest('Encryption\Security\JWT\Token\Token - verify() wrong algo'); + + $signer = new Hmac(); + $builder = new Builder($signer); + $now = time(); + $expiry = $now + 3600; + $issued = $now - 10; + $notBefore = $now - 10; + $passphrase = '&vsJBETaizP3A3VX&TPMJUqi48fJEgN7'; + + $token = $builder + ->setAudience('my-audience') + ->setExpirationTime($expiry) + ->setIssuer('Phalcon JWT') + ->setIssuedAt($issued) + ->setId('PH-JWT') + ->setNotBefore($notBefore) + ->setSubject('Mary had a little lamb') + ->setPassphrase($passphrase) + ->getToken() + ; + + $signer = Stub::make( + Hmac::class, + [ + 'getAlgHeader' => 'xyz', + ] + ); + + $actual = $token->verify($signer, $passphrase); + $I->assertFalse($actual); + } +} diff --git a/tests/unit/Encryption/Security/JWT/Validator/SetTokenCest.php b/tests/unit/Encryption/Security/JWT/Validator/SetTokenCest.php index 0413d6a43bd..f297a7467d5 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/SetTokenCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/SetTokenCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Signer\Hmac; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateAudienceCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateAudienceCest.php index ba4f54695a6..8503269ffd2 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateAudienceCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateAudienceCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -26,7 +25,8 @@ class ValidateAudienceCest use JWTTrait; /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateAudience() + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateAudience() * * @param UnitTester $I * @@ -37,7 +37,7 @@ public function encryptionSecurityJWTValidatorValidateAudience(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateAudience()'); - $token = $this->newToken(); + $token = $this->newToken(); $validator = new Validator($token); $validator->validateAudience('unknown'); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateExpirationCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateExpirationCest.php index ace5a798311..050204685a1 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateExpirationCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateExpirationCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -26,7 +25,8 @@ class ValidateExpirationCest use JWTTrait; /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateExpiration() + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateExpiration() * * @param UnitTester $I * @@ -37,7 +37,7 @@ public function encryptionSecurityJWTValidatorValidateExpiration(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateExpiration()'); - $token = $this->newToken(); + $token = $this->newToken(); $timestamp = strtotime(("+2 days")); $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateIdCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateIdCest.php index 0c5bda0da25..bcff4694580 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateIdCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateIdCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -37,7 +36,7 @@ public function encryptionSecurityJWTValidatorValidateId(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateId()'); - $token = $this->newToken(); + $token = $this->newToken(); $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuedAtCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuedAtCest.php index 7e8507cc88c..dfbddb05cf7 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuedAtCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuedAtCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -26,7 +25,8 @@ class ValidateIssuedAtCest use JWTTrait; /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateIssuedAt() + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateIssuedAt() * * @param UnitTester $I * @@ -37,7 +37,7 @@ public function encryptionSecurityJWTValidatorValidateIssuedAt(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateIssuedAt()'); - $token = $this->newToken(); + $token = $this->newToken(); $timestamp = strtotime(("-1 day")); $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuerCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuerCest.php index e6f47d032ee..53b8f8f9c91 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuerCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateIssuerCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -37,7 +36,7 @@ public function encryptionSecurityJWTValidatorValidateIssuer(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateIssuer()'); - $token = $this->newToken(); + $token = $this->newToken(); $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateNotBeforeCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateNotBeforeCest.php index e7adc8e734e..7ec47fa9247 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateNotBeforeCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateNotBeforeCest.php @@ -11,7 +11,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; use UnitTester; @@ -26,7 +25,8 @@ class ValidateNotBeforeCest use JWTTrait; /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateNotBefore() + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateNotBefore() * * @param UnitTester $I * @@ -37,7 +37,7 @@ public function encryptionSecurityJWTValidatorValidateNotBefore(UnitTester $I) { $I->wantToTest('Encryption\Security\JWT\Validator - validateNotBefore()'); - $token = $this->newToken(); + $token = $this->newToken(); $timestamp = strtotime(("-2 days")); $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); diff --git a/tests/unit/Encryption/Security/JWT/Validator/ValidateSignatureCest.php b/tests/unit/Encryption/Security/JWT/Validator/ValidateSignatureCest.php index d8021c23ec7..f2c0f67a11a 100644 --- a/tests/unit/Encryption/Security/JWT/Validator/ValidateSignatureCest.php +++ b/tests/unit/Encryption/Security/JWT/Validator/ValidateSignatureCest.php @@ -12,7 +12,6 @@ namespace Phalcon\Tests\Unit\Encryption\Security\JWT\Validator; use Phalcon\Encryption\Security\JWT\Builder; -use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Signer\Hmac; use Phalcon\Encryption\Security\JWT\Validator; use Phalcon\Tests\Fixtures\Traits\JWTTrait; @@ -28,7 +27,8 @@ class ValidateSignatureCest use JWTTrait; /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateSignature() + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateSignature() * * @param UnitTester $I * @@ -55,7 +55,8 @@ public function encryptionSecurityJWTValidatorValidateNotBefore(UnitTester $I) ->setNotBefore($notBefore) ->setSubject('Mary had a little lamb') ->setPassphrase($passphrase) - ->getToken(); + ->getToken() + ; $validator = new Validator($token); $I->assertInstanceOf(Validator::class, $validator); @@ -67,7 +68,8 @@ public function encryptionSecurityJWTValidatorValidateNotBefore(UnitTester $I) } /** - * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: validateSignature() - exception + * Unit Tests Phalcon\Encryption\Security\JWT\Validator :: + * validateSignature() - exception * * @param UnitTester $I * @@ -78,7 +80,7 @@ public function encryptionSecurityJWTValidatorValidateNotBeforeException(UnitTes { $I->wantToTest('Encryption\Security\JWT\Validator - validateSignature()'); - $token = $this->newToken(); + $token = $this->newToken(); $signer = new Hmac(); $passphrase = '123456'; $validator = new Validator($token); diff --git a/tests/unit/Encryption/Security/Random/UuidCest.php b/tests/unit/Encryption/Security/Random/UuidCest.php index 939d14ed0fa..1bb13cf1b42 100644 --- a/tests/unit/Encryption/Security/Random/UuidCest.php +++ b/tests/unit/Encryption/Security/Random/UuidCest.php @@ -48,7 +48,8 @@ public function encryptionSecurityRandomUuid(UnitTester $I) } /** - * Tests Phalcon\Encryption\Security\Random :: uuid() produces different results + * Tests Phalcon\Encryption\Security\Random :: uuid() produces different + * results * * @param UnitTester $I * From dbc91026e556f799be63b49b92db284d8a3db117 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 18:24:15 -0400 Subject: [PATCH 16/29] phpcs --- .../integration/Filter/Validation/Validator/Url/ValidateCest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php index 8028330b329..76d5b092ac4 100644 --- a/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Url/ValidateCest.php @@ -20,7 +20,6 @@ use Phalcon\Filter\Validation\Validator\Url; use Phalcon\Messages\Message; use Phalcon\Messages\Messages; - use stdClass; use const FILTER_FLAG_PATH_REQUIRED; From b77710eaf9b6423993424ad1fcd606f58a0ee30f Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 18:40:29 -0400 Subject: [PATCH 17/29] phpcs again --- .../Filter/Validation/Validator/Digit/ValidateCest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php index 4fbef5b6595..3fbb52e03ea 100644 --- a/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Digit/ValidateCest.php @@ -175,8 +175,10 @@ public function filterValidationValidatorDigitMultipleField(IntegrationTester $I /** * @dataProvider shouldValidateIntOrStringOfDigitsProvider */ - public function filterValidationValidatorDigitShouldValidateIntOrStringOfDigits(IntegrationTester $I, Example $example) - { + public function filterValidationValidatorDigitShouldValidateIntOrStringOfDigits( + IntegrationTester $I, + Example $example + ) { $digit = $example[0]; $validation = new Validation(); From e7f9d9c388c9ef9c4cab2aaf3ac9831fee0ab64e Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 9 Aug 2023 18:43:09 -0400 Subject: [PATCH 18/29] updating changelog --- CHANGELOG-5.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 87d43a71684..5cb6b189111 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -6,11 +6,15 @@ - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) +### Added + +- Added `Phalcon\Encryption\Security\JWT\Builder::addHeader()` to allow adding custom headers [#16396](https://github.com/phalcon/cphalcon/issues/16396) + ## [5.2.3](https://github.com/phalcon/cphalcon/releases/tag/v5.2.3) (2023-07-26) ### Fixed -- + - Tried to reproduce the behavior described in #16244 but had no success. [#16244](https://github.com/phalcon/cphalcon/issues/16244) - Extended `Phalcon\Di\Injectable` from `stdClass` to remove the deprecation warning (dynamic properties) for PHP 8.2 [#16308](https://github.com/phalcon/cphalcon/issues/16308) - Corrected the return type of `Phalcon\Mvc\View::getVar()` so that stubs can be accurate. [#16276](https://github.com/phalcon/cphalcon/issues/16276) From 9feaefb944faed5a3e4ca0508a624675e3ee6626 Mon Sep 17 00:00:00 2001 From: Rudi Servo Date: Thu, 10 Aug 2023 15:57:09 +0000 Subject: [PATCH 19/29] Fix #16343, DynamicUpdate is now enabled system wide --- CHANGELOG-5.0.md | 1 + config.json | 4 + phalcon/Mvc/Model.zep | 2 +- phalcon/Mvc/Model/Manager.zep | 8 + .../models/CustomersDymanicUpdate.php | 38 +++ .../database/Mvc/Model/DynamicUpdateCest.php | 219 ++++++++++++++++++ tests/unit/Mvc/GlobalsCest.php | 4 + 7 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 tests/_data/fixtures/models/CustomersDymanicUpdate.php create mode 100644 tests/database/Mvc/Model/DynamicUpdateCest.php diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index f65598c369b..375605e2c40 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -16,6 +16,7 @@ ### Fixed - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) +- Set Dynamic Update by default system wide [#16343](https://github.com/phalcon/cphalcon/issues/16343) ## [5.2.3](https://github.com/phalcon/cphalcon/releases/tag/v5.2.3) (2023-07-26) diff --git a/config.json b/config.json index 68464ed9b0d..a8939dea647 100644 --- a/config.json +++ b/config.json @@ -149,6 +149,10 @@ "type": "bool", "default": true }, + "orm.dynamic_update": { + "type": "bool", + "default": true + }, "warning.enable": { "type": "bool", "default": true diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index 7a9c65e2d95..fa7096ebbad 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -3973,7 +3973,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, let columnMap = null; } - if useDynamicUpdate && typeof snapshot !== "array" { + if likely useDynamicUpdate && typeof snapshot === "array" { for field in nonPrimary { let changed = false; if typeof columnMap === "array" { diff --git a/phalcon/Mvc/Model/Manager.zep b/phalcon/Mvc/Model/Manager.zep index 6bfb969a177..99cee971aef 100644 --- a/phalcon/Mvc/Model/Manager.zep +++ b/phalcon/Mvc/Model/Manager.zep @@ -1848,6 +1848,10 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI { var isKeeping; + if globals_get("orm.dynamic_update") { + return true; + } + if !fetch isKeeping, this->keepSnapshots[get_class_lower(model)] { return false; } @@ -1866,6 +1870,10 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI { var isUsing; + if globals_get("orm.dynamic_update") { + return true; + } + if !fetch isUsing, this->dynamicUpdate[get_class_lower(model)] { return false; } diff --git a/tests/_data/fixtures/models/CustomersDymanicUpdate.php b/tests/_data/fixtures/models/CustomersDymanicUpdate.php new file mode 100644 index 00000000000..12106c1762d --- /dev/null +++ b/tests/_data/fixtures/models/CustomersDymanicUpdate.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the + * LICENSE.txt file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Tests\Models; + +use Phalcon\Mvc\Model; + +/** + * Class CustomersKeepSnapshots + * + * @property int $cst_id; + * @property int $cst_status_flag; + * @property string $cst_name_last; + * @property string $cst_name_first; + */ +class CustomersDymanicUpdate extends Model +{ + public $cst_id; + public $cst_status_flag; + public $cst_name_last; + public $cst_name_first; + + public function initialize() + { + $this->useDynamicUpdate(true); + $this->setSource('co_customers'); + } +} diff --git a/tests/database/Mvc/Model/DynamicUpdateCest.php b/tests/database/Mvc/Model/DynamicUpdateCest.php new file mode 100644 index 00000000000..aa108d6cfc2 --- /dev/null +++ b/tests/database/Mvc/Model/DynamicUpdateCest.php @@ -0,0 +1,219 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Tests\Integration\Mvc\Model; + +use DatabaseTester; +use Phalcon\Events\Event; +use Phalcon\Events\Manager; +use Phalcon\Support\Collection; +use Phalcon\Tests\Fixtures\Migrations\CustomersMigration; +use Phalcon\Tests\Fixtures\Traits\DiTrait; +use Phalcon\Tests\Models\Customers; +use Phalcon\Tests\Models\CustomersDymanicUpdate; + +class DynamicUpdateCest +{ + use DiTrait; + + public function _before(DatabaseTester $I) + { + $this->setNewFactoryDefault(); + $this->setDatabase($I); + } + + public function _after(DatabaseTester $I) + { + $this->container['db']->close(); + } + + /** + * Tests Phalcon\Mvc\Model :: save() With DynamicUpdate Enabled + * + * @author Phalcon Team + * @since 2023-08-11 + * + * @issue https://github.com/phalcon/cphalcon/issues/16343 + * + * @group mysql + * @group pgsql + * @group sqlite + */ + public function enableDynamicUpdate(DatabaseTester $I) + { + $I->wantToTest('Mvc\Model - DynamicUpdate System Wide Enabled'); + + $connection = $I->getConnection(); + + $customersMigration = new CustomersMigration($connection); + $customersMigration->insert(90, 1, null, null); + + /** + * Check system wide Dynamic update + */ + $actual = ini_get('phalcon.orm.dynamic_update'); + $I->assertEquals("1", $actual); + + $collection = new Collection(); + $connection = $this->container->get('db'); + $manager = new Manager(); + $modelsManager = $this->container->get('modelsManager'); + $manager->attach('db:beforeQuery', function (Event $event) use ($connection, $collection) { + $key = (string) $collection->count(); + $collection->set($key, $connection->getSQLVariables()); + }); + + $connection->setEventsManager($manager); + + /** + * New model + * @var Customer + */ + $customer = Customers::findFirst(['cst_id=:id:', 'bind' => ['id' => 90]]); + $customer->cst_name_first = 'enableDynamicUpdate'; + + $actual = $customer->save(); + $I->assertTrue($actual); + + $actual = $modelsManager->isUsingDynamicUpdate($customer); + $I->assertTrue($actual); + + $collection->clear(); + + $customer->cst_name_last = 'cst_test_lastName'; + + $actual = $customer->save(); + $I->assertTrue($actual); + + $expected = 2; + $actual = count($collection->get('0')); + $I->assertEquals($expected, $actual); + } + + /** + * Tests Phalcon\Mvc\Model :: save() with DynamicUpdate Disabled + * + * @author Phalcon Team + * @since 2023-08-11 + * + * @group mysql + * @group pgsql + * @group sqlite + */ + public function disableDynamicUpdate(DatabaseTester $I) + { + $I->wantToTest('Mvc\Model - DynamicUpdate Systeam Wide Disabled'); + $collection = new Collection(); + + $connection = $this->container->get('db'); + $manager = new Manager(); + $modelsManager = $this->container->get('modelsManager'); + $manager->attach('db:beforeQuery', function (Event $event) use ($connection, $collection) { + $key = (string) $collection->count(); + $collection->set($key, $connection->getSQLVariables()); + }); + + $connection->setEventsManager($manager); + + /** + * Disable system wide dynamic update + */ + ini_set('phalcon.orm.dynamic_update', "0"); + + /** + * Check system wide Dynamic update + */ + $actual = ini_get('phalcon.orm.dynamic_update'); + + $I->assertEquals("0", $actual); + + /** + * New model + * @var Customer + */ + $customer = Customers::findFirst(['cst_id=:id:', 'bind' => ['id' => 90]]); + $customer->cst_name_first = 'disableDynamicUpdate'; + $actual = $customer->save(); + + $I->assertTrue($actual); + $actual = $modelsManager->isUsingDynamicUpdate($customer); + $I->assertFalse($actual); + + $collection->clear(); + + $customer->cst_name_last = 'cst_test_lastName'; + + $actual = $customer->save(); + $I->assertTrue($actual); + + $expected = 4; + $actual = count($collection->get('0')); + $I->assertEquals($expected, $actual); + } + + /** + * Tests Phalcon\Mvc\Model :: save() with DynamicUpdate Disabled Cherry pick + * + * @author Phalcon Team + * @since 2023-08-11 + * + * @group mysql + * @group pgsql + * @group sqlite + */ + public function disabledCherryPickDynamicUpdate(DatabaseTester $I) + { + $I->wantToTest('Mvc\Model - DynamicUpdate Systeam Wide Disabled Cherry pick'); + + $collection = new Collection(); + $connection = $this->container->get('db'); + $manager = new Manager(); + $modelsManager = $this->container->get('modelsManager'); + $manager->attach('db:beforeQuery', function (Event $event) use ($connection, $collection) { + $key = (string) $collection->count(); + $collection->set($key, $connection->getSQLVariables()); + }); + + $connection->setEventsManager($manager); + + /** + * Disable system wide dynamic update + */ + ini_set('phalcon.orm.dynamic_update', "0"); + + /** + * Check system wide Dynamic update + */ + $actual = ini_get('phalcon.orm.dynamic_update'); + $I->assertEquals("0", $actual); + + /** + * New model + * @var CustomersDymanicUpdate + */ + $customer = CustomersDymanicUpdate::findFirst(['cst_id=:id:', 'bind' => ['id' => 90]]); + + $actual = $modelsManager->isUsingDynamicUpdate($customer); + $I->assertTrue($actual); + + $collection->clear(); + + $customer->cst_name_first = 'disabledCherryPickDynamicUpdate'; + $actual = $customer->save(); + $I->assertTrue($actual); + + $expected = 2; + $actual = count($collection->get('0')); + $I->assertEquals($expected, $actual); + } +} diff --git a/tests/unit/Mvc/GlobalsCest.php b/tests/unit/Mvc/GlobalsCest.php index 6b9269b987e..26192120ed0 100644 --- a/tests/unit/Mvc/GlobalsCest.php +++ b/tests/unit/Mvc/GlobalsCest.php @@ -117,6 +117,10 @@ private function getExamples(): array 'setting' => 'phalcon.orm.virtual_foreign_keys', 'value' => '1', ], + [ + 'setting' => 'phalcon.orm.dynamic_update', + 'value' => '1', + ], ]; } } From 05589eca37bc0ddc8f195cb2508b7070af14e2dc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 15:58:10 +0000 Subject: [PATCH 20/29] Remove set of 'application' service This causes memory leak --- phalcon/Mvc/Micro.zep | 7 ------- 1 file changed, 7 deletions(-) diff --git a/phalcon/Mvc/Micro.zep b/phalcon/Mvc/Micro.zep index 721da8801ea..e1de0685f33 100644 --- a/phalcon/Mvc/Micro.zep +++ b/phalcon/Mvc/Micro.zep @@ -1142,13 +1142,6 @@ class Micro extends Injectable implements ArrayAccess, EventsAwareInterface */ public function setDI( container) -> void { - /** - * We automatically set ourselves as application service - */ - if !container->has("application") { - container->set("application", this); - } - let this->container = container; } From 3fc5700870f6b51328e3dc4d8114c1bab785c8f9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 16:12:07 +0000 Subject: [PATCH 21/29] Remove redundant tests --- tests/integration/Mvc/Micro/HasServiceCest.php | 8 -------- tests/integration/Mvc/Micro/OffsetExistsCest.php | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/tests/integration/Mvc/Micro/HasServiceCest.php b/tests/integration/Mvc/Micro/HasServiceCest.php index d8db383dc91..54bd06cf5fc 100644 --- a/tests/integration/Mvc/Micro/HasServiceCest.php +++ b/tests/integration/Mvc/Micro/HasServiceCest.php @@ -33,9 +33,7 @@ public function mvcMicroHasService(IntegrationTester $I) $I->wantToTest('Mvc\Micro - hasService()'); $micro = new Micro(); - $di = new Di(); - $micro->setDi($di); @@ -43,10 +41,6 @@ public function mvcMicroHasService(IntegrationTester $I) $micro->hasService('fake') ); - $I->assertTrue( - $micro->hasService('application') - ); - $I->assertFalse( $micro->hasService('escaper') ); @@ -57,7 +51,6 @@ public function mvcMicroHasService(IntegrationTester $I) $escaper = new Escaper(); - $micro->setService('escaper', $escaper); $I->assertTrue( @@ -75,7 +68,6 @@ public function mvcMicroHasService(IntegrationTester $I) $router = new Router(); - $di->set('router', $router); $I->assertTrue( diff --git a/tests/integration/Mvc/Micro/OffsetExistsCest.php b/tests/integration/Mvc/Micro/OffsetExistsCest.php index cee1d0a947f..fcca5ef9e92 100644 --- a/tests/integration/Mvc/Micro/OffsetExistsCest.php +++ b/tests/integration/Mvc/Micro/OffsetExistsCest.php @@ -33,9 +33,7 @@ public function mvcMicroOffsetExists(IntegrationTester $I) $I->wantToTest('Mvc\Micro - offsetExists()'); $micro = new Micro(); - $di = new Di(); - $micro->setDi($di); @@ -43,10 +41,6 @@ public function mvcMicroOffsetExists(IntegrationTester $I) isset($micro['fake']) ); - $I->assertTrue( - isset($micro['application']) - ); - $I->assertFalse( isset($micro['escaper']) ); @@ -57,25 +51,20 @@ public function mvcMicroOffsetExists(IntegrationTester $I) $escaper = new Escaper(); - $micro->setService('escaper', $escaper); $I->assertTrue( isset($micro['escaper']) ); - $dispatcher = new Dispatcher(); - $micro['dispatcher'] = $dispatcher; $I->assertTrue( isset($micro['dispatcher']) ); - $router = new Router(); - $di->set('router', $router); $I->assertTrue( From cf60c93b1c4987966dc297f2ccb892f4fde93969 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 16:53:49 +0000 Subject: [PATCH 22/29] Fix typo --- CHANGELOG-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index a3ddaa7ac0f..9aeb46e6825 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -16,7 +16,7 @@ ### Fixed - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) -- Set Dynamic Update by default system wide [#16343](https://github.com/phalcon/cphalcon/issues/16343) +- Set Dynamic Update by default system-wide [#16343](https://github.com/phalcon/cphalcon/issues/16343) ### Added From c2ddce67cc78490e32b10aa1e9b444c52384aaa3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 16:57:06 +0000 Subject: [PATCH 23/29] Update changelog --- CHANGELOG-5.0.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 9aeb46e6825..11eb42ebdc7 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -3,24 +3,24 @@ ## [5.2.4](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) ### Added -- Added `Phalcon\Mvc\Model::appendMessagedFrom` for code consistency and to add messages from another another model. [#16391](https://github.com/phalcon/cphalcon/issues/16391) + +- Added `Phalcon\Mvc\Model::appendMessagedFrom` for code consistency and to add messages from another model [#16391](https://github.com/phalcon/cphalcon/issues/16391) - Added `Phalcon\Autoload\Loader::isRegistered` for debugging purposes [#16391](https://github.com/phalcon/cphalcon/issues/16391) - Added `Phalcon\Mvc\Model\Metadata::initializeMetadata` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) - Added `Phalcon\Mvc\Model\Metadata::getMetaDataUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) - Added `Phalcon\Mvc\Model\Metadata::getColumnMapUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) +- Added `Phalcon\Encryption\Security\JWT\Builder::addHeader()` to allow adding custom headers [#16396](https://github.com/phalcon/cphalcon/issues/16396) ### Changed -- Refactored `Phalcon\Mvc\Model::doLowUpdate` and `Phalcon\Mvc\Model::postSaveRelatedRecords` for better code logic and a clearer seperation of behaviour although it lead to partially repeated code.[#16391](https://github.com/phalcon/cphalcon/issues/16391) + +- Refactored `Phalcon\Mvc\Model::doLowUpdate` and `Phalcon\Mvc\Model::postSaveRelatedRecords` for better code logic and a clearer separation of behaviour, although it lead to partially repeated code. [#16391](https://github.com/phalcon/cphalcon/issues/16391) - Cleaned `Phalcon\Mvc\Model\Metadata::initialize` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) ### Fixed - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) - Set Dynamic Update by default system-wide [#16343](https://github.com/phalcon/cphalcon/issues/16343) - -### Added - -- Added `Phalcon\Encryption\Security\JWT\Builder::addHeader()` to allow adding custom headers [#16396](https://github.com/phalcon/cphalcon/issues/16396) +- Fixed memory leak in Micro application [#16404](https://github.com/phalcon/cphalcon/pull/16404) ## [5.2.3](https://github.com/phalcon/cphalcon/releases/tag/v5.2.3) (2023-07-26) From 3532098f4454c8c6bdfaac449c428d8e6e101324 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 17:35:34 +0000 Subject: [PATCH 24/29] Change next version to `5.3.0` --- CHANGELOG-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 11eb42ebdc7..d0e3cfa3665 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,6 +1,6 @@ # Changelog -## [5.2.4](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) +## [5.3.0](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) ### Added From 60d0829c8d3425fc949040201bbd55c34ebc6ec5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 15 Aug 2023 17:36:01 +0000 Subject: [PATCH 25/29] Change next version to `5.3.0` --- CHANGELOG-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index d0e3cfa3665..5e2609368b7 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,6 +1,6 @@ # Changelog -## [5.3.0](https://github.com/phalcon/cphalcon/releases/tag/v5.2.4) (xxxx-xx-xx) +## [5.3.0](https://github.com/phalcon/cphalcon/releases/tag/v5.3.0) (xxxx-xx-xx) ### Added From ad912e657b1f04bd8bfd002cbf0320b9b06d5c8c Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Tue, 15 Aug 2023 14:24:34 -0400 Subject: [PATCH 26/29] prep for 5.3.0 --- .github/workflows/main.yml | 2 +- config.json | 2 +- package.xml | 32 ++++++++++++++++++++------------ phalcon/Support/Version.zep | 2 +- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b747deeaaf9..bd76262af85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ on: env: # All versions should be declared here - PHALCON_VERSION: 5.2.3 + PHALCON_VERSION: 5.3.0 ZEPHIR_PARSER_VERSION: 1.5.3 ZEPHIR_VERSION: 0.17.0 diff --git a/config.json b/config.json index a8939dea647..9eb64872a81 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "name": "phalcon", "description": "Phalcon is a full stack PHP framework, delivered as a PHP extension, offering lower resource consumption and high performance.", "author": "Phalcon Team and contributors", - "version": "5.2.3", + "version": "5.3.0", "verbose": false, "stubs": { "path": "ide\/%version%\/%namespace%\/", diff --git a/package.xml b/package.xml index d1f41d208e5..318bf02ba63 100644 --- a/package.xml +++ b/package.xml @@ -22,11 +22,11 @@ nikos@phalcon.io yes - 2023-07-26 + 2023-08-15 - 5.2.3 - 5.2.3 + 5.3.0 + 5.3.0 stable @@ -36,17 +36,25 @@ Full changelog can be found at: https://github.com/phalcon/cphalcon/blob/master/CHANGELOG-5.0.md + ### Added + + - Added `Phalcon\Mvc\Model::appendMessagedFrom` for code consistency and to add messages from another model [#16391](https://github.com/phalcon/cphalcon/issues/16391) + - Added `Phalcon\Autoload\Loader::isRegistered` for debugging purposes [#16391](https://github.com/phalcon/cphalcon/issues/16391) + - Added `Phalcon\Mvc\Model\Metadata::initializeMetadata` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) + - Added `Phalcon\Mvc\Model\Metadata::getMetaDataUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) + - Added `Phalcon\Mvc\Model\Metadata::getColumnMapUniqueKey` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) + - Added `Phalcon\Encryption\Security\JWT\Builder::addHeader()` to allow adding custom headers [#16396](https://github.com/phalcon/cphalcon/issues/16396) + + ### Changed + + - Refactored `Phalcon\Mvc\Model::doLowUpdate` and `Phalcon\Mvc\Model::postSaveRelatedRecords` for better code logic and a clearer separation of behaviour, although it lead to partially repeated code. [#16391](https://github.com/phalcon/cphalcon/issues/16391) + - Cleaned `Phalcon\Mvc\Model\Metadata::initialize` [#16393] (https://github.com/phalcon/cphalcon/issues/16393) + ### Fixed - - Tried to reproduce the behavior described in #16244 but had no success. [#16244](https://github.com/phalcon/cphalcon/issues/16244) - - Extended `Phalcon\Di\Injectable` from `stdClass` to remove the deprecation warning (dynamic properties) for PHP 8.2 [#16308](https://github.com/phalcon/cphalcon/issues/16308) - - Corrected the return type of `Phalcon\Mvc\View::getVar()` so that stubs can be accurate. [#16276](https://github.com/phalcon/cphalcon/issues/16276) - - Changed all the `encode`/`decode` methods for JSON to use the `Phalcon\Support\Helper\Json\*` classes. [#15608](https://github.com/phalcon/cphalcon/issues/15608) - - Changed the `Phalcon\Support\Helper\Json\*` classes to clear up `json_last_error()` before doing any conversions. [#15608](https://github.com/phalcon/cphalcon/issues/15608) - - Fixed `Phalcon\Http\Request::getJsonRawBody` to protect from empty body [#16373](https://github.com/phalcon/cphalcon/issues/16373) - ### Added - - Added `getAdapter()` in `Phalcon\Mvc\Model\Metadata` to retrieve the internal cache adapter if necessary. [#16244](https://github.com/phalcon/cphalcon/issues/16244) - - Added `Phalcon\Storage\Adapter\Weak` implemented with WeakReference has a cache/retrieval solution for objects not yet collected by the Garbage Collection. [#16372](https://github.com/phalcon/cphalcon/issues/16372) + - Parse multipart/form-data from PUT request [#16271](https://github.com/phalcon/cphalcon/issues/16271) + - Set Dynamic Update by default system-wide [#16343](https://github.com/phalcon/cphalcon/issues/16343) + - Fixed memory leak in Micro application [#16404](https://github.com/phalcon/cphalcon/pull/16404) diff --git a/phalcon/Support/Version.zep b/phalcon/Support/Version.zep index 0c965964467..fb1d4e71b61 100644 --- a/phalcon/Support/Version.zep +++ b/phalcon/Support/Version.zep @@ -77,7 +77,7 @@ class Version */ protected function getVersion() -> array { - return [5, 2, 3, 4, 0]; + return [5, 3, 0, 4, 0]; } /** From 8f5db8eba9d311963db34469641cf476297458f7 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Tue, 15 Aug 2023 14:24:44 -0400 Subject: [PATCH 27/29] refreshing ext --- ext/kernel/concat.c | 69 - ext/kernel/concat.h | 6 - ext/phalcon.c | 2 + ext/phalcon/acl/adapter/memory.zep.c | 102 +- .../annotations/adapter/abstractadapter.zep.c | 12 +- ext/phalcon/annotations/adapter/apcu.zep.c | 4 +- ext/phalcon/annotations/adapter/stream.zep.c | 10 +- ext/phalcon/annotations/annotation.zep.c | 8 +- .../annotations/annotationsfactory.zep.c | 2 +- ext/phalcon/annotations/collection.zep.c | 6 +- ext/phalcon/annotations/reader.zep.c | 26 +- ext/phalcon/annotations/reflection.zep.c | 14 +- .../application/abstractapplication.zep.c | 2 +- ext/phalcon/assets/asset.zep.c | 20 +- ext/phalcon/assets/collection.zep.c | 18 +- ext/phalcon/assets/inline.zep.c | 2 +- ext/phalcon/assets/manager.zep.c | 60 +- ext/phalcon/autoload/loader.zep.c | 98 +- ext/phalcon/autoload/loader.zep.h | 5 + ext/phalcon/cache/cachefactory.zep.c | 2 +- ext/phalcon/cli/console.zep.c | 12 +- ext/phalcon/cli/dispatcher.zep.c | 2 +- ext/phalcon/cli/router.zep.c | 6 +- ext/phalcon/cli/router/route.zep.c | 2 +- ext/phalcon/config/adapter/grouped.zep.c | 20 +- ext/phalcon/config/adapter/ini.zep.c | 6 +- ext/phalcon/config/adapter/json.zep.c | 2 +- ext/phalcon/config/adapter/yaml.zep.c | 6 +- ext/phalcon/config/configfactory.zep.c | 8 +- ext/phalcon/datamapper/pdo/connection.zep.c | 4 +- .../pdo/connection/abstractconnection.zep.c | 2 +- .../datamapper/pdo/connection/decorated.zep.c | 2 +- .../datamapper/pdo/connectionlocator.zep.c | 4 +- .../datamapper/pdo/profiler/profiler.zep.c | 8 +- .../datamapper/query/abstractconditions.zep.c | 2 +- ext/phalcon/datamapper/query/insert.zep.c | 2 +- .../datamapper/query/queryfactory.zep.c | 6 +- ext/phalcon/datamapper/query/select.zep.c | 14 +- ext/phalcon/datamapper/query/update.zep.c | 2 +- ext/phalcon/db/adapter/abstractadapter.zep.c | 14 +- ext/phalcon/db/adapter/pdo/abstractpdo.zep.c | 10 +- ext/phalcon/db/adapter/pdo/mysql.zep.c | 12 +- ext/phalcon/db/adapter/pdo/postgresql.zep.c | 18 +- ext/phalcon/db/adapter/pdo/sqlite.zep.c | 22 +- ext/phalcon/db/adapter/pdofactory.zep.c | 2 +- ext/phalcon/db/dialect.zep.c | 108 +- ext/phalcon/db/dialect/mysql.zep.c | 72 +- ext/phalcon/db/dialect/postgresql.zep.c | 40 +- ext/phalcon/db/dialect/sqlite.zep.c | 36 +- ext/phalcon/db/profiler.zep.c | 12 +- ext/phalcon/di/di.zep.c | 22 +- ext/phalcon/di/factorydefault.zep.c | 42 +- ext/phalcon/di/factorydefault/cli.zep.c | 26 +- ext/phalcon/di/service.zep.c | 4 +- ext/phalcon/di/service/builder.zep.c | 48 +- .../dispatcher/abstractdispatcher.zep.c | 8 +- ext/phalcon/encryption/crypt.zep.c | 78 +- .../encryption/crypt/padding/ansi.zep.c | 8 +- .../encryption/crypt/padding/iso10126.zep.c | 8 +- .../encryption/crypt/padding/isoiek.zep.c | 12 +- .../encryption/crypt/padding/pkcs7.zep.c | 8 +- .../encryption/crypt/padding/space.zep.c | 6 +- .../encryption/crypt/padding/zero.zep.c | 8 +- ext/phalcon/encryption/crypt/padfactory.zep.c | 2 +- ext/phalcon/encryption/security.zep.c | 30 +- .../encryption/security/jwt/builder.zep.c | 82 +- .../encryption/security/jwt/builder.zep.h | 7 + .../encryption/security/jwt/signer/hmac.zep.c | 6 +- .../security/jwt/token/parser.zep.c | 24 +- .../encryption/security/jwt/token/token.zep.c | 12 +- .../encryption/security/jwt/validator.zep.c | 48 +- ext/phalcon/encryption/security/random.zep.c | 18 +- ext/phalcon/events/event.zep.c | 2 +- ext/phalcon/events/manager.zep.c | 16 +- ext/phalcon/filter/filter.zep.c | 32 +- ext/phalcon/filter/filterfactory.zep.c | 2 +- ext/phalcon/filter/sanitize/absint.zep.c | 4 +- ext/phalcon/filter/sanitize/alnum.zep.c | 2 +- ext/phalcon/filter/sanitize/alpha.zep.c | 2 +- ext/phalcon/filter/sanitize/email.zep.c | 2 +- ext/phalcon/filter/sanitize/floatval.zep.c | 2 +- ext/phalcon/filter/sanitize/intval.zep.c | 2 +- ext/phalcon/filter/sanitize/lower.zep.c | 2 +- ext/phalcon/filter/sanitize/lowerfirst.zep.c | 2 +- ext/phalcon/filter/sanitize/regex.zep.c | 2 +- ext/phalcon/filter/sanitize/special.zep.c | 2 +- ext/phalcon/filter/sanitize/specialfull.zep.c | 2 +- ext/phalcon/filter/sanitize/stringval.zep.c | 2 +- .../filter/sanitize/stringvallegacy.zep.c | 2 +- ext/phalcon/filter/sanitize/striptags.zep.c | 2 +- ext/phalcon/filter/sanitize/upper.zep.c | 2 +- ext/phalcon/filter/sanitize/upperwords.zep.c | 4 +- ext/phalcon/filter/sanitize/url.zep.c | 2 +- ext/phalcon/filter/validation.zep.c | 8 +- .../abstractvalidatorcomposite.zep.c | 2 +- .../filter/validation/validator/alnum.zep.c | 2 +- .../validation/validator/callback.zep.c | 2 +- .../validation/validator/confirmation.zep.c | 4 +- .../validation/validator/creditcard.zep.c | 10 +- .../filter/validation/validator/date.zep.c | 2 +- .../filter/validation/validator/digit.zep.c | 2 +- .../filter/validation/validator/email.zep.c | 2 +- .../validation/validator/exclusionin.zep.c | 2 +- .../filter/validation/validator/file.zep.c | 118 +- .../validation/validator/file/mimetype.zep.c | 6 +- .../validator/file/resolution/equal.zep.c | 2 +- .../validator/file/resolution/max.zep.c | 2 +- .../validator/file/resolution/min.zep.c | 2 +- .../validation/validator/inclusionin.zep.c | 2 +- .../filter/validation/validator/ip.zep.c | 2 +- .../validation/validator/stringlength.zep.c | 16 +- .../validator/stringlength/max.zep.c | 2 +- .../validator/stringlength/min.zep.c | 2 +- .../validation/validator/uniqueness.zep.c | 4 +- .../filter/validation/validator/url.zep.c | 4 +- ext/phalcon/flash/abstractflash.zep.c | 14 +- ext/phalcon/forms/form.zep.c | 24 +- ext/phalcon/forms/manager.zep.c | 4 +- ext/phalcon/html/attributes.zep.c | 4 +- ext/phalcon/html/breadcrumbs.zep.c | 2 +- ext/phalcon/html/escaper.zep.c | 24 +- ext/phalcon/html/helper/input/checkbox.zep.c | 4 +- ext/phalcon/html/helper/input/select.zep.c | 2 +- ext/phalcon/html/helper/meta.zep.c | 6 +- ext/phalcon/html/helper/title.zep.c | 4 +- ext/phalcon/html/link/abstractlink.zep.c | 4 +- .../html/link/abstractlinkprovider.zep.c | 10 +- ext/phalcon/http/cookie.zep.c | 30 +- ext/phalcon/http/request.zep.c | 1007 +++- ext/phalcon/http/request.zep.h | 5 + ext/phalcon/http/request/file.zep.c | 20 +- ext/phalcon/http/response.zep.c | 24 +- ext/phalcon/http/response/cookies.zep.c | 2 +- ext/phalcon/http/response/headers.zep.c | 14 +- .../image/adapter/abstractadapter.zep.c | 22 +- ext/phalcon/image/adapter/gd.zep.c | 238 +- ext/phalcon/image/adapter/imagick.zep.c | 76 +- ext/phalcon/image/imagefactory.zep.c | 6 +- ext/phalcon/logger/abstractlogger.zep.c | 8 +- .../logger/adapter/abstractadapter.zep.c | 8 +- ext/phalcon/logger/adapter/stream.zep.c | 8 +- ext/phalcon/logger/adapter/syslog.zep.c | 12 +- ext/phalcon/logger/loggerfactory.zep.c | 2 +- ext/phalcon/messages/messages.zep.c | 2 +- ext/phalcon/mvc/application.zep.c | 2 +- ext/phalcon/mvc/dispatcher.zep.c | 4 +- ext/phalcon/mvc/micro.zep.c | 53 +- ext/phalcon/mvc/micro/lazyloader.zep.c | 2 +- ext/phalcon/mvc/model.zep.c | 4575 +++++++++-------- ext/phalcon/mvc/model.zep.h | 7 + .../mvc/model/behavior/timestampable.zep.c | 4 +- ext/phalcon/mvc/model/binder.zep.c | 14 +- ext/phalcon/mvc/model/criteria.zep.c | 12 +- ext/phalcon/mvc/model/manager.zep.c | 72 +- ext/phalcon/mvc/model/metadata.zep.c | 406 +- ext/phalcon/mvc/model/metadata.zep.h | 32 +- .../model/metadata/strategy/annotations.zep.c | 8 +- .../metadata/strategy/introspection.zep.c | 4 +- ext/phalcon/mvc/model/metadata/stream.zep.c | 4 +- ext/phalcon/mvc/model/metadatainterface.zep.h | 6 +- ext/phalcon/mvc/model/query.zep.c | 312 +- ext/phalcon/mvc/model/query/builder.zep.c | 86 +- ext/phalcon/mvc/model/resultset.zep.c | 24 +- ext/phalcon/mvc/model/resultset/complex.zep.c | 4 +- ext/phalcon/mvc/model/resultset/simple.zep.c | 16 +- ext/phalcon/mvc/model/row.zep.c | 2 +- ext/phalcon/mvc/model/transaction.zep.c | 4 +- .../mvc/model/transaction/manager.zep.c | 6 +- ext/phalcon/mvc/router.zep.c | 16 +- ext/phalcon/mvc/router/annotations.zep.c | 10 +- ext/phalcon/mvc/router/group.zep.c | 4 +- ext/phalcon/mvc/router/route.zep.c | 2 +- ext/phalcon/mvc/url.zep.c | 6 +- ext/phalcon/mvc/view.zep.c | 34 +- ext/phalcon/mvc/view/engine/php.zep.c | 4 +- ext/phalcon/mvc/view/engine/volt.zep.c | 36 +- .../mvc/view/engine/volt/compiler.zep.c | 160 +- ext/phalcon/mvc/view/simple.zep.c | 26 +- ext/phalcon/paginator/adapter/model.zep.c | 4 +- .../paginator/adapter/nativearray.zep.c | 2 +- .../paginator/adapter/querybuilder.zep.c | 2 +- ext/phalcon/session/adapter/stream.zep.c | 26 +- ext/phalcon/session/manager.zep.c | 4 +- ext/phalcon/storage/adapter/apcu.zep.c | 12 +- .../storage/adapter/libmemcached.zep.c | 8 +- ext/phalcon/storage/adapter/redis.zep.c | 24 +- ext/phalcon/storage/adapter/stream.zep.c | 74 +- ext/phalcon/storage/serializer/base64.zep.c | 4 +- ext/phalcon/storage/serializer/igbinary.zep.c | 14 +- ext/phalcon/storage/serializer/json.zep.c | 2 +- ext/phalcon/storage/serializer/php.zep.c | 10 +- ext/phalcon/support/debug.zep.c | 8 +- ext/phalcon/support/debug/dump.zep.c | 8 +- .../support/helper/arr/blacklist.zep.c | 4 +- ext/phalcon/support/helper/arr/first.zep.c | 2 +- ext/phalcon/support/helper/arr/group.zep.c | 2 +- ext/phalcon/support/helper/arr/isunique.zep.c | 2 +- ext/phalcon/support/helper/arr/last.zep.c | 2 +- ext/phalcon/support/helper/arr/lastkey.zep.c | 2 +- .../support/helper/arr/sliceleft.zep.c | 2 +- .../support/helper/arr/sliceright.zep.c | 2 +- .../support/helper/arr/whitelist.zep.c | 2 +- .../support/helper/file/basename.zep.c | 6 +- ext/phalcon/support/helper/json/decode.zep.c | 2 +- ext/phalcon/support/helper/json/encode.zep.c | 2 +- ext/phalcon/support/helper/str/camelize.zep.c | 2 +- ext/phalcon/support/helper/str/concat.zep.c | 8 +- .../support/helper/str/decapitalize.zep.c | 4 +- .../support/helper/str/dirfromfile.zep.c | 6 +- ext/phalcon/support/helper/str/dynamic.zep.c | 16 +- ext/phalcon/support/helper/str/friendly.zep.c | 4 +- ext/phalcon/support/helper/str/humanize.zep.c | 2 +- ext/phalcon/support/helper/str/includes.zep.c | 2 +- ext/phalcon/support/helper/str/len.zep.c | 2 +- .../support/helper/str/pascalcase.zep.c | 4 +- ext/phalcon/support/helper/str/random.zep.c | 22 +- .../support/helper/str/reduceslashes.zep.c | 2 +- .../support/helper/str/uncamelize.zep.c | 4 +- .../support/helper/str/underscore.zep.c | 2 +- ext/phalcon/support/version.zep.c | 8 +- ext/phalcon/tag.zep.c | 14 +- ext/phalcon/tag/select.zep.c | 4 +- ext/phalcon/translate/adapter/csv.zep.c | 4 +- .../translate/adapter/nativearray.zep.c | 2 +- .../translate/interpolator/indexedarray.zep.c | 2 +- ext/php_phalcon.h | 3 +- 226 files changed, 5458 insertions(+), 4153 deletions(-) diff --git a/ext/kernel/concat.c b/ext/kernel/concat.c index b7275432060..0217cfb1ff6 100644 --- a/ext/kernel/concat.c +++ b/ext/kernel/concat.c @@ -2500,75 +2500,6 @@ void zephir_concat_vsvsvsv(zval *result, zval *op1, const char *op2, uint32_t op } -void zephir_concat_vsvv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, zval *op4, int self_var){ - - zval result_copy, op1_copy, op3_copy, op4_copy; - int use_copy = 0, use_copy1 = 0, use_copy3 = 0, use_copy4 = 0; - size_t offset = 0, length; - - if (Z_TYPE_P(op1) != IS_STRING) { - use_copy1 = zend_make_printable_zval(op1, &op1_copy); - if (use_copy1) { - op1 = &op1_copy; - } - } - - if (Z_TYPE_P(op3) != IS_STRING) { - use_copy3 = zend_make_printable_zval(op3, &op3_copy); - if (use_copy3) { - op3 = &op3_copy; - } - } - - if (Z_TYPE_P(op4) != IS_STRING) { - use_copy4 = zend_make_printable_zval(op4, &op4_copy); - if (use_copy4) { - op4 = &op4_copy; - } - } - - length = Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3) + Z_STRLEN_P(op4); - if (self_var) { - - if (Z_TYPE_P(result) != IS_STRING) { - use_copy = zend_make_printable_zval(result, &result_copy); - if (use_copy) { - ZEPHIR_CPY_WRT_CTOR(result, (&result_copy)); - } - } - - offset = Z_STRLEN_P(result); - length += offset; - Z_STR_P(result) = zend_string_realloc(Z_STR_P(result), length, 0); - - } else { - ZVAL_STR(result, zend_string_alloc(length, 0)); - } - - memcpy(Z_STRVAL_P(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1), op2, op2_len); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1) + op2_len, Z_STRVAL_P(op3), Z_STRLEN_P(op3)); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3), Z_STRVAL_P(op4), Z_STRLEN_P(op4)); - Z_STRVAL_P(result)[length] = 0; - zend_string_forget_hash_val(Z_STR_P(result)); - if (use_copy1) { - zval_dtor(op1); - } - - if (use_copy3) { - zval_dtor(op3); - } - - if (use_copy4) { - zval_dtor(op4); - } - - if (use_copy) { - zval_dtor(&result_copy); - } - -} - void zephir_concat_vv(zval *result, zval *op1, zval *op2, int self_var){ zval result_copy, op1_copy, op2_copy; diff --git a/ext/kernel/concat.h b/ext/kernel/concat.h index 91d25e4d8a4..6398bf72192 100644 --- a/ext/kernel/concat.h +++ b/ext/kernel/concat.h @@ -184,11 +184,6 @@ #define ZEPHIR_SCONCAT_VSVSVSV(result, op1, op2, op3, op4, op5, op6, op7) \ zephir_concat_vsvsvsv(result, op1, op2, sizeof(op2)-1, op3, op4, sizeof(op4)-1, op5, op6, sizeof(op6)-1, op7, 1); -#define ZEPHIR_CONCAT_VSVV(result, op1, op2, op3, op4) \ - zephir_concat_vsvv(result, op1, op2, sizeof(op2)-1, op3, op4, 0); -#define ZEPHIR_SCONCAT_VSVV(result, op1, op2, op3, op4) \ - zephir_concat_vsvv(result, op1, op2, sizeof(op2)-1, op3, op4, 1); - #define ZEPHIR_CONCAT_VV(result, op1, op2) \ zephir_concat_vv(result, op1, op2, 0); #define ZEPHIR_SCONCAT_VV(result, op1, op2) \ @@ -261,7 +256,6 @@ void zephir_concat_vsvs(zval *result, zval *op1, const char *op2, uint32_t op2_l void zephir_concat_vsvsv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, int self_var); void zephir_concat_vsvsvs(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, const char *op6, uint32_t op6_len, int self_var); void zephir_concat_vsvsvsv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, const char *op6, uint32_t op6_len, zval *op7, int self_var); -void zephir_concat_vsvv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, zval *op4, int self_var); void zephir_concat_vv(zval *result, zval *op1, zval *op2, int self_var); void zephir_concat_vvs(zval *result, zval *op1, zval *op2, const char *op3, uint32_t op3_len, int self_var); void zephir_concat_vvsv(zval *result, zval *op1, zval *op2, const char *op3, uint32_t op3_len, zval *op4, int self_var); diff --git a/ext/phalcon.c b/ext/phalcon.c index 9e79b908104..e5a893a7241 100644 --- a/ext/phalcon.c +++ b/ext/phalcon.c @@ -668,6 +668,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("phalcon.orm.update_snapshot_on_save", "1", PHP_INI_ALL, OnUpdateBool, orm.update_snapshot_on_save, zend_phalcon_globals, phalcon_globals) STD_PHP_INI_BOOLEAN("phalcon.orm.virtual_foreign_keys", "1", PHP_INI_ALL, OnUpdateBool, orm.virtual_foreign_keys, zend_phalcon_globals, phalcon_globals) + STD_PHP_INI_BOOLEAN("phalcon.orm.dynamic_update", "1", PHP_INI_ALL, OnUpdateBool, orm.dynamic_update, zend_phalcon_globals, phalcon_globals) STD_PHP_INI_BOOLEAN("phalcon.warning.enable", "1", PHP_INI_ALL, OnUpdateBool, warning.enable, zend_phalcon_globals, phalcon_globals) PHP_INI_END() @@ -1346,6 +1347,7 @@ static void php_zephir_init_globals(zend_phalcon_globals *phalcon_globals) + } diff --git a/ext/phalcon/acl/adapter/memory.zep.c b/ext/phalcon/acl/adapter/memory.zep.c index f260cfccbe7..33025533398 100644 --- a/ext/phalcon/acl/adapter/memory.zep.c +++ b/ext/phalcon/acl/adapter/memory.zep.c @@ -263,10 +263,10 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addComponent) } else { ZEPHIR_INIT_NVAR(&componentObject); object_init_ex(&componentObject, phalcon_acl_component_ce); - ZEPHIR_CALL_METHOD(NULL, &componentObject, "__construct", NULL, 139, componentValue); + ZEPHIR_CALL_METHOD(NULL, &componentObject, "__construct", NULL, 142, componentValue); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&componentName, &componentObject, "getname", NULL, 140); + ZEPHIR_CALL_METHOD(&componentName, &componentObject, "getname", NULL, 143); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("componentsNames"), PH_NOISY_CC | PH_READONLY); if (!(zephir_array_isset(&_1, &componentName))) { @@ -323,7 +323,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addComponentAccess) zephir_read_property(&_0, this_ptr, ZEND_STRL("componentsNames"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "Component"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 141, &_0, &componentName, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 144, &_0, &componentName, &_1); zephir_check_call_status(); _2 = Z_TYPE_P(accessList) != IS_ARRAY; if (_2) { @@ -474,7 +474,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZVAL_STRING(&_1, "Role"); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "role list"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 141, &_0, &roleName, &_1, &_2); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 144, &_0, &roleName, &_1, &_2); zephir_check_call_status(); zephir_read_property(&_3, this_ptr, ZEND_STRL("roleInherits"), PH_NOISY_CC | PH_READONLY); if (!(zephir_array_isset(&_3, &roleName))) { @@ -516,7 +516,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) object_init_ex(&_11$$10, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_12$$10); ZEPHIR_CONCAT_SVS(&_12$$10, "Role '", &roleInheritName, "' (to inherit) does not exist in the role list"); - ZEPHIR_CALL_METHOD(NULL, &_11$$10, "__construct", &_13, 29, &_12$$10); + ZEPHIR_CALL_METHOD(NULL, &_11$$10, "__construct", &_13, 32, &_12$$10); zephir_check_call_status(); zephir_throw_exception_debug(&_11$$10, "phalcon/Acl/Adapter/Memory.zep", 318); ZEPHIR_MM_RESTORE(); @@ -538,7 +538,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _17$$12); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -554,7 +554,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_16$$12, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_16$$12, "next", NULL, 0); @@ -581,7 +581,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) object_init_ex(&_21$$17, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_22$$17); ZEPHIR_CONCAT_SVS(&_22$$17, "Role '", &roleInheritName, "' (to inherit) produces an infinite loop"); - ZEPHIR_CALL_METHOD(NULL, &_21$$17, "__construct", &_13, 29, &_22$$17); + ZEPHIR_CALL_METHOD(NULL, &_21$$17, "__construct", &_13, 32, &_22$$17); zephir_check_call_status(); zephir_throw_exception_debug(&_21$$17, "phalcon/Acl/Adapter/Memory.zep", 350); ZEPHIR_MM_RESTORE(); @@ -598,7 +598,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _26$$18); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -614,7 +614,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_25$$18, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_25$$18, "next", NULL, 0); @@ -659,7 +659,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) object_init_ex(&_32$$25, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_33$$25); ZEPHIR_CONCAT_SVS(&_33$$25, "Role '", &roleInheritName, "' (to inherit) does not exist in the role list"); - ZEPHIR_CALL_METHOD(NULL, &_32$$25, "__construct", &_13, 29, &_33$$25); + ZEPHIR_CALL_METHOD(NULL, &_32$$25, "__construct", &_13, 32, &_33$$25); zephir_check_call_status(); zephir_throw_exception_debug(&_32$$25, "phalcon/Acl/Adapter/Memory.zep", 318); ZEPHIR_MM_RESTORE(); @@ -681,7 +681,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _37$$27); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -697,7 +697,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_36$$27, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_36$$27, "next", NULL, 0); @@ -724,7 +724,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) object_init_ex(&_39$$32, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_40$$32); ZEPHIR_CONCAT_SVS(&_40$$32, "Role '", &roleInheritName, "' (to inherit) produces an infinite loop"); - ZEPHIR_CALL_METHOD(NULL, &_39$$32, "__construct", &_13, 29, &_40$$32); + ZEPHIR_CALL_METHOD(NULL, &_39$$32, "__construct", &_13, 32, &_40$$32); zephir_check_call_status(); zephir_throw_exception_debug(&_39$$32, "phalcon/Acl/Adapter/Memory.zep", 350); ZEPHIR_MM_RESTORE(); @@ -741,7 +741,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _44$$33); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -757,7 +757,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_43$$33, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_19, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_43$$33, "next", NULL, 0); @@ -831,13 +831,13 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole) } else if (Z_TYPE_P(role) == IS_STRING) { ZEPHIR_INIT_NVAR(&roleObject); object_init_ex(&roleObject, phalcon_acl_role_ce); - ZEPHIR_CALL_METHOD(NULL, &roleObject, "__construct", NULL, 143, role); + ZEPHIR_CALL_METHOD(NULL, &roleObject, "__construct", NULL, 146, role); zephir_check_call_status(); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Role must be either a string or implement RoleInterface", "phalcon/Acl/Adapter/Memory.zep", 394); return; } - ZEPHIR_CALL_METHOD(&roleName, &roleObject, "getname", NULL, 144); + ZEPHIR_CALL_METHOD(&roleName, &roleObject, "getname", NULL, 147); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("roles"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset(&_1, &roleName)) { @@ -928,7 +928,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allow) ZEPHIR_INIT_NVAR(&role); ZVAL_COPY(&role, _2); ZVAL_LONG(&_4$$4, 1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 145, &role, &componentName, access, &_4$$4, func); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 148, &role, &componentName, access, &_4$$4, func); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); } else { @@ -943,7 +943,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allow) ZEPHIR_CALL_METHOD(&role, &rolesArray, "current", NULL, 0); zephir_check_call_status(); ZVAL_LONG(&_6$$5, 1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 145, &role, &componentName, access, &_6$$5, func); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 148, &role, &componentName, access, &_6$$5, func); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &rolesArray, "next", NULL, 0); zephir_check_call_status(); @@ -1030,7 +1030,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, deny) ZEPHIR_INIT_NVAR(&role); ZVAL_COPY(&role, _2); ZVAL_LONG(&_4$$4, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 145, &role, &componentName, access, &_4$$4, func); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 148, &role, &componentName, access, &_4$$4, func); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); } else { @@ -1045,7 +1045,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, deny) ZEPHIR_CALL_METHOD(&role, &rolesArray, "current", NULL, 0); zephir_check_call_status(); ZVAL_LONG(&_6$$5, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 145, &role, &componentName, access, &_6$$5, func); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "allowordeny", &_5, 148, &role, &componentName, access, &_6$$5, func); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &rolesArray, "next", NULL, 0); zephir_check_call_status(); @@ -1410,7 +1410,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) object_init_ex(&_1$$6, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(&_2$$6); ZEPHIR_CONCAT_SS(&_2$$6, "Object passed as roleName must implement ", "Phalcon\\Acl\\RoleAwareInterface or Phalcon\\Acl\\RoleInterface"); - ZEPHIR_CALL_METHOD(NULL, &_1$$6, "__construct", NULL, 29, &_2$$6); + ZEPHIR_CALL_METHOD(NULL, &_1$$6, "__construct", NULL, 32, &_2$$6); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$6, "phalcon/Acl/Adapter/Memory.zep", 613); ZEPHIR_MM_RESTORE(); @@ -1431,7 +1431,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) object_init_ex(&_4$$10, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(&_5$$10); ZEPHIR_CONCAT_SS(&_5$$10, "Object passed as componentName must implement ", "Phalcon\\Acl\\ComponentAwareInterface or Phalcon\\Acl\\ComponentInterface"); - ZEPHIR_CALL_METHOD(NULL, &_4$$10, "__construct", NULL, 29, &_5$$10); + ZEPHIR_CALL_METHOD(NULL, &_4$$10, "__construct", NULL, 32, &_5$$10); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$10, "phalcon/Acl/Adapter/Memory.zep", 627); ZEPHIR_MM_RESTORE(); @@ -1463,7 +1463,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) zephir_read_property(&_9$$12, this_ptr, ZEND_STRL("defaultAccess"), PH_NOISY_CC | PH_READONLY); RETURN_MM_BOOL((ZEPHIR_IS_LONG(&_9$$12, 1))); } - ZEPHIR_CALL_METHOD(&accessKey, this_ptr, "canaccess", NULL, 146, roleName, componentName, &access); + ZEPHIR_CALL_METHOD(&accessKey, this_ptr, "canaccess", NULL, 149, roleName, componentName, &access); zephir_check_call_status(); _10 = Z_TYPE_P(&accessKey) != IS_NULL; if (_10) { @@ -1492,9 +1492,9 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) if (zephir_is_callable(&funcAccess)) { ZEPHIR_INIT_VAR(&reflectionFunction); object_init_ex(&reflectionFunction, zephir_get_internal_ce(SL("reflectionfunction"))); - ZEPHIR_CALL_METHOD(NULL, &reflectionFunction, "__construct", NULL, 147, &funcAccess); + ZEPHIR_CALL_METHOD(NULL, &reflectionFunction, "__construct", NULL, 150, &funcAccess); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&reflectionParameters, &reflectionFunction, "getparameters", NULL, 148); + ZEPHIR_CALL_METHOD(&reflectionParameters, &reflectionFunction, "getparameters", NULL, 151); zephir_check_call_status(); ZEPHIR_INIT_VAR(¶meterNumber); ZVAL_LONG(¶meterNumber, zephir_fast_count_int(&reflectionParameters)); @@ -1510,7 +1510,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) } ZEPHIR_INIT_VAR(¶metersForFunction); array_init(¶metersForFunction); - ZEPHIR_CALL_METHOD(&numberOfRequiredParameters, &reflectionFunction, "getnumberofrequiredparameters", NULL, 149); + ZEPHIR_CALL_METHOD(&numberOfRequiredParameters, &reflectionFunction, "getnumberofrequiredparameters", NULL, 152); zephir_check_call_status(); ZEPHIR_CPY_WRT(&userParametersSizeShouldBe, ¶meterNumber); zephir_is_iterable(&reflectionParameters, 0, "phalcon/Acl/Adapter/Memory.zep", 766); @@ -1528,11 +1528,11 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&reflectionClass); object_init_ex(&reflectionClass, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &reflectionClass, "__construct", &_17, 150, &className); + ZEPHIR_CALL_METHOD(NULL, &reflectionClass, "__construct", &_17, 153, &className); zephir_check_call_status(); _18$$18 = Z_TYPE_P(&roleObject) != IS_NULL; if (_18$$18) { - ZEPHIR_CALL_METHOD(&_19$$18, &reflectionClass, "isinstance", &_20, 151, &roleObject); + ZEPHIR_CALL_METHOD(&_19$$18, &reflectionClass, "isinstance", &_20, 154, &roleObject); zephir_check_call_status(); _18$$18 = zephir_is_true(&_19$$18); } @@ -1549,7 +1549,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) } _22$$18 = Z_TYPE_P(&componentObject) != IS_NULL; if (_22$$18) { - ZEPHIR_CALL_METHOD(&_23$$18, &reflectionClass, "isinstance", &_20, 151, &componentObject); + ZEPHIR_CALL_METHOD(&_23$$18, &reflectionClass, "isinstance", &_20, 154, &componentObject); zephir_check_call_status(); _22$$18 = zephir_is_true(&_23$$18); } @@ -1572,7 +1572,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) _27$$18 = _25$$18; if (_27$$18) { zephir_array_fetch(&_29$$18, ¶meters, ¶meterToCheck, PH_NOISY | PH_READONLY, "phalcon/Acl/Adapter/Memory.zep", 743); - ZEPHIR_CALL_METHOD(&_28$$18, &reflectionClass, "isinstance", &_20, 151, &_29$$18); + ZEPHIR_CALL_METHOD(&_28$$18, &reflectionClass, "isinstance", &_20, 154, &_29$$18); zephir_check_call_status(); _27$$18 = !zephir_is_true(&_28$$18); } @@ -1582,11 +1582,11 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) ZEPHIR_INIT_NVAR(&_31$$21); zephir_array_fetch(&_32$$21, ¶meters, ¶meterToCheck, PH_NOISY | PH_READONLY, "phalcon/Acl/Adapter/Memory.zep", 750); zephir_get_class(&_31$$21, &_32$$21, 0); - ZEPHIR_CALL_METHOD(&_33$$21, &reflectionClass, "getname", &_34, 152); + ZEPHIR_CALL_METHOD(&_33$$21, &reflectionClass, "getname", &_34, 155); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_35$$21); ZEPHIR_CONCAT_SSSVSVSVSVSVS(&_35$$21, "Your passed parameter doesn't have the ", "same class as the parameter in defined function ", "when checking if ", roleName, " can ", &access, " ", componentName, ". Class passed: ", &_31$$21, " , Class in defined function: ", &_33$$21, "."); - ZEPHIR_CALL_METHOD(NULL, &_30$$21, "__construct", NULL, 29, &_35$$21); + ZEPHIR_CALL_METHOD(NULL, &_30$$21, "__construct", NULL, 32, &_35$$21); zephir_check_call_status(); zephir_throw_exception_debug(&_30$$21, "phalcon/Acl/Adapter/Memory.zep", 753); ZEPHIR_MM_RESTORE(); @@ -1618,11 +1618,11 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&reflectionClass); object_init_ex(&reflectionClass, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &reflectionClass, "__construct", &_17, 150, &className); + ZEPHIR_CALL_METHOD(NULL, &reflectionClass, "__construct", &_17, 153, &className); zephir_check_call_status(); _37$$24 = Z_TYPE_P(&roleObject) != IS_NULL; if (_37$$24) { - ZEPHIR_CALL_METHOD(&_38$$24, &reflectionClass, "isinstance", &_20, 151, &roleObject); + ZEPHIR_CALL_METHOD(&_38$$24, &reflectionClass, "isinstance", &_20, 154, &roleObject); zephir_check_call_status(); _37$$24 = zephir_is_true(&_38$$24); } @@ -1639,7 +1639,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) } _40$$24 = Z_TYPE_P(&componentObject) != IS_NULL; if (_40$$24) { - ZEPHIR_CALL_METHOD(&_41$$24, &reflectionClass, "isinstance", &_20, 151, &componentObject); + ZEPHIR_CALL_METHOD(&_41$$24, &reflectionClass, "isinstance", &_20, 154, &componentObject); zephir_check_call_status(); _40$$24 = zephir_is_true(&_41$$24); } @@ -1662,7 +1662,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) _45$$24 = _43$$24; if (_45$$24) { zephir_array_fetch(&_47$$24, ¶meters, ¶meterToCheck, PH_NOISY | PH_READONLY, "phalcon/Acl/Adapter/Memory.zep", 743); - ZEPHIR_CALL_METHOD(&_46$$24, &reflectionClass, "isinstance", &_20, 151, &_47$$24); + ZEPHIR_CALL_METHOD(&_46$$24, &reflectionClass, "isinstance", &_20, 154, &_47$$24); zephir_check_call_status(); _45$$24 = !zephir_is_true(&_46$$24); } @@ -1672,11 +1672,11 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) ZEPHIR_INIT_NVAR(&_49$$27); zephir_array_fetch(&_50$$27, ¶meters, ¶meterToCheck, PH_NOISY | PH_READONLY, "phalcon/Acl/Adapter/Memory.zep", 750); zephir_get_class(&_49$$27, &_50$$27, 0); - ZEPHIR_CALL_METHOD(&_51$$27, &reflectionClass, "getname", &_34, 152); + ZEPHIR_CALL_METHOD(&_51$$27, &reflectionClass, "getname", &_34, 155); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_52$$27); ZEPHIR_CONCAT_SSSVSVSVSVSVS(&_52$$27, "Your passed parameter doesn't have the ", "same class as the parameter in defined function ", "when checking if ", roleName, " can ", &access, " ", componentName, ". Class passed: ", &_49$$27, " , Class in defined function: ", &_51$$27, "."); - ZEPHIR_CALL_METHOD(NULL, &_48$$27, "__construct", NULL, 29, &_52$$27); + ZEPHIR_CALL_METHOD(NULL, &_48$$27, "__construct", NULL, 32, &_52$$27); zephir_check_call_status(); zephir_throw_exception_debug(&_48$$27, "phalcon/Acl/Adapter/Memory.zep", 753); ZEPHIR_MM_RESTORE(); @@ -1736,7 +1736,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) object_init_ex(&_63$$15, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(&_64$$15); ZEPHIR_CONCAT_SSVSVSVS(&_64$$15, "You did not provide all necessary parameters for the ", "defined function when checking if '", roleName, "' can '", &access, "' for '", componentName, "'."); - ZEPHIR_CALL_METHOD(NULL, &_63$$15, "__construct", NULL, 29, &_64$$15); + ZEPHIR_CALL_METHOD(NULL, &_63$$15, "__construct", NULL, 32, &_64$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_63$$15, "phalcon/Acl/Adapter/Memory.zep", 807); ZEPHIR_MM_RESTORE(); @@ -1891,12 +1891,12 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allowOrDeny) zephir_read_property(&_0, this_ptr, ZEND_STRL("roles"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "Role"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 141, &_0, &roleName, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 144, &_0, &roleName, &_1); zephir_check_call_status(); zephir_read_property(&_2, this_ptr, ZEND_STRL("componentsNames"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "Component"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 141, &_2, &componentName, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkexists", NULL, 144, &_2, &componentName, &_1); zephir_check_call_status(); zephir_read_property(&_3, this_ptr, ZEND_STRL("accessList"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&accessList, &_3); @@ -1914,7 +1914,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allowOrDeny) object_init_ex(&_6$$5, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_7$$5); ZEPHIR_CONCAT_SVSVS(&_7$$5, "Access '", &accessName, "' does not exist in component '", &componentName, "'"); - ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_8, 29, &_7$$5); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_8, 32, &_7$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$5, "phalcon/Acl/Adapter/Memory.zep", 859); ZEPHIR_MM_RESTORE(); @@ -1939,7 +1939,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allowOrDeny) object_init_ex(&_9$$7, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(&_10$$7); ZEPHIR_CONCAT_SVSVS(&_10$$7, "Access '", &accessName, "' does not exist in component '", &componentName, "'"); - ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_8, 29, &_10$$7); + ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_8, 32, &_10$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_9$$7, "phalcon/Acl/Adapter/Memory.zep", 859); ZEPHIR_MM_RESTORE(); @@ -1994,7 +1994,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allowOrDeny) object_init_ex(&_13$$14, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(&_14$$14); ZEPHIR_CONCAT_SVSVS(&_14$$14, "Access '", access, "' does not exist in component '", &componentName, "'"); - ZEPHIR_CALL_METHOD(NULL, &_13$$14, "__construct", &_8, 29, &_14$$14); + ZEPHIR_CALL_METHOD(NULL, &_13$$14, "__construct", &_8, 32, &_14$$14); zephir_check_call_status(); zephir_throw_exception_debug(&_13$$14, "phalcon/Acl/Adapter/Memory.zep", 879); ZEPHIR_MM_RESTORE(); @@ -2092,7 +2092,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, canAccess) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _3$$6); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -2108,7 +2108,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, canAccess) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_2$$6, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_2$$6, "next", NULL, 0); @@ -2159,7 +2159,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, canAccess) ZEPHIR_INIT_NVAR(&usedRoleToInherit); ZVAL_COPY(&usedRoleToInherit, _13$$14); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); @@ -2175,7 +2175,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, canAccess) ZEPHIR_CALL_METHOD(&usedRoleToInherit, &_12$$14, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&checkRoleToInherits); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 142, &checkRoleToInherits, &usedRoleToInherit); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 145, &checkRoleToInherits, &usedRoleToInherit); ZEPHIR_UNREF(&checkRoleToInherits); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_12$$14, "next", NULL, 0); @@ -2242,7 +2242,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, checkExists) object_init_ex(&_0$$3, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZEPHIR_CONCAT_VSVSV(&_1$$3, &elementName, " '", &element, "' does not exist in the ", &suffix); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_1$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Acl/Adapter/Memory.zep", 1015); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/annotations/adapter/abstractadapter.zep.c b/ext/phalcon/annotations/adapter/abstractadapter.zep.c index d2cf703d1af..4b11a72dd24 100644 --- a/ext/phalcon/annotations/adapter/abstractadapter.zep.c +++ b/ext/phalcon/annotations/adapter/abstractadapter.zep.c @@ -104,7 +104,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, get) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&classAnnotations); object_init_ex(&classAnnotations, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, &classAnnotations, "__construct", NULL, 33, &parsedAnnotations); + ZEPHIR_CALL_METHOD(NULL, &classAnnotations, "__construct", NULL, 36, &parsedAnnotations); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("annotations"), &realClassName, &classAnnotations); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, &realClassName, &classAnnotations); @@ -147,7 +147,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getConstant) zephir_check_call_status(); if (!(zephir_array_isset_fetch(&constant, &constants, &constantName, 1))) { object_init_ex(return_value, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 34); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); zephir_check_call_status(); RETURN_MM(); } @@ -224,7 +224,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getProperty) zephir_check_call_status(); if (!(zephir_array_isset_fetch(&property, &properties, &propertyName, 1))) { object_init_ex(return_value, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 34); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); zephir_check_call_status(); RETURN_MM(); } @@ -319,7 +319,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethod) } ZEPHIR_INIT_NVAR(&method); ZVAL_COPY(&method, _0$$3); - ZEPHIR_CALL_FUNCTION(&_4$$4, "strcasecmp", &_5, 35, &methodKey, &methodName); + ZEPHIR_CALL_FUNCTION(&_4$$4, "strcasecmp", &_5, 38, &methodKey, &methodName); zephir_check_call_status(); if (!(zephir_is_true(&_4$$4))) { RETURN_CCTOR(&method); @@ -338,7 +338,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethod) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&method, &methods, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_6$$6, "strcasecmp", &_5, 35, &methodKey, &methodName); + ZEPHIR_CALL_FUNCTION(&_6$$6, "strcasecmp", &_5, 38, &methodKey, &methodName); zephir_check_call_status(); if (!(zephir_is_true(&_6$$6))) { RETURN_CCTOR(&method); @@ -351,7 +351,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethod) ZEPHIR_INIT_NVAR(&methodKey); } object_init_ex(return_value, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 34); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/annotations/adapter/apcu.zep.c b/ext/phalcon/annotations/adapter/apcu.zep.c index 8b158374130..db798c91d33 100644 --- a/ext/phalcon/annotations/adapter/apcu.zep.c +++ b/ext/phalcon/annotations/adapter/apcu.zep.c @@ -142,7 +142,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, read) ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); zephir_fast_strtolower(&_0, &_2); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 103, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 106, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -192,7 +192,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, write) ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); zephir_fast_strtolower(&_0, &_2); zephir_read_property(&_3, this_ptr, ZEND_STRL("ttl"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 104, &_0, data, &_3); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 107, &_0, data, &_3); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/annotations/adapter/stream.zep.c b/ext/phalcon/annotations/adapter/stream.zep.c index 5284fb80179..ef691fd4790 100644 --- a/ext/phalcon/annotations/adapter/stream.zep.c +++ b/ext/phalcon/annotations/adapter/stream.zep.c @@ -154,33 +154,33 @@ PHP_METHOD(Phalcon_Annotations_Adapter_Stream, read) RETURN_MM_BOOL(0); } ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); + ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 132); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "8.0"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ">="); - ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 130, &version, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 133, &version, &_4, &_5); zephir_check_call_status(); if (zephir_is_true(&_6)) { ZEPHIR_INIT_VAR(&_7$$5); ZEPHIR_INIT_NVAR(&_7$$5); zephir_create_closure_ex(&_7$$5, NULL, phalcon_5__closure_ce, SL("__invoke")); ZVAL_LONG(&_8$$5, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_7$$5, &_8$$5); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_7$$5, &_8$$5); zephir_check_call_status(); } else { ZEPHIR_INIT_VAR(&_9$$6); ZEPHIR_INIT_NVAR(&_9$$6); zephir_create_closure_ex(&_9$$6, NULL, phalcon_6__closure_ce, SL("__invoke")); ZVAL_LONG(&_10$$6, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_9$$6, &_10$$6); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_9$$6, &_10$$6); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "unserialize", NULL, 16, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_11); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 135); zephir_check_call_status(); if (UNEXPECTED(ZEPHIR_GLOBAL(warning).enable)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Cannot read annotation data", "phalcon/Annotations/Adapter/Stream.zep", 102); diff --git a/ext/phalcon/annotations/annotation.zep.c b/ext/phalcon/annotations/annotation.zep.c index 17ee67169b6..5b19b88dae8 100644 --- a/ext/phalcon/annotations/annotation.zep.c +++ b/ext/phalcon/annotations/annotation.zep.c @@ -276,7 +276,7 @@ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) ZEPHIR_INIT_NVAR(&item); ZVAL_COPY(&item, _1$$7); zephir_array_fetch_string(&_3$$8, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 139); - ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 153, &_3$$8); + ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 156, &_3$$8); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&name); if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { @@ -297,7 +297,7 @@ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) ZEPHIR_CALL_METHOD(&item, &_0$$7, "current", NULL, 0); zephir_check_call_status(); zephir_array_fetch_string(&_5$$11, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 139); - ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 153, &_5$$11); + ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 156, &_5$$11); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&name); if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { @@ -314,7 +314,7 @@ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) } if (ZEPHIR_IS_LONG(&type, 300)) { object_init_ex(return_value, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 154, &expr); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 157, &expr); zephir_check_call_status(); RETURN_MM(); } @@ -322,7 +322,7 @@ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) object_init_ex(&_6$$15, phalcon_annotations_exception_ce); ZEPHIR_INIT_VAR(&_7$$15); ZEPHIR_CONCAT_SVS(&_7$$15, "The expression ", &type, " is unknown"); - ZEPHIR_CALL_METHOD(NULL, &_6$$15, "__construct", NULL, 29, &_7$$15); + ZEPHIR_CALL_METHOD(NULL, &_6$$15, "__construct", NULL, 32, &_7$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$15, "phalcon/Annotations/Annotation.zep", 154); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/annotations/annotationsfactory.zep.c b/ext/phalcon/annotations/annotationsfactory.zep.c index 54f500edcff..94c18662474 100644 --- a/ext/phalcon/annotations/annotationsfactory.zep.c +++ b/ext/phalcon/annotations/annotationsfactory.zep.c @@ -136,7 +136,7 @@ PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, load) array_init(&_2); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "options"); - ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 155, config, &_3, &_2); + ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 158, config, &_3, &_2); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); zephir_check_call_status(); diff --git a/ext/phalcon/annotations/collection.zep.c b/ext/phalcon/annotations/collection.zep.c index 748bee3800d..e64cc683451 100644 --- a/ext/phalcon/annotations/collection.zep.c +++ b/ext/phalcon/annotations/collection.zep.c @@ -110,7 +110,7 @@ PHP_METHOD(Phalcon_Annotations_Collection, __construct) ZVAL_COPY(&annotationData, _0); ZEPHIR_INIT_NVAR(&_2$$3); object_init_ex(&_2$$3, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 154, &annotationData); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 157, &annotationData); zephir_check_call_status(); zephir_array_append(&annotations, &_2$$3, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); } ZEND_HASH_FOREACH_END(); @@ -127,7 +127,7 @@ PHP_METHOD(Phalcon_Annotations_Collection, __construct) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_4$$4); object_init_ex(&_4$$4, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", &_3, 154, &annotationData); + ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", &_3, 157, &annotationData); zephir_check_call_status(); zephir_array_append(&annotations, &_4$$4, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); ZEPHIR_CALL_METHOD(NULL, &reflectionData, "next", NULL, 0); @@ -249,7 +249,7 @@ PHP_METHOD(Phalcon_Annotations_Collection, get) object_init_ex(&_5, phalcon_annotations_exception_ce); ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SVS(&_6, "Collection doesn't have an annotation called '", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 29, &_6); + ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 32, &_6); zephir_check_call_status(); zephir_throw_exception_debug(&_5, "phalcon/Annotations/Collection.zep", 100); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/annotations/reader.zep.c b/ext/phalcon/annotations/reader.zep.c index f6e49435616..fed60db3b60 100644 --- a/ext/phalcon/annotations/reader.zep.c +++ b/ext/phalcon/annotations/reader.zep.c @@ -110,15 +110,15 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) array_init(&annotations); ZEPHIR_INIT_VAR(&reflection); object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 150, &className); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 153, &className); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, &reflection, "getdoccomment", NULL, 156); + ZEPHIR_CALL_METHOD(&comment, &reflection, "getdoccomment", NULL, 159); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { ZEPHIR_INIT_VAR(&classAnnotations); - ZEPHIR_CALL_METHOD(&_0$$3, &reflection, "getfilename", NULL, 157); + ZEPHIR_CALL_METHOD(&_0$$3, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, &reflection, "getstartline", NULL, 158); + ZEPHIR_CALL_METHOD(&_1$$3, &reflection, "getstartline", NULL, 161); zephir_check_call_status(); ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&classAnnotations, &comment, &_0$$3, &_1$$3); zephir_check_call_status(); @@ -126,7 +126,7 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&constants, &reflection, "getconstants", NULL, 159); + ZEPHIR_CALL_METHOD(&constants, &reflection, "getconstants", NULL, 162); zephir_check_call_status(); if (zephir_fast_count_int(&constants)) { line = 1; @@ -140,13 +140,13 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) { ZEPHIR_INIT_NVAR(&constant); ZVAL_COPY(&constant, _2$$5); - ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 160, &constant); + ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 163, &constant); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&comment, &constantReflection, "getdoccomment", NULL, 0); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { ZEPHIR_INIT_NVAR(&constantAnnotations); - ZEPHIR_CALL_METHOD(&_5$$7, &reflection, "getfilename", NULL, 157); + ZEPHIR_CALL_METHOD(&_5$$7, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); ZVAL_LONG(&_6$$7, line); ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&constantAnnotations, &comment, &_5$$7, &_6$$7); @@ -167,13 +167,13 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) } ZEPHIR_CALL_METHOD(&constant, &arrayKeys, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 160, &constant); + ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 163, &constant); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&comment, &constantReflection, "getdoccomment", NULL, 0); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { ZEPHIR_INIT_NVAR(&constantAnnotations); - ZEPHIR_CALL_METHOD(&_7$$10, &reflection, "getfilename", NULL, 157); + ZEPHIR_CALL_METHOD(&_7$$10, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); ZVAL_LONG(&_8$$10, line); ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&constantAnnotations, &comment, &_7$$10, &_8$$10); @@ -191,7 +191,7 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) zephir_array_update_string(&annotations, SL("constants"), &anotationsConstants, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&properties, &reflection, "getproperties", NULL, 161); + ZEPHIR_CALL_METHOD(&properties, &reflection, "getproperties", NULL, 164); zephir_check_call_status(); if (zephir_fast_count_int(&properties)) { line = 1; @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { ZEPHIR_INIT_NVAR(&propertyAnnotations); - ZEPHIR_CALL_METHOD(&_11$$15, &reflection, "getfilename", NULL, 157); + ZEPHIR_CALL_METHOD(&_11$$15, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); ZVAL_LONG(&_12$$15, line); ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_11$$15, &_12$$15); @@ -234,7 +234,7 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { ZEPHIR_INIT_NVAR(&propertyAnnotations); - ZEPHIR_CALL_METHOD(&_14$$18, &reflection, "getfilename", NULL, 157); + ZEPHIR_CALL_METHOD(&_14$$18, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); ZVAL_LONG(&_15$$18, line); ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_14$$18, &_15$$18); @@ -254,7 +254,7 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); } } - ZEPHIR_CALL_METHOD(&methods, &reflection, "getmethods", NULL, 162); + ZEPHIR_CALL_METHOD(&methods, &reflection, "getmethods", NULL, 165); zephir_check_call_status(); if (0 == ZEPHIR_IS_EMPTY(&methods)) { ZEPHIR_INIT_VAR(&annotationsMethods); diff --git a/ext/phalcon/annotations/reflection.zep.c b/ext/phalcon/annotations/reflection.zep.c index d129bbdf726..68a5864630c 100644 --- a/ext/phalcon/annotations/reflection.zep.c +++ b/ext/phalcon/annotations/reflection.zep.c @@ -131,7 +131,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) if (zephir_array_isset_string_fetch(&reflectionClass, &_1$$3, SL("class"), 1)) { ZEPHIR_INIT_VAR(&_2$$4); object_init_ex(&_2$$4, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 34, &reflectionClass); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 37, &reflectionClass); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("classAnnotations"), &_2$$4); } @@ -188,7 +188,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getConstantsAnnotations) ZVAL_COPY(&reflectionConstant, _2$$4); ZEPHIR_INIT_NVAR(&_6$$5); object_init_ex(&_6$$5, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 34, &reflectionConstant); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionConstant); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("constantAnnotations"), &constant, &_6$$5); } ZEND_HASH_FOREACH_END(); @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getConstantsAnnotations) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_8$$6); object_init_ex(&_8$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 34, &reflectionConstant); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionConstant); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("constantAnnotations"), &constant, &_8$$6); ZEPHIR_CALL_METHOD(NULL, &reflectionConstants, "next", NULL, 0); @@ -270,7 +270,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) ZVAL_COPY(&reflectionProperty, _2$$4); ZEPHIR_INIT_NVAR(&_6$$5); object_init_ex(&_6$$5, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 34, &reflectionProperty); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionProperty); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_6$$5); } ZEND_HASH_FOREACH_END(); @@ -289,7 +289,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_8$$6); object_init_ex(&_8$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 34, &reflectionProperty); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionProperty); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_8$$6); ZEPHIR_CALL_METHOD(NULL, &reflectionProperties, "next", NULL, 0); @@ -352,7 +352,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) ZVAL_COPY(&reflectionMethod, _2$$4); ZEPHIR_INIT_NVAR(&_6$$5); object_init_ex(&_6$$5, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 34, &reflectionMethod); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionMethod); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_6$$5); } ZEND_HASH_FOREACH_END(); @@ -371,7 +371,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_8$$6); object_init_ex(&_8$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 34, &reflectionMethod); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionMethod); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_8$$6); ZEPHIR_CALL_METHOD(NULL, &reflectionMethods, "next", NULL, 0); diff --git a/ext/phalcon/application/abstractapplication.zep.c b/ext/phalcon/application/abstractapplication.zep.c index 72c85b74be1..d2a83c33459 100644 --- a/ext/phalcon/application/abstractapplication.zep.c +++ b/ext/phalcon/application/abstractapplication.zep.c @@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Application_AbstractApplication, getModule) object_init_ex(&_1$$3, phalcon_application_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Module '", &name, "' is not registered in the application container"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Application/AbstractApplication.zep", 83); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/assets/asset.zep.c b/ext/phalcon/assets/asset.zep.c index 273241b64a9..587deae76fd 100644 --- a/ext/phalcon/assets/asset.zep.c +++ b/ext/phalcon/assets/asset.zep.c @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Assets_Asset, getAssetKey) ZEPHIR_CONCAT_VSV(&key, &_0, ":", &_1); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "sha256"); - ZEPHIR_RETURN_CALL_FUNCTION("hash", NULL, 68, &_2, &key); + ZEPHIR_RETURN_CALL_FUNCTION("hash", NULL, 71, &_2, &key); zephir_check_call_status(); RETURN_MM(); } @@ -271,7 +271,7 @@ PHP_METHOD(Phalcon_Assets_Asset, getContent) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "sourcePath"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkpath", NULL, 69, &_1); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkpath", NULL, 72, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(&completePath); ZEPHIR_CONCAT_VV(&completePath, &basePath, &_0); @@ -283,13 +283,13 @@ PHP_METHOD(Phalcon_Assets_Asset, getContent) _3 = !ZEPHIR_IS_TRUE_IDENTICAL(&_4); } if (_3) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwexception", NULL, 70, &completePath); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwexception", NULL, 73, &completePath); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&content, this_ptr, "phpfilegetcontents", NULL, 0, &completePath); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&content)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwexception", NULL, 70, &completePath); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwexception", NULL, 73, &completePath); zephir_check_call_status(); } RETURN_CCTOR(&content); @@ -355,13 +355,13 @@ PHP_METHOD(Phalcon_Assets_Asset, getRealSourcePath) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "sourcePath"); - ZEPHIR_CALL_METHOD(&source, this_ptr, "checkpath", NULL, 69, &_0); + ZEPHIR_CALL_METHOD(&source, this_ptr, "checkpath", NULL, 72, &_0); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("isLocal"), PH_NOISY_CC | PH_READONLY); if (zephir_is_true(&_1)) { ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_VV(&_2$$3, &basePath, &source); - ZEPHIR_CALL_FUNCTION(&_3$$3, "realpath", NULL, 71, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "realpath", NULL, 74, &_2$$3); zephir_check_call_status(); zephir_cast_to_string(&_4$$3, &_3$$3); ZEPHIR_CPY_WRT(&source, &_4$$3); @@ -411,7 +411,7 @@ PHP_METHOD(Phalcon_Assets_Asset, getRealTargetPath) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "targetPath"); - ZEPHIR_CALL_METHOD(&target, this_ptr, "checkpath", NULL, 69, &_0); + ZEPHIR_CALL_METHOD(&target, this_ptr, "checkpath", NULL, 72, &_0); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("isLocal"), PH_NOISY_CC | PH_READONLY); if (zephir_is_true(&_1)) { @@ -420,7 +420,7 @@ PHP_METHOD(Phalcon_Assets_Asset, getRealTargetPath) ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "phpfileexists", NULL, 0, &completePath); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_2$$3)) { - ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 71, &completePath); + ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 74, &completePath); zephir_check_call_status(); ZEPHIR_CPY_WRT(&completePath, &_3$$4); if (ZEPHIR_IS_FALSE_IDENTICAL(&completePath)) { @@ -461,7 +461,7 @@ PHP_METHOD(Phalcon_Assets_Asset, getRealTargetUri) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "targetUri"); - ZEPHIR_CALL_METHOD(&target, this_ptr, "checkpath", NULL, 69, &_0); + ZEPHIR_CALL_METHOD(&target, this_ptr, "checkpath", NULL, 72, &_0); zephir_check_call_status(); ZEPHIR_OBS_VAR(&ver); zephir_read_property(&ver, this_ptr, ZEND_STRL("version"), PH_NOISY_CC); @@ -972,7 +972,7 @@ PHP_METHOD(Phalcon_Assets_Asset, throwException) object_init_ex(&_0, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SVS(&_1, "Asset's content for '", &completePath, "' cannot be read"); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 29, &_1); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 32, &_1); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "phalcon/Assets/Asset.zep", 472); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/assets/collection.zep.c b/ext/phalcon/assets/collection.zep.c index 6f884e04867..c18f0079030 100644 --- a/ext/phalcon/assets/collection.zep.c +++ b/ext/phalcon/assets/collection.zep.c @@ -124,7 +124,7 @@ PHP_METHOD(Phalcon_Assets_Collection, add) zephir_fetch_params(1, 1, 0, &asset); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addasset", NULL, 163, asset); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addasset", NULL, 166, asset); zephir_check_call_status(); RETURN_THIS(); } @@ -213,7 +213,7 @@ PHP_METHOD(Phalcon_Assets_Collection, addCss) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processadd", NULL, 164, &_0, &path, isLocal, &_1, &attributes, &version, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processadd", NULL, 167, &_0, &path, isLocal, &_1, &attributes, &version, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -269,7 +269,7 @@ PHP_METHOD(Phalcon_Assets_Collection, addInline) zephir_fetch_params(1, 1, 0, &code); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addasset", NULL, 163, code); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addasset", NULL, 166, code); zephir_check_call_status(); RETURN_THIS(); } @@ -329,7 +329,7 @@ PHP_METHOD(Phalcon_Assets_Collection, addInlineCss) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processaddinline", NULL, 165, &_0, &content, &_1, &attributes); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processaddinline", NULL, 168, &_0, &content, &_1, &attributes); zephir_check_call_status(); RETURN_MM(); } @@ -389,7 +389,7 @@ PHP_METHOD(Phalcon_Assets_Collection, addInlineJs) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processaddinline", NULL, 165, &_0, &content, &_1, &attributes); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processaddinline", NULL, 168, &_0, &content, &_1, &attributes); zephir_check_call_status(); RETURN_MM(); } @@ -478,7 +478,7 @@ PHP_METHOD(Phalcon_Assets_Collection, addJs) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processadd", NULL, 164, &_0, &path, isLocal, &_1, &attributes, &version, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processadd", NULL, 167, &_0, &path, isLocal, &_1, &attributes, &version, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -643,7 +643,7 @@ PHP_METHOD(Phalcon_Assets_Collection, getRealTargetPath) ZEPHIR_INIT_VAR(&completePath); ZEPHIR_CONCAT_VV(&completePath, &basePath, &_0); if (1 == (zephir_file_exists(&completePath) == SUCCESS)) { - ZEPHIR_RETURN_CALL_FUNCTION("realpath", NULL, 71, &completePath); + ZEPHIR_RETURN_CALL_FUNCTION("realpath", NULL, 74, &completePath); zephir_check_call_status(); RETURN_MM(); } @@ -1286,7 +1286,7 @@ PHP_METHOD(Phalcon_Assets_Collection, processAdd) ZEPHIR_CPY_WRT(&name, &_0); ZEPHIR_OBS_VAR(&flag); zephir_read_property(&flag, this_ptr, ZEND_STRL("isLocal"), PH_NOISY_CC); - ZEPHIR_CALL_METHOD(&attrs, this_ptr, "processattributes", NULL, 166, &attributes); + ZEPHIR_CALL_METHOD(&attrs, this_ptr, "processattributes", NULL, 169, &attributes); zephir_check_call_status(); if (Z_TYPE_P(isLocal) != IS_NULL) { ZEPHIR_INIT_NVAR(&flag); @@ -1375,7 +1375,7 @@ PHP_METHOD(Phalcon_Assets_Collection, processAddInline) ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SV(&_0, "Phalcon\\Assets\\Inline\\", &className); ZEPHIR_CPY_WRT(&name, &_0); - ZEPHIR_CALL_METHOD(&attrs, this_ptr, "processattributes", NULL, 166, &attributes); + ZEPHIR_CALL_METHOD(&attrs, this_ptr, "processattributes", NULL, 169, &attributes); zephir_check_call_status(); ZEPHIR_INIT_VAR(&asset); zephir_fetch_safe_class(&_1, &name); diff --git a/ext/phalcon/assets/inline.zep.c b/ext/phalcon/assets/inline.zep.c index eb9cfe16a20..00d7e8033fb 100644 --- a/ext/phalcon/assets/inline.zep.c +++ b/ext/phalcon/assets/inline.zep.c @@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Assets_Inline, getAssetKey) ZEPHIR_CONCAT_VSV(&key, &_0, ":", &_1); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "sha256"); - ZEPHIR_RETURN_CALL_FUNCTION("hash", NULL, 68, &_2, &key); + ZEPHIR_RETURN_CALL_FUNCTION("hash", NULL, 71, &_2, &key); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/assets/manager.zep.c b/ext/phalcon/assets/manager.zep.c index 95e6059f695..1725a493448 100644 --- a/ext/phalcon/assets/manager.zep.c +++ b/ext/phalcon/assets/manager.zep.c @@ -172,7 +172,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addAssetByType) } - ZEPHIR_CALL_METHOD(&collection, this_ptr, "checkandcreatecollection", NULL, 167, &type); + ZEPHIR_CALL_METHOD(&collection, this_ptr, "checkandcreatecollection", NULL, 170, &type); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &collection, "add", NULL, 0, asset); zephir_check_call_status(); @@ -277,7 +277,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addCss) } else { ZVAL_BOOL(&_3, 0); } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 168, &path, &_1, &_2, &attributes, &version, &_3); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 171, &path, &_1, &_2, &attributes, &version, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "css"); @@ -358,7 +358,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addInlineCodeByType) } - ZEPHIR_CALL_METHOD(&collection, this_ptr, "checkandcreatecollection", NULL, 167, &type); + ZEPHIR_CALL_METHOD(&collection, this_ptr, "checkandcreatecollection", NULL, 170, &type); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &collection, "addinline", NULL, 0, code); zephir_check_call_status(); @@ -421,7 +421,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addInlineCss) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 169, &content, &_1, &attributes); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 172, &content, &_1, &attributes); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "css"); @@ -486,7 +486,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addInlineJs) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 170, &content, &_1, &attributes); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 173, &content, &_1, &attributes); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "js"); @@ -598,7 +598,7 @@ PHP_METHOD(Phalcon_Assets_Manager, addJs) } else { ZVAL_BOOL(&_3, 0); } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 171, &path, &_1, &_2, &attributes, &version, &_3); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 174, &path, &_1, &_2, &attributes, &version, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "js"); @@ -634,7 +634,7 @@ PHP_METHOD(Phalcon_Assets_Manager, collection) zephir_get_strval(&name, name_param); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 167, &name); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 170, &name); zephir_check_call_status(); RETURN_MM(); } @@ -858,7 +858,7 @@ PHP_METHOD(Phalcon_Assets_Manager, getCss) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "css"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 167, &_0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 170, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -882,7 +882,7 @@ PHP_METHOD(Phalcon_Assets_Manager, getJs) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "js"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 167, &_0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkandcreatecollection", NULL, 170, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1126,20 +1126,20 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_3$$9, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(&_4$$9); ZEPHIR_CONCAT_SVS(&_4$$9, "Path '", &completeTargetPath, "' is not a valid target path (1)"); - ZEPHIR_CALL_METHOD(NULL, &_3$$9, "__construct", NULL, 29, &_4$$9); + ZEPHIR_CALL_METHOD(NULL, &_3$$9, "__construct", NULL, 32, &_4$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$9, "phalcon/Assets/Manager.zep", 457); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_FUNCTION(&_5$$8, "is_dir", NULL, 133, &completeTargetPath); + ZEPHIR_CALL_FUNCTION(&_5$$8, "is_dir", NULL, 136, &completeTargetPath); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_5$$8)) { ZEPHIR_INIT_VAR(&_6$$10); object_init_ex(&_6$$10, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(&_7$$10); ZEPHIR_CONCAT_SVS(&_7$$10, "Path '", &completeTargetPath, "' is not a valid target path (2), it is a directory."); - ZEPHIR_CALL_METHOD(NULL, &_6$$10, "__construct", NULL, 29, &_7$$10); + ZEPHIR_CALL_METHOD(NULL, &_6$$10, "__construct", NULL, 32, &_7$$10); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$10, "phalcon/Assets/Manager.zep", 463); ZEPHIR_MM_RESTORE(); @@ -1170,7 +1170,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_11$$14, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_12$$14); ZEPHIR_CONCAT_SVS(&_12$$14, "Asset '", &sourcePath, "' does not have a valid source path"); - ZEPHIR_CALL_METHOD(NULL, &_11$$14, "__construct", NULL, 29, &_12$$14); + ZEPHIR_CALL_METHOD(NULL, &_11$$14, "__construct", NULL, 32, &_12$$14); zephir_check_call_status(); zephir_throw_exception_debug(&_11$$14, "phalcon/Assets/Manager.zep", 493); ZEPHIR_MM_RESTORE(); @@ -1184,7 +1184,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_13$$15, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_14$$15); ZEPHIR_CONCAT_SVS(&_14$$15, "Asset '", &sourcePath, "' does not have a valid target path"); - ZEPHIR_CALL_METHOD(NULL, &_13$$15, "__construct", NULL, 29, &_14$$15); + ZEPHIR_CALL_METHOD(NULL, &_13$$15, "__construct", NULL, 32, &_14$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_13$$15, "phalcon/Assets/Manager.zep", 509); ZEPHIR_MM_RESTORE(); @@ -1198,7 +1198,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_16$$17, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_17$$17); ZEPHIR_CONCAT_SVS(&_17$$17, "Asset '", &targetPath, "' have the same source and target paths"); - ZEPHIR_CALL_METHOD(NULL, &_16$$17, "__construct", NULL, 29, &_17$$17); + ZEPHIR_CALL_METHOD(NULL, &_16$$17, "__construct", NULL, 32, &_17$$17); zephir_check_call_status(); zephir_throw_exception_debug(&_16$$17, "phalcon/Assets/Manager.zep", 519); ZEPHIR_MM_RESTORE(); @@ -1221,13 +1221,13 @@ PHP_METHOD(Phalcon_Assets_Manager, output) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_21$$21, &asset, "getrealsourcepath", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 172, collection, &_20$$21, &_21$$21); + ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 175, collection, &_20$$21, &_21$$21); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_23$$21, &asset, "getattributes", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_24$$21, &asset, "islocal", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 173, &callback, &_23$$21, &prefixedPath, &_24$$21); + ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 176, &callback, &_23$$21, &prefixedPath, &_24$$21); zephir_check_call_status(); zephir_read_property(&_26$$21, this_ptr, ZEND_STRL("implicitOutput"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_26$$21)) { @@ -1304,12 +1304,12 @@ PHP_METHOD(Phalcon_Assets_Manager, output) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_31$$36, &asset, "getrealsourcepath", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 172, collection, &_30$$36, &_31$$36); + ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 175, collection, &_30$$36, &_31$$36); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_32$$36, collection, "getattributes", &_33, 0); zephir_check_call_status(); ZVAL_BOOL(&_34$$36, 1); - ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 173, &callback, &_32$$36, &prefixedPath, &_34$$36); + ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 176, &callback, &_32$$36, &prefixedPath, &_34$$36); zephir_check_call_status(); zephir_read_property(&_34$$36, this_ptr, ZEND_STRL("implicitOutput"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_34$$36)) { @@ -1347,7 +1347,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_36$$42, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_37$$42); ZEPHIR_CONCAT_SVS(&_37$$42, "Asset '", &sourcePath, "' does not have a valid source path"); - ZEPHIR_CALL_METHOD(NULL, &_36$$42, "__construct", NULL, 29, &_37$$42); + ZEPHIR_CALL_METHOD(NULL, &_36$$42, "__construct", NULL, 32, &_37$$42); zephir_check_call_status(); zephir_throw_exception_debug(&_36$$42, "phalcon/Assets/Manager.zep", 493); ZEPHIR_MM_RESTORE(); @@ -1361,7 +1361,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_38$$43, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_39$$43); ZEPHIR_CONCAT_SVS(&_39$$43, "Asset '", &sourcePath, "' does not have a valid target path"); - ZEPHIR_CALL_METHOD(NULL, &_38$$43, "__construct", NULL, 29, &_39$$43); + ZEPHIR_CALL_METHOD(NULL, &_38$$43, "__construct", NULL, 32, &_39$$43); zephir_check_call_status(); zephir_throw_exception_debug(&_38$$43, "phalcon/Assets/Manager.zep", 509); ZEPHIR_MM_RESTORE(); @@ -1375,7 +1375,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output) object_init_ex(&_41$$45, phalcon_assets_exception_ce); ZEPHIR_INIT_NVAR(&_42$$45); ZEPHIR_CONCAT_SVS(&_42$$45, "Asset '", &targetPath, "' have the same source and target paths"); - ZEPHIR_CALL_METHOD(NULL, &_41$$45, "__construct", NULL, 29, &_42$$45); + ZEPHIR_CALL_METHOD(NULL, &_41$$45, "__construct", NULL, 32, &_42$$45); zephir_check_call_status(); zephir_throw_exception_debug(&_41$$45, "phalcon/Assets/Manager.zep", 519); ZEPHIR_MM_RESTORE(); @@ -1398,13 +1398,13 @@ PHP_METHOD(Phalcon_Assets_Manager, output) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_46$$49, &asset, "getrealsourcepath", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 172, collection, &_45$$49, &_46$$49); + ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 175, collection, &_45$$49, &_46$$49); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_47$$49, &asset, "getattributes", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_48$$49, &asset, "islocal", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 173, &callback, &_47$$49, &prefixedPath, &_48$$49); + ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 176, &callback, &_47$$49, &prefixedPath, &_48$$49); zephir_check_call_status(); zephir_read_property(&_49$$49, this_ptr, ZEND_STRL("implicitOutput"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_49$$49)) { @@ -1481,12 +1481,12 @@ PHP_METHOD(Phalcon_Assets_Manager, output) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_54$$64, &asset, "getrealsourcepath", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 172, collection, &_53$$64, &_54$$64); + ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 175, collection, &_53$$64, &_54$$64); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_55$$64, collection, "getattributes", &_33, 0); zephir_check_call_status(); ZVAL_BOOL(&_56$$64, 1); - ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 173, &callback, &_55$$64, &prefixedPath, &_56$$64); + ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 176, &callback, &_55$$64, &prefixedPath, &_56$$64); zephir_check_call_status(); zephir_read_property(&_56$$64, this_ptr, ZEND_STRL("implicitOutput"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_56$$64)) { @@ -1508,13 +1508,13 @@ PHP_METHOD(Phalcon_Assets_Manager, output) zephir_file_put_contents(NULL, &completeTargetPath, &filteredJoinedContent); ZEPHIR_CALL_METHOD(&_58$$67, collection, "gettargeturi", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 172, collection, &_58$$67, &completeTargetPath); + ZEPHIR_CALL_METHOD(&prefixedPath, this_ptr, "calculateprefixedpath", &_22, 175, collection, &_58$$67, &completeTargetPath); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_59$$67, collection, "getattributes", &_33, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_60$$67, collection, "gettargetislocal", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 173, &callback, &_59$$67, &prefixedPath, &_60$$67); + ZEPHIR_CALL_METHOD(&html, this_ptr, "docallback", &_25, 176, &callback, &_59$$67, &prefixedPath, &_60$$67); zephir_check_call_status(); zephir_read_property(&_61$$67, this_ptr, ZEND_STRL("implicitOutput"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_61$$67)) { @@ -2240,7 +2240,7 @@ PHP_METHOD(Phalcon_Assets_Manager, cssLink) ZVAL_STRING(&_2, "text/css"); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "href"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processparameters", NULL, 174, parameters, &_0, &_1, &_2, &_3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processparameters", NULL, 177, parameters, &_0, &_1, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } @@ -2361,7 +2361,7 @@ PHP_METHOD(Phalcon_Assets_Manager, jsLink) ZVAL_STRING(&_2, "application/javascript"); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "src"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processparameters", NULL, 174, parameters, &_0, &_1, &_2, &_3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processparameters", NULL, 177, parameters, &_0, &_1, &_2, &_3); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/autoload/loader.zep.c b/ext/phalcon/autoload/loader.zep.c index 473a0f4b914..a51010eadf3 100644 --- a/ext/phalcon/autoload/loader.zep.c +++ b/ext/phalcon/autoload/loader.zep.c @@ -127,7 +127,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, __construct) ZVAL_STRING(&_0, "sha256"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "php"); - ZEPHIR_CALL_FUNCTION(&_2, "hash", NULL, 68, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "hash", NULL, 71, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "php"); @@ -209,7 +209,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addDirectory) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "sha256"); - ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 68, &_0, &directory); + ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 71, &_0, &directory); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("directories"), &_1, &directory); RETURN_THIS(); @@ -248,7 +248,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addExtension) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "sha256"); - ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 68, &_0, &extension); + ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 71, &_0, &extension); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("extensions"), &_1, &extension); RETURN_THIS(); @@ -287,7 +287,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addFile) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "sha256"); - ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 68, &_0, &file); + ZEPHIR_CALL_FUNCTION(&_1, "hash", NULL, 71, &_0, &file); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("files"), &_1, &file); RETURN_THIS(); @@ -357,7 +357,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addNamespace) ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_VV(&_1, &_0, &nsSeparator); ZEPHIR_CPY_WRT(&nsName, &_1); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdirectories", NULL, 175, directories, &dirSeparator); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkdirectories", NULL, 178, directories, &dirSeparator); zephir_check_call_status(); ZEPHIR_CPY_WRT(directories, &_2); zephir_read_property(&_3, this_ptr, ZEND_STRL("namespaces"), PH_NOISY_CC | PH_READONLY); @@ -382,7 +382,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addNamespace) } ZEPHIR_INIT_VAR(&_7); zephir_fast_array_merge(&_7, &source, &target); - ZEPHIR_CALL_FUNCTION(&_2, "array_unique", NULL, 176, &_7); + ZEPHIR_CALL_FUNCTION(&_2, "array_unique", NULL, 179, &_7); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("namespaces"), &nsName, &_2); RETURN_THIS(); @@ -433,40 +433,40 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoload) zephir_update_property_zval(this_ptr, ZEND_STRL("debug"), &_0); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SV(&_1, "Loading: ", &className); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "loader:beforeCheckClass"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "firemanagerevent", NULL, 0, &_2, &className); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "autoloadcheckclasses", NULL, 178, &className); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "autoloadcheckclasses", NULL, 181, &className); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_3)) { RETURN_MM_BOOL(1); } ZEPHIR_INIT_VAR(&_4); ZEPHIR_CONCAT_SV(&_4, "Class: 404: ", &className); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "autoloadchecknamespaces", NULL, 179, &className); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "autoloadchecknamespaces", NULL, 182, &className); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_5)) { RETURN_MM_BOOL(1); } ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SV(&_6, "Namespace: 404: ", &className); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_6); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_6); zephir_check_call_status(); zephir_read_property(&_8, this_ptr, ZEND_STRL("directories"), PH_NOISY_CC | PH_READONLY); ZVAL_BOOL(&_9, 1); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "autoloadcheckdirectories", NULL, 180, &_8, &className, &_9); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "autoloadcheckdirectories", NULL, 183, &_8, &className, &_9); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_7)) { RETURN_MM_BOOL(1); } ZEPHIR_INIT_VAR(&_10); ZEPHIR_CONCAT_SV(&_10, "Directories: 404: ", &className); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_10); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_10); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "loader:afterCheckClass"); @@ -713,7 +713,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, register) ZVAL_STRING(&_2$$3, "autoload"); zephir_array_fast_append(&_1$$3, &_2$$3); ZVAL_BOOL(&_3$$3, (prepend ? 1 : 0)); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 181, &_1$$3, &__$true, &_3$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_register", NULL, 184, &_1$$3, &__$true, &_3$$3); zephir_check_call_status(); if (1) { zephir_update_property_zval(this_ptr, ZEND_STRL("isRegistered"), &__$true); @@ -863,7 +863,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setDirectories) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addtocollection", NULL, 182, &directories, &_0, &_1, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addtocollection", NULL, 185, &directories, &_0, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -922,7 +922,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setExtensions) ZVAL_STRING(&_1$$3, "sha256"); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "php"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "hash", NULL, 68, &_1$$3, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "hash", NULL, 71, &_1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1$$3); ZVAL_STRING(&_1$$3, "php"); @@ -1069,7 +1069,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setFiles) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addtocollection", NULL, 182, &files, &_0, &_1, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addtocollection", NULL, 185, &files, &_0, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -1141,7 +1141,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setNamespaces) } ZEPHIR_INIT_NVAR(&directories); ZVAL_COPY(&directories, _1); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "checkdirectories", &_6, 175, &directories, &dirSeparator); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "checkdirectories", &_6, 178, &directories, &dirSeparator); zephir_check_call_status(); ZEPHIR_CPY_WRT(&directories, &_5$$4); ZEPHIR_CALL_METHOD(NULL, this_ptr, "addnamespace", &_7, 0, &name, &directories); @@ -1160,7 +1160,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setNamespaces) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&directories, &namespaces, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$5, this_ptr, "checkdirectories", &_6, 175, &directories, &dirSeparator); + ZEPHIR_CALL_METHOD(&_8$$5, this_ptr, "checkdirectories", &_6, 178, &directories, &dirSeparator); zephir_check_call_status(); ZEPHIR_CPY_WRT(&directories, &_8$$5); ZEPHIR_CALL_METHOD(NULL, this_ptr, "addnamespace", &_7, 0, &name, &directories); @@ -1204,7 +1204,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, unregister) ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "autoload"); zephir_array_fast_append(&_1$$3, &_2$$3); - ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 183, &_1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "spl_autoload_unregister", NULL, 186, &_1$$3); zephir_check_call_status(); if (0) { zephir_update_property_zval(this_ptr, ZEND_STRL("isRegistered"), &__$true); @@ -1215,6 +1215,20 @@ PHP_METHOD(Phalcon_Autoload_Loader, unregister) RETURN_THIS(); } +/** + * returns isRegister + * + * @return bool + */ +PHP_METHOD(Phalcon_Autoload_Loader, isRegistered) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "isRegistered"); +} + /** * If the file exists, require it and return true; false otherwise * @@ -1250,7 +1264,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, requireFile) zephir_read_property(&_0, this_ptr, ZEND_STRL("fileCheckingCallback"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_1, "call_user_func", NULL, 184, &_0, &file); + ZEPHIR_CALL_FUNCTION(&_1, "call_user_func", NULL, 187, &_0, &file); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_1)) { ZEPHIR_INIT_VAR(&_2$$3); @@ -1259,7 +1273,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, requireFile) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SV(&_3$$3, "Require: ", &file); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_3$$3); zephir_check_call_status(); if (zephir_require_once_zval(&file) == FAILURE) { RETURN_MM_NULL(); @@ -1268,7 +1282,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, requireFile) } ZEPHIR_INIT_VAR(&_4); ZEPHIR_CONCAT_SV(&_4, "Require: 404: ", &file); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_4); zephir_check_call_status(); RETURN_MM_BOOL(0); } @@ -1363,7 +1377,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, addToCollection) array_init(&_0$$3); zephir_update_property_zval_zval(this_ptr, &collectionName, &_0$$3); } - zephir_is_iterable(&collection, 0, "phalcon/Autoload/Loader.zep", 584); + zephir_is_iterable(&collection, 0, "phalcon/Autoload/Loader.zep", 594); if (Z_TYPE_P(&collection) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&collection), _1) { @@ -1432,7 +1446,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckClasses) if (1 == zephir_array_isset(&_0, &className)) { zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("classes"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&filePath); - zephir_array_fetch(&filePath, &_1$$3, &className, PH_NOISY, "phalcon/Autoload/Loader.zep", 600); + zephir_array_fetch(&filePath, &_1$$3, &className, PH_NOISY, "phalcon/Autoload/Loader.zep", 610); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "loader:pathFound"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "firemanagerevent", NULL, 0, &_2$$3, &filePath); @@ -1441,7 +1455,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckClasses) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SV(&_3$$3, "Class: load: ", &filePath); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 177, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", NULL, 180, &_3$$3); zephir_check_call_status(); RETURN_MM_BOOL(1); } @@ -1527,7 +1541,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) ZEPHIR_CPY_WRT(&className, &_0); zephir_read_property(&_1, this_ptr, ZEND_STRL("extensions"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&extensions, &_1); - zephir_is_iterable(&directories, 0, "phalcon/Autoload/Loader.zep", 659); + zephir_is_iterable(&directories, 0, "phalcon/Autoload/Loader.zep", 669); if (Z_TYPE_P(&directories) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&directories), _2) { @@ -1537,7 +1551,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) zephir_fast_trim(&_4$$3, &directory, &dirSeparator, ZEPHIR_TRIM_RIGHT); ZEPHIR_INIT_NVAR(&fixedDirectory); ZEPHIR_CONCAT_VV(&fixedDirectory, &_4$$3, &dirSeparator); - zephir_is_iterable(&extensions, 0, "phalcon/Autoload/Loader.zep", 657); + zephir_is_iterable(&extensions, 0, "phalcon/Autoload/Loader.zep", 667); if (Z_TYPE_P(&extensions) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&extensions), _5$$3) { @@ -1556,7 +1570,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) if (isDirectory) { ZEPHIR_INIT_NVAR(&_11$$6); ZEPHIR_CONCAT_SV(&_11$$6, "Directories: ", &filePath); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_11$$6); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_11$$6); zephir_check_call_status(); } RETURN_MM_BOOL(1); @@ -1586,7 +1600,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) if (isDirectory) { ZEPHIR_INIT_NVAR(&_15$$9); ZEPHIR_CONCAT_SV(&_15$$9, "Directories: ", &filePath); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_15$$9); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_15$$9); zephir_check_call_status(); } RETURN_MM_BOOL(1); @@ -1612,7 +1626,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) zephir_fast_trim(&_16$$10, &directory, &dirSeparator, ZEPHIR_TRIM_RIGHT); ZEPHIR_INIT_NVAR(&fixedDirectory); ZEPHIR_CONCAT_VV(&fixedDirectory, &_16$$10, &dirSeparator); - zephir_is_iterable(&extensions, 0, "phalcon/Autoload/Loader.zep", 657); + zephir_is_iterable(&extensions, 0, "phalcon/Autoload/Loader.zep", 667); if (Z_TYPE_P(&extensions) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&extensions), _17$$10) { @@ -1631,7 +1645,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) if (isDirectory) { ZEPHIR_INIT_NVAR(&_21$$13); ZEPHIR_CONCAT_SV(&_21$$13, "Directories: ", &filePath); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_21$$13); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_21$$13); zephir_check_call_status(); } RETURN_MM_BOOL(1); @@ -1661,7 +1675,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckDirectories) if (isDirectory) { ZEPHIR_INIT_NVAR(&_24$$16); ZEPHIR_CONCAT_SV(&_24$$16, "Directories: ", &filePath); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_24$$16); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_24$$16); zephir_check_call_status(); } RETURN_MM_BOOL(1); @@ -1735,7 +1749,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckNamespaces) ZVAL_STRING(&nsSeparator, "\\"); zephir_read_property(&_0, this_ptr, ZEND_STRL("namespaces"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&namespaces, &_0); - zephir_is_iterable(&namespaces, 0, "phalcon/Autoload/Loader.zep", 694); + zephir_is_iterable(&namespaces, 0, "phalcon/Autoload/Loader.zep", 704); if (Z_TYPE_P(&namespaces) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&namespaces), _3, _4, _1) { @@ -1758,13 +1772,13 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckNamespaces) ZVAL_LONG(&_7$$3, zephir_fast_strlen_ev(&prefix)); ZEPHIR_INIT_NVAR(&fileName); zephir_substr(&fileName, &className, zephir_get_intval(&_7$$3), 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_METHOD(&_8$$3, this_ptr, "autoloadcheckdirectories", &_9, 180, &directories, &fileName); + ZEPHIR_CALL_METHOD(&_8$$3, this_ptr, "autoloadcheckdirectories", &_9, 183, &directories, &fileName); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_8$$3)) { zephir_read_property(&_10$$5, this_ptr, ZEND_STRL("checkedPath"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_11$$5); ZEPHIR_CONCAT_SVSV(&_11$$5, "Namespace: ", &prefix, " - ", &_10$$5); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_11$$5); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_11$$5); zephir_check_call_status(); RETURN_MM_BOOL(1); } @@ -1793,13 +1807,13 @@ PHP_METHOD(Phalcon_Autoload_Loader, autoloadCheckNamespaces) ZVAL_LONG(&_15$$6, zephir_fast_strlen_ev(&prefix)); ZEPHIR_INIT_NVAR(&fileName); zephir_substr(&fileName, &className, zephir_get_intval(&_15$$6), 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_METHOD(&_16$$6, this_ptr, "autoloadcheckdirectories", &_9, 180, &directories, &fileName); + ZEPHIR_CALL_METHOD(&_16$$6, this_ptr, "autoloadcheckdirectories", &_9, 183, &directories, &fileName); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_16$$6)) { zephir_read_property(&_17$$8, this_ptr, ZEND_STRL("checkedPath"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_18$$8); ZEPHIR_CONCAT_SVSV(&_18$$8, "Namespace: ", &prefix, " - ", &_17$$8); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 177, &_18$$8); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "adddebug", &_12, 180, &_18$$8); zephir_check_call_status(); RETURN_MM_BOOL(1); } @@ -1869,7 +1883,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, checkDirectories) _0 = !(Z_TYPE_P(directories) == IS_ARRAY); } if (_0) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_autoload_exception_ce, "The directories parameter is not a string or array", "phalcon/Autoload/Loader.zep", 717); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_autoload_exception_ce, "The directories parameter is not a string or array", "phalcon/Autoload/Loader.zep", 727); return; } if (Z_TYPE_P(directories) == IS_STRING) { @@ -1880,7 +1894,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, checkDirectories) } ZEPHIR_INIT_VAR(&results); array_init(&results); - zephir_is_iterable(directories, 0, "phalcon/Autoload/Loader.zep", 731); + zephir_is_iterable(directories, 0, "phalcon/Autoload/Loader.zep", 741); if (Z_TYPE_P(directories) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(directories), _2) { @@ -1893,7 +1907,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, checkDirectories) ZEPHIR_CPY_WRT(&directory, &_5$$5); ZEPHIR_INIT_NVAR(&_6$$5); ZVAL_STRING(&_6$$5, "sha256"); - ZEPHIR_CALL_FUNCTION(&_7$$5, "hash", &_8, 68, &_6$$5, &directory); + ZEPHIR_CALL_FUNCTION(&_7$$5, "hash", &_8, 71, &_6$$5, &directory); zephir_check_call_status(); zephir_array_update_zval(&results, &_7$$5, &directory, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1915,7 +1929,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, checkDirectories) ZEPHIR_CPY_WRT(&directory, &_10$$6); ZEPHIR_INIT_NVAR(&_11$$6); ZVAL_STRING(&_11$$6, "sha256"); - ZEPHIR_CALL_FUNCTION(&_12$$6, "hash", &_8, 68, &_11$$6, &directory); + ZEPHIR_CALL_FUNCTION(&_12$$6, "hash", &_8, 71, &_11$$6, &directory); zephir_check_call_status(); zephir_array_update_zval(&results, &_12$$6, &directory, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, directories, "next", NULL, 0); diff --git a/ext/phalcon/autoload/loader.zep.h b/ext/phalcon/autoload/loader.zep.h index 5ae5aca0f92..c7f3177ee18 100644 --- a/ext/phalcon/autoload/loader.zep.h +++ b/ext/phalcon/autoload/loader.zep.h @@ -27,6 +27,7 @@ PHP_METHOD(Phalcon_Autoload_Loader, setFileCheckingCallback); PHP_METHOD(Phalcon_Autoload_Loader, setFiles); PHP_METHOD(Phalcon_Autoload_Loader, setNamespaces); PHP_METHOD(Phalcon_Autoload_Loader, unregister); +PHP_METHOD(Phalcon_Autoload_Loader, isRegistered); PHP_METHOD(Phalcon_Autoload_Loader, requireFile); PHP_METHOD(Phalcon_Autoload_Loader, addDebug); PHP_METHOD(Phalcon_Autoload_Loader, addToCollection); @@ -130,6 +131,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_autoload_loader_unregister, 0, 0, Phalcon\\Autoload\\Loader, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_autoload_loader_isregistered, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_autoload_loader_requirefile, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -193,6 +197,7 @@ ZEPHIR_INIT_FUNCS(phalcon_autoload_loader_method_entry) { PHP_ME(Phalcon_Autoload_Loader, setFiles, arginfo_phalcon_autoload_loader_setfiles, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Autoload_Loader, setNamespaces, arginfo_phalcon_autoload_loader_setnamespaces, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Autoload_Loader, unregister, arginfo_phalcon_autoload_loader_unregister, ZEND_ACC_PUBLIC) + PHP_ME(Phalcon_Autoload_Loader, isRegistered, arginfo_phalcon_autoload_loader_isregistered, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Autoload_Loader, requireFile, arginfo_phalcon_autoload_loader_requirefile, ZEND_ACC_PROTECTED) PHP_ME(Phalcon_Autoload_Loader, addDebug, arginfo_phalcon_autoload_loader_adddebug, ZEND_ACC_PRIVATE) PHP_ME(Phalcon_Autoload_Loader, addToCollection, arginfo_phalcon_autoload_loader_addtocollection, ZEND_ACC_PRIVATE) diff --git a/ext/phalcon/cache/cachefactory.zep.c b/ext/phalcon/cache/cachefactory.zep.c index 9d3ade37f6b..188ea603e8d 100644 --- a/ext/phalcon/cache/cachefactory.zep.c +++ b/ext/phalcon/cache/cachefactory.zep.c @@ -215,7 +215,7 @@ PHP_METHOD(Phalcon_Cache_CacheFactory, newInstance) ZEPHIR_CALL_METHOD(&adapter, &_0, "newinstance", NULL, 0, &name, &options); zephir_check_call_status(); object_init_ex(return_value, phalcon_cache_cache_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 185, &adapter); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 188, &adapter); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/cli/console.zep.c b/ext/phalcon/cli/console.zep.c index 115a01b52fb..d564de32d28 100644 --- a/ext/phalcon/cli/console.zep.c +++ b/ext/phalcon/cli/console.zep.c @@ -191,7 +191,7 @@ PHP_METHOD(Phalcon_Cli_Console, handle) object_init_ex(&_16$$12, phalcon_cli_console_exception_ce); ZEPHIR_INIT_VAR(&_17$$12); ZEPHIR_CONCAT_SVS(&_17$$12, "Module '", &moduleName, "' isn't registered in the console container"); - ZEPHIR_CALL_METHOD(NULL, &_16$$12, "__construct", NULL, 29, &_17$$12); + ZEPHIR_CALL_METHOD(NULL, &_16$$12, "__construct", NULL, 32, &_17$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_16$$12, "phalcon/Cli/Console.zep", 87); ZEPHIR_MM_RESTORE(); @@ -215,7 +215,7 @@ PHP_METHOD(Phalcon_Cli_Console, handle) object_init_ex(&_18$$16, phalcon_cli_console_exception_ce); ZEPHIR_INIT_VAR(&_19$$16); ZEPHIR_CONCAT_SVS(&_19$$16, "Module definition path '", &path, "' doesn't exist"); - ZEPHIR_CALL_METHOD(NULL, &_18$$16, "__construct", NULL, 29, &_19$$16); + ZEPHIR_CALL_METHOD(NULL, &_18$$16, "__construct", NULL, 32, &_19$$16); zephir_check_call_status(); zephir_throw_exception_debug(&_18$$16, "phalcon/Cli/Console.zep", 104); ZEPHIR_MM_RESTORE(); @@ -425,7 +425,7 @@ PHP_METHOD(Phalcon_Cli_Console, setArgument) ZEPHIR_INIT_NVAR(&_3$$5); ZVAL_STRING(&_3$$5, "--"); ZVAL_LONG(&_4$$5, 2); - ZEPHIR_CALL_FUNCTION(&_5$$5, "strncmp", &_6, 186, &arg, &_3$$5, &_4$$5); + ZEPHIR_CALL_FUNCTION(&_5$$5, "strncmp", &_6, 189, &arg, &_3$$5, &_4$$5); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_5$$5, 0)) { ZEPHIR_INIT_NVAR(&_7$$6); @@ -457,7 +457,7 @@ PHP_METHOD(Phalcon_Cli_Console, setArgument) ZEPHIR_INIT_NVAR(&_18$$9); ZVAL_STRING(&_18$$9, "-"); ZVAL_LONG(&_19$$9, 1); - ZEPHIR_CALL_FUNCTION(&_20$$9, "strncmp", &_6, 186, &arg, &_18$$9, &_19$$9); + ZEPHIR_CALL_FUNCTION(&_20$$9, "strncmp", &_6, 189, &arg, &_18$$9, &_19$$9); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_20$$9, 0)) { ZVAL_LONG(&_21$$10, 1); @@ -487,7 +487,7 @@ PHP_METHOD(Phalcon_Cli_Console, setArgument) ZEPHIR_INIT_NVAR(&_23$$14); ZVAL_STRING(&_23$$14, "--"); ZVAL_LONG(&_24$$14, 2); - ZEPHIR_CALL_FUNCTION(&_25$$14, "strncmp", &_6, 186, &arg, &_23$$14, &_24$$14); + ZEPHIR_CALL_FUNCTION(&_25$$14, "strncmp", &_6, 189, &arg, &_23$$14, &_24$$14); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_25$$14, 0)) { ZEPHIR_INIT_NVAR(&_26$$15); @@ -519,7 +519,7 @@ PHP_METHOD(Phalcon_Cli_Console, setArgument) ZEPHIR_INIT_NVAR(&_37$$18); ZVAL_STRING(&_37$$18, "-"); ZVAL_LONG(&_38$$18, 1); - ZEPHIR_CALL_FUNCTION(&_39$$18, "strncmp", &_6, 186, &arg, &_37$$18, &_38$$18); + ZEPHIR_CALL_FUNCTION(&_39$$18, "strncmp", &_6, 189, &arg, &_37$$18, &_38$$18); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_39$$18, 0)) { ZVAL_LONG(&_40$$19, 1); diff --git a/ext/phalcon/cli/dispatcher.zep.c b/ext/phalcon/cli/dispatcher.zep.c index 7de933cda1b..2af6713b450 100644 --- a/ext/phalcon/cli/dispatcher.zep.c +++ b/ext/phalcon/cli/dispatcher.zep.c @@ -486,7 +486,7 @@ PHP_METHOD(Phalcon_Cli_Dispatcher, throwDispatchException) ZEPHIR_INIT_VAR(&exception); object_init_ex(&exception, phalcon_cli_dispatcher_exception_ce); ZVAL_LONG(&_0, exceptionCode); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 29, &message, &_0); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 32, &message, &_0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "handleexception", NULL, 0, &exception); zephir_check_call_status(); diff --git a/ext/phalcon/cli/router.zep.c b/ext/phalcon/cli/router.zep.c index 32be41145e1..6081d80a6f7 100644 --- a/ext/phalcon/cli/router.zep.c +++ b/ext/phalcon/cli/router.zep.c @@ -153,7 +153,7 @@ PHP_METHOD(Phalcon_Cli_Router, __construct) add_assoc_long_ex(&_1$$3, SL("task"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^(?::delimiter)?([a-zA-Z0-9\\_\\-]+)[:delimiter]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 187, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 190, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "phalcon/Cli/Router.zep", 119); ZEPHIR_INIT_NVAR(&_2$$3); @@ -165,7 +165,7 @@ PHP_METHOD(Phalcon_Cli_Router, __construct) add_assoc_long_ex(&_3$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_4$$3); ZVAL_STRING(&_4$$3, "#^(?::delimiter)?([a-zA-Z0-9\\_\\-]+):delimiter([a-zA-Z0-9\\.\\_]+)(:delimiter.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 187, &_4$$3, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 190, &_4$$3, &_3$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "phalcon/Cli/Router.zep", 128); } @@ -223,7 +223,7 @@ PHP_METHOD(Phalcon_Cli_Router, add) ZEPHIR_INIT_VAR(&route); object_init_ex(&route, phalcon_cli_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 187, &pattern, paths); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 190, &pattern, paths); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("routes"), &route); RETURN_CCTOR(&route); diff --git a/ext/phalcon/cli/router/route.zep.c b/ext/phalcon/cli/router/route.zep.c index 20e513852e5..d7107e5486d 100644 --- a/ext/phalcon/cli/router/route.zep.c +++ b/ext/phalcon/cli/router/route.zep.c @@ -737,7 +737,7 @@ PHP_METHOD(Phalcon_Cli_Router_Route, getReversedPaths) ZEPHIR_MM_GROW(); zephir_read_property(&_0, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("array_flip", NULL, 96, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("array_flip", NULL, 99, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/config/adapter/grouped.zep.c b/ext/phalcon/config/adapter/grouped.zep.c index 2b8fa3a3e19..a4b3fed6bdb 100644 --- a/ext/phalcon/config/adapter/grouped.zep.c +++ b/ext/phalcon/config/adapter/grouped.zep.c @@ -185,9 +185,9 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) if (ZEPHIR_IS_IDENTICAL(&_6$$5, &defaultAdapter)) { ZEPHIR_INIT_NVAR(&_7$$6); object_init_ex(&_7$$6, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", &_8, 188); + ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", &_8, 191); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_9$$6, &_7$$6, "load", &_10, 189, &configName); + ZEPHIR_CALL_METHOD(&_9$$6, &_7$$6, "load", &_10, 192, &configName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_9$$6); zephir_check_call_status(); @@ -210,7 +210,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) object_init_ex(&_14$$9, phalcon_config_exception_ce); ZEPHIR_INIT_NVAR(&_15$$9); ZEPHIR_CONCAT_SS(&_15$$9, "To use 'array' adapter you have to specify ", "the 'config' as an array."); - ZEPHIR_CALL_METHOD(NULL, &_14$$9, "__construct", &_16, 29, &_15$$9); + ZEPHIR_CALL_METHOD(NULL, &_14$$9, "__construct", &_16, 32, &_15$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_14$$9, "phalcon/Config/Adapter/Grouped.zep", 110); ZEPHIR_MM_RESTORE(); @@ -226,9 +226,9 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) } else { ZEPHIR_INIT_NVAR(&_19$$10); object_init_ex(&_19$$10, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_19$$10, "__construct", &_8, 188); + ZEPHIR_CALL_METHOD(NULL, &_19$$10, "__construct", &_8, 191); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_20$$10, &_19$$10, "load", &_10, 189, &configInstance); + ZEPHIR_CALL_METHOD(&_20$$10, &_19$$10, "load", &_10, 192, &configInstance); zephir_check_call_status(); ZEPHIR_CPY_WRT(&configInstance, &_20$$10); } @@ -261,9 +261,9 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) if (ZEPHIR_IS_IDENTICAL(&_22$$13, &defaultAdapter)) { ZEPHIR_INIT_NVAR(&_23$$14); object_init_ex(&_23$$14, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_23$$14, "__construct", &_8, 188); + ZEPHIR_CALL_METHOD(NULL, &_23$$14, "__construct", &_8, 191); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24$$14, &_23$$14, "load", &_10, 189, &configName); + ZEPHIR_CALL_METHOD(&_24$$14, &_23$$14, "load", &_10, 192, &configName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "merge", &_5, 0, &_24$$14); zephir_check_call_status(); @@ -286,7 +286,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) object_init_ex(&_28$$17, phalcon_config_exception_ce); ZEPHIR_INIT_NVAR(&_29$$17); ZEPHIR_CONCAT_SS(&_29$$17, "To use 'array' adapter you have to specify ", "the 'config' as an array."); - ZEPHIR_CALL_METHOD(NULL, &_28$$17, "__construct", &_16, 29, &_29$$17); + ZEPHIR_CALL_METHOD(NULL, &_28$$17, "__construct", &_16, 32, &_29$$17); zephir_check_call_status(); zephir_throw_exception_debug(&_28$$17, "phalcon/Config/Adapter/Grouped.zep", 110); ZEPHIR_MM_RESTORE(); @@ -302,9 +302,9 @@ PHP_METHOD(Phalcon_Config_Adapter_Grouped, __construct) } else { ZEPHIR_INIT_NVAR(&_31$$18); object_init_ex(&_31$$18, phalcon_config_configfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &_31$$18, "__construct", &_8, 188); + ZEPHIR_CALL_METHOD(NULL, &_31$$18, "__construct", &_8, 191); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_32$$18, &_31$$18, "load", &_10, 189, &configInstance); + ZEPHIR_CALL_METHOD(&_32$$18, &_31$$18, "load", &_10, 192, &configInstance); zephir_check_call_status(); ZEPHIR_CPY_WRT(&configInstance, &_32$$18); } diff --git a/ext/phalcon/config/adapter/ini.zep.c b/ext/phalcon/config/adapter/ini.zep.c index 81948cffe8f..96e52d2b7fc 100644 --- a/ext/phalcon/config/adapter/ini.zep.c +++ b/ext/phalcon/config/adapter/ini.zep.c @@ -161,7 +161,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct) zephir_basename(&_3$$3, &filePath); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SVS(&_4$$3, "Configuration file ", &_3$$3, " cannot be loaded"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 29, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 32, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$3, "phalcon/Config/Adapter/Ini.zep", 79); ZEPHIR_MM_RESTORE(); @@ -542,7 +542,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Ini, parseIniString) ZEPHIR_INIT_VAR(&_3); zephir_substr(&_3, &path, zephir_get_intval(&_2), 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_get_strval(&path, &_3); - ZEPHIR_CALL_METHOD(&result, this_ptr, "parseinistring", NULL, 190, &path, &castValue); + ZEPHIR_CALL_METHOD(&result, this_ptr, "parseinistring", NULL, 193, &path, &castValue); zephir_check_call_status(); zephir_create_array(return_value, 1, 0); zephir_array_update_zval(return_value, &key, &result, PH_COPY); @@ -592,7 +592,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Ini, phpParseIniFile) ZVAL_BOOL(&_0, (processSections ? 1 : 0)); ZVAL_LONG(&_1, scannerMode); - ZEPHIR_RETURN_CALL_FUNCTION("parse_ini_file", NULL, 191, &filename, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("parse_ini_file", NULL, 194, &filename, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/config/adapter/json.zep.c b/ext/phalcon/config/adapter/json.zep.c index 583e5e3f7db..251f37a0859 100644 --- a/ext/phalcon/config/adapter/json.zep.c +++ b/ext/phalcon/config/adapter/json.zep.c @@ -104,7 +104,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Json, __construct) ZEPHIR_INIT_VAR(&_3); zephir_file_get_contents(&_3, &filePath); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(&_2, &_1, "__invoke", NULL, 192, &_3, &_4); + ZEPHIR_CALL_METHOD(&_2, &_1, "__invoke", NULL, 195, &_3, &_4); zephir_check_call_status(); ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_json_ce, getThis(), "__construct", &_0, 0, &_2); zephir_check_call_status(); diff --git a/ext/phalcon/config/adapter/yaml.zep.c b/ext/phalcon/config/adapter/yaml.zep.c index b89a3382196..f6635114cd0 100644 --- a/ext/phalcon/config/adapter/yaml.zep.c +++ b/ext/phalcon/config/adapter/yaml.zep.c @@ -150,7 +150,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Yaml, __construct) zephir_basename(&_5$$6, &filePath); ZEPHIR_INIT_VAR(&_6$$6); ZEPHIR_CONCAT_SVS(&_6$$6, "Configuration file ", &_5$$6, " can't be loaded"); - ZEPHIR_CALL_METHOD(NULL, &_4$$6, "__construct", NULL, 29, &_6$$6); + ZEPHIR_CALL_METHOD(NULL, &_4$$6, "__construct", NULL, 32, &_6$$6); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$6, "phalcon/Config/Adapter/Yaml.zep", 76); ZEPHIR_MM_RESTORE(); @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Yaml, phpYamlParseFile) ZEPHIR_MAKE_REF(ndocs); - ZEPHIR_RETURN_CALL_FUNCTION("yaml_parse_file", NULL, 193, filename, pos, ndocs, callbacks); + ZEPHIR_RETURN_CALL_FUNCTION("yaml_parse_file", NULL, 196, filename, pos, ndocs, callbacks); ZEPHIR_UNREF(ndocs); zephir_check_call_status(); RETURN_MM(); @@ -235,7 +235,7 @@ PHP_METHOD(Phalcon_Config_Adapter_Yaml, phpExtensionLoaded) zephir_get_strval(&name, name_param); - ZEPHIR_RETURN_CALL_FUNCTION("extension_loaded", NULL, 194, &name); + ZEPHIR_RETURN_CALL_FUNCTION("extension_loaded", NULL, 197, &name); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/config/configfactory.zep.c b/ext/phalcon/config/configfactory.zep.c index 60e49170ac9..30b3fa953d1 100644 --- a/ext/phalcon/config/configfactory.zep.c +++ b/ext/phalcon/config/configfactory.zep.c @@ -138,10 +138,10 @@ PHP_METHOD(Phalcon_Config_ConfigFactory, load) ZEPHIR_OBS_VAR(&filePath); zephir_array_fetch_string(&filePath, &configArray, SL("filePath"), PH_NOISY, "phalcon/Config/ConfigFactory.zep", 61); ZVAL_LONG(&_1, 4); - ZEPHIR_CALL_FUNCTION(&_2, "pathinfo", NULL, 85, &filePath, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "pathinfo", NULL, 88, &filePath, &_1); zephir_check_call_status(); if (1 == ZEPHIR_IS_EMPTY(&_2)) { - ZEPHIR_CALL_FUNCTION(&_3$$3, "lcfirst", NULL, 73, &adapter); + ZEPHIR_CALL_FUNCTION(&_3$$3, "lcfirst", NULL, 76, &adapter); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SV(&_4$$3, ".", &_3$$3); @@ -310,7 +310,7 @@ PHP_METHOD(Phalcon_Config_ConfigFactory, parseConfig) if (Z_TYPE_P(config) == IS_STRING) { ZEPHIR_CPY_WRT(&oldConfig, config); ZVAL_LONG(&_0$$3, 4); - ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 85, config, &_0$$3); + ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 88, config, &_0$$3); zephir_check_call_status(); if (1 == ZEPHIR_IS_EMPTY(&extension)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_config_exception_ce, "You need to provide the extension in the file path", "phalcon/Config/ConfigFactory.zep", 161); @@ -335,7 +335,7 @@ PHP_METHOD(Phalcon_Config_ConfigFactory, parseConfig) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_config_exception_ce, "Config must be array or Phalcon\\Config\\Config object", "phalcon/Config/ConfigFactory.zep", 177); return; } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkconfigarray", NULL, 195, config); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkconfigarray", NULL, 198, config); zephir_check_call_status(); RETVAL_ZVAL(config, 1, 0); RETURN_MM(); diff --git a/ext/phalcon/datamapper/pdo/connection.zep.c b/ext/phalcon/datamapper/pdo/connection.zep.c index 2ea11e7202e..3ac8346b9a1 100644 --- a/ext/phalcon/datamapper/pdo/connection.zep.c +++ b/ext/phalcon/datamapper/pdo/connection.zep.c @@ -154,7 +154,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __construct) zephir_array_fetch_long(&_2$$3, &parts, 0, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection.zep", 67); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SVS(&_3$$3, "Driver not supported [", &_2$$3, "]"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 196, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 199, &_3$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection.zep", 68); ZEPHIR_MM_RESTORE(); @@ -176,7 +176,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __construct) if (Z_TYPE_P(profiler) == IS_NULL) { ZEPHIR_INIT_NVAR(profiler); object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); - ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 197); + ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 200); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); diff --git a/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.c b/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.c index 77f9e611c01..1c1be1599f5 100644 --- a/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.c +++ b/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.c @@ -107,7 +107,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, __call) ZEPHIR_CONCAT_SVSVS(&message, "Class '", &className, "' does not have a method '", name, "'"); ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, spl_ce_BadMethodCallException); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 72, &message); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 75, &message); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 59); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/datamapper/pdo/connection/decorated.zep.c b/ext/phalcon/datamapper/pdo/connection/decorated.zep.c index 88f7063c714..d8b4e50a78b 100644 --- a/ext/phalcon/datamapper/pdo/connection/decorated.zep.c +++ b/ext/phalcon/datamapper/pdo/connection/decorated.zep.c @@ -88,7 +88,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, __construct) if (Z_TYPE_P(profiler) == IS_NULL) { ZEPHIR_INIT_NVAR(profiler); object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); - ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 197); + ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 200); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); diff --git a/ext/phalcon/datamapper/pdo/connectionlocator.zep.c b/ext/phalcon/datamapper/pdo/connectionlocator.zep.c index c057e02cdc2..115850712d7 100644 --- a/ext/phalcon/datamapper/pdo/connectionlocator.zep.c +++ b/ext/phalcon/datamapper/pdo/connectionlocator.zep.c @@ -468,7 +468,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getConnection) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, ""); if (ZEPHIR_IS_IDENTICAL(&_1, &requested)) { - ZEPHIR_CALL_FUNCTION(&requested, "array_rand", NULL, 198, &collection); + ZEPHIR_CALL_FUNCTION(&requested, "array_rand", NULL, 201, &collection); zephir_check_call_status(); } if (!(zephir_array_isset(&collection, &requested))) { @@ -476,7 +476,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getConnection) object_init_ex(&_2$$5, phalcon_datamapper_pdo_exception_connectionnotfound_ce); ZEPHIR_INIT_VAR(&_3$$5); ZEPHIR_CONCAT_SVSV(&_3$$5, "Connection not found: ", &type, ":", &requested); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 29, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 32, &_3$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$5, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 206); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/datamapper/pdo/profiler/profiler.zep.c b/ext/phalcon/datamapper/pdo/profiler/profiler.zep.c index a47d4dc6dab..a0fe84657fa 100644 --- a/ext/phalcon/datamapper/pdo/profiler/profiler.zep.c +++ b/ext/phalcon/datamapper/pdo/profiler/profiler.zep.c @@ -197,11 +197,11 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, finish) if (UNEXPECTED(zephir_is_true(&_0))) { ZEPHIR_INIT_VAR(&ex); object_init_ex(&ex, phalcon_datamapper_pdo_exception_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 29); + ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 32); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&finish, "hrtime", NULL, 199, &__$true); + ZEPHIR_CALL_FUNCTION(&finish, "hrtime", NULL, 202, &__$true); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, &ex, "gettraceasstring", NULL, 200); + ZEPHIR_CALL_METHOD(&_1$$3, &ex, "gettraceasstring", NULL, 203); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "backtrace"); @@ -436,7 +436,7 @@ PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, start) ZEPHIR_INIT_VAR(&_1$$3); zephir_create_array(&_1$$3, 2, 0); zephir_array_update_string(&_1$$3, SL("method"), &method, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_2$$3, "hrtime", NULL, 199, &__$true); + ZEPHIR_CALL_FUNCTION(&_2$$3, "hrtime", NULL, 202, &__$true); zephir_check_call_status(); zephir_array_update_string(&_1$$3, SL("start"), &_2$$3, PH_COPY | PH_SEPARATE); zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &_1$$3); diff --git a/ext/phalcon/datamapper/query/abstractconditions.zep.c b/ext/phalcon/datamapper/query/abstractconditions.zep.c index c2419460019..a0cb76d610f 100644 --- a/ext/phalcon/datamapper/query/abstractconditions.zep.c +++ b/ext/phalcon/datamapper/query/abstractconditions.zep.c @@ -937,7 +937,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, appendCondition) } zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch(&_6, &_5, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 331); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_6); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_6); zephir_check_call_status(); zephir_read_property(&_7, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch(&_8, &_7, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 333); diff --git a/ext/phalcon/datamapper/query/insert.zep.c b/ext/phalcon/datamapper/query/insert.zep.c index b9fde72beab..0c045d6080e 100644 --- a/ext/phalcon/datamapper/query/insert.zep.c +++ b/ext/phalcon/datamapper/query/insert.zep.c @@ -333,7 +333,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_Insert, getStatement) zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 113); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 201); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 204); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildreturning", NULL, 0); zephir_check_call_status(); diff --git a/ext/phalcon/datamapper/query/queryfactory.zep.c b/ext/phalcon/datamapper/query/queryfactory.zep.c index cf5f4dc5870..f3dce8216fd 100644 --- a/ext/phalcon/datamapper/query/queryfactory.zep.c +++ b/ext/phalcon/datamapper/query/queryfactory.zep.c @@ -140,7 +140,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newDelete) object_init_ex(return_value, phalcon_datamapper_query_delete_ce); ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 202, connection, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 205, connection, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -176,7 +176,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newInsert) object_init_ex(return_value, phalcon_datamapper_query_insert_ce); ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 203, connection, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 206, connection, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -263,7 +263,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newUpdate) object_init_ex(return_value, phalcon_datamapper_query_update_ce); ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 204, connection, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 207, connection, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/datamapper/query/select.zep.c b/ext/phalcon/datamapper/query/select.zep.c index 6b39c44e500..c900f169256 100644 --- a/ext/phalcon/datamapper/query/select.zep.c +++ b/ext/phalcon/datamapper/query/select.zep.c @@ -143,7 +143,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_Select, __call) object_init_ex(&_5, spl_ce_BadMethodCallException); ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SVS(&_6, "Unknown method: [", &method, "]"); - ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 72, &_6); + ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 75, &_6); zephir_check_call_status(); zephir_throw_exception_debug(&_5, "phalcon/DataMapper/Query/Select.zep", 83); ZEPHIR_MM_RESTORE(); @@ -358,12 +358,12 @@ PHP_METHOD(Phalcon_DataMapper_Query_Select, appendJoin) } zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_4, &_3, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 158); - ZEPHIR_CALL_FUNCTION(&end, "array_key_last", NULL, 36, &_4); + ZEPHIR_CALL_FUNCTION(&end, "array_key_last", NULL, 39, &_4); zephir_check_call_status(); zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_6, &_5, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); zephir_array_fetch(&_7, &_6, &end, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_7); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_7); zephir_check_call_status(); zephir_read_property(&_8, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_9, &_8, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); @@ -799,7 +799,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_Select, join) } zephir_read_property(&_19, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_20, &_19, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 316); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_20); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_20); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_21); ZEPHIR_CONCAT_VSVSV(&_21, &join, " ", &table, " ", &condition); @@ -920,7 +920,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_Select, subSelect) object_init_ex(return_value, phalcon_datamapper_query_select_ce); zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 205, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 208, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1043,9 +1043,9 @@ PHP_METHOD(Phalcon_DataMapper_Query_Select, getCurrentStatement) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, this_ptr, "buildlimitearly", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 206); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 209); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildfrom", NULL, 207); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildfrom", NULL, 210); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_6); ZVAL_STRING(&_6, "WHERE"); diff --git a/ext/phalcon/datamapper/query/update.zep.c b/ext/phalcon/datamapper/query/update.zep.c index 25295f7777b..18972f2e5fe 100644 --- a/ext/phalcon/datamapper/query/update.zep.c +++ b/ext/phalcon/datamapper/query/update.zep.c @@ -293,7 +293,7 @@ PHP_METHOD(Phalcon_DataMapper_Query_Update, getStatement) zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 101); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 208); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 211); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, "WHERE"); diff --git a/ext/phalcon/db/adapter/abstractadapter.zep.c b/ext/phalcon/db/adapter/abstractadapter.zep.c index 929fe8dc20a..a6fb48ee469 100644 --- a/ext/phalcon/db/adapter/abstractadapter.zep.c +++ b/ext/phalcon/db/adapter/abstractadapter.zep.c @@ -813,7 +813,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeIndexes) ZVAL_COPY(&indexColumns, _8); ZEPHIR_INIT_NVAR(&_12$$9); object_init_ex(&_12$$9, phalcon_db_index_ce); - ZEPHIR_CALL_METHOD(NULL, &_12$$9, "__construct", &_13, 30, &name, &indexColumns); + ZEPHIR_CALL_METHOD(NULL, &_12$$9, "__construct", &_13, 33, &name, &indexColumns); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_12$$9, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -832,7 +832,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeIndexes) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$10); object_init_ex(&_14$$10, phalcon_db_index_ce); - ZEPHIR_CALL_METHOD(NULL, &_14$$10, "__construct", &_13, 30, &name, &indexColumns); + ZEPHIR_CALL_METHOD(NULL, &_14$$10, "__construct", &_13, 33, &name, &indexColumns); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_14$$10, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); @@ -1071,7 +1071,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeReferences) ZEPHIR_OBS_NVAR(&_26$$9); zephir_array_fetch_string(&_26$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 413); zephir_array_update_string(&_25$$9, SL("referencedColumns"), &_26$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_27, 31, &name, &_25$$9); + ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_27, 34, &name, &_25$$9); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_24$$9, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1104,7 +1104,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeReferences) ZEPHIR_OBS_NVAR(&_30$$10); zephir_array_fetch_string(&_30$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 413); zephir_array_update_string(&_29$$10, SL("referencedColumns"), &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$10, "__construct", &_27, 31, &name, &_29$$10); + ZEPHIR_CALL_METHOD(NULL, &_28$$10, "__construct", &_27, 34, &name, &_29$$10); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_28$$10, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); @@ -1950,7 +1950,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDefaultIdValue) object_init_ex(return_value, phalcon_db_rawvalue_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "null"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 35, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1991,7 +1991,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDefaultValue) object_init_ex(return_value, phalcon_db_rawvalue_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "DEFAULT"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 35, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -2213,7 +2213,7 @@ PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, insert) object_init_ex(&_0$$3, phalcon_db_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZEPHIR_CONCAT_SVS(&_1$$3, "Unable to insert into ", &table, " without data"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_1$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Db/Adapter/AbstractAdapter.zep", 826); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/db/adapter/pdo/abstractpdo.zep.c b/ext/phalcon/db/adapter/pdo/abstractpdo.zep.c index bd354c9e852..0739b5826ff 100644 --- a/ext/phalcon/db/adapter/pdo/abstractpdo.zep.c +++ b/ext/phalcon/db/adapter/pdo/abstractpdo.zep.c @@ -641,7 +641,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, convertBoundParams) ZEPHIR_INIT_NVAR(&placeMatch); ZEPHIR_INIT_VAR(&_9$$3); ZVAL_STRING(&_9$$3, "?"); - ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 37, &bindPattern, &_9$$3, &sql); + ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 40, &bindPattern, &_9$$3, &sql); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&boundSql, &sql); @@ -933,7 +933,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, executePrepared) do { if (ZEPHIR_IS_LONG(&type, 1)) { ZVAL_LONG(&_6$$12, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 38, &value, &_6$$12); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 41, &value, &_6$$12); zephir_check_call_status(); break; } @@ -1114,7 +1114,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, executePrepared) do { if (ZEPHIR_IS_LONG(&type, 1)) { ZVAL_LONG(&_26$$43, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 38, &value, &_26$$43); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 41, &value, &_26$$43); zephir_check_call_status(); break; } @@ -1586,7 +1586,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, query) zephir_check_call_status(); } object_init_ex(return_value, phalcon_db_result_pdoresult_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 39, this_ptr, &statement, &sqlStatement, &bindParams, &bindTypes); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 42, this_ptr, &statement, &sqlStatement, &bindParams, &bindTypes); zephir_check_call_status(); RETURN_MM(); } @@ -1833,7 +1833,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, prepareRealSql) ZEPHIR_INIT_NVAR(&value); ZEPHIR_INIT_NVAR(&key); ZVAL_LONG(&_16$$3, 1); - ZEPHIR_CALL_FUNCTION(&result, "preg_replace", NULL, 37, &keys, &values, &statement, &_16$$3); + ZEPHIR_CALL_FUNCTION(&result, "preg_replace", NULL, 40, &keys, &values, &statement, &_16$$3); zephir_check_call_status(); } zephir_update_property_zval(this_ptr, ZEND_STRL("realSqlStatement"), &result); diff --git a/ext/phalcon/db/adapter/pdo/mysql.zep.c b/ext/phalcon/db/adapter/pdo/mysql.zep.c index d3955be56d6..65f84eecc6a 100644 --- a/ext/phalcon/db/adapter/pdo/mysql.zep.c +++ b/ext/phalcon/db/adapter/pdo/mysql.zep.c @@ -666,7 +666,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 495); ZEPHIR_INIT_NVAR(&_63$$3); object_init_ex(&_63$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_63$$3, "__construct", &_64, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_63$$3, "__construct", &_64, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_63$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 496); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -968,7 +968,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 495); ZEPHIR_INIT_NVAR(&_124$$49); object_init_ex(&_124$$49, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_124$$49, "__construct", &_64, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_124$$49, "__construct", &_64, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_124$$49, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 496); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -1200,7 +1200,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeIndexes) object_init_ex(&_28$$19, phalcon_db_index_ce); zephir_array_fetch_string(&_29$$19, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 551); zephir_array_fetch_string(&_30$$19, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 553); - ZEPHIR_CALL_METHOD(NULL, &_28$$19, "__construct", &_31, 30, &name, &_29$$19, &_30$$19); + ZEPHIR_CALL_METHOD(NULL, &_28$$19, "__construct", &_31, 33, &name, &_29$$19, &_30$$19); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_28$$19, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1221,7 +1221,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeIndexes) object_init_ex(&_32$$20, phalcon_db_index_ce); zephir_array_fetch_string(&_33$$20, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 551); zephir_array_fetch_string(&_34$$20, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 553); - ZEPHIR_CALL_METHOD(NULL, &_32$$20, "__construct", &_31, 30, &name, &_33$$20, &_34$$20); + ZEPHIR_CALL_METHOD(NULL, &_32$$20, "__construct", &_31, 33, &name, &_33$$20, &_34$$20); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_32$$20, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); @@ -1496,7 +1496,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeReferences) ZEPHIR_OBS_NVAR(&_30$$9); zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 620); zephir_array_update_string(&_29$$9, SL("onDelete"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 31, &name, &_29$$9); + ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 34, &name, &_29$$9); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_28$$9, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1535,7 +1535,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeReferences) ZEPHIR_OBS_NVAR(&_34$$10); zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 620); zephir_array_update_string(&_33$$10, SL("onDelete"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 31, &name, &_33$$10); + ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 34, &name, &_33$$10); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_32$$10, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); diff --git a/ext/phalcon/db/adapter/pdo/postgresql.zep.c b/ext/phalcon/db/adapter/pdo/postgresql.zep.c index 50586a1b2e5..4a9519c1014 100644 --- a/ext/phalcon/db/adapter/pdo/postgresql.zep.c +++ b/ext/phalcon/db/adapter/pdo/postgresql.zep.c @@ -768,13 +768,13 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) ZVAL_STRING(&_52$$38, "/^'|'?::[[:alnum:][:space:]]+$/"); ZEPHIR_INIT_NVAR(&_53$$38); ZVAL_STRING(&_53$$38, ""); - ZEPHIR_CALL_FUNCTION(&_54$$38, "preg_replace", &_55, 37, &_52$$38, &_53$$38, &_51$$38); + ZEPHIR_CALL_FUNCTION(&_54$$38, "preg_replace", &_55, 40, &_52$$38, &_53$$38, &_51$$38); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_54$$38, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_56$$38, &definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 509); ZEPHIR_INIT_NVAR(&_52$$38); ZVAL_STRING(&_52$$38, "null"); - ZEPHIR_CALL_FUNCTION(&_57$$38, "strcasecmp", &_58, 35, &_56$$38, &_52$$38); + ZEPHIR_CALL_FUNCTION(&_57$$38, "strcasecmp", &_58, 38, &_56$$38, &_52$$38); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_57$$38, 0)) { zephir_array_update_string(&definition, SL("default"), &__$null, PH_COPY | PH_SEPARATE); @@ -788,7 +788,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 524); ZEPHIR_INIT_NVAR(&_61$$3); object_init_ex(&_61$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_61$$3, "__construct", &_62, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_61$$3, "__construct", &_62, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_61$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 525); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -1066,13 +1066,13 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) ZVAL_STRING(&_111$$76, "/^'|'?::[[:alnum:][:space:]]+$/"); ZEPHIR_INIT_NVAR(&_112$$76); ZVAL_STRING(&_112$$76, ""); - ZEPHIR_CALL_FUNCTION(&_113$$76, "preg_replace", &_55, 37, &_111$$76, &_112$$76, &_110$$76); + ZEPHIR_CALL_FUNCTION(&_113$$76, "preg_replace", &_55, 40, &_111$$76, &_112$$76, &_110$$76); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_113$$76, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_114$$76, &definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 509); ZEPHIR_INIT_NVAR(&_111$$76); ZVAL_STRING(&_111$$76, "null"); - ZEPHIR_CALL_FUNCTION(&_115$$76, "strcasecmp", &_58, 35, &_114$$76, &_111$$76); + ZEPHIR_CALL_FUNCTION(&_115$$76, "strcasecmp", &_58, 38, &_114$$76, &_111$$76); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&_115$$76, 0)) { zephir_array_update_string(&definition, SL("default"), &__$null, PH_COPY | PH_SEPARATE); @@ -1087,7 +1087,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 524); ZEPHIR_INIT_NVAR(&_118$$41); object_init_ex(&_118$$41, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_118$$41, "__construct", &_62, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_118$$41, "__construct", &_62, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_118$$41, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 525); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -1362,7 +1362,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeReferences) ZEPHIR_OBS_NVAR(&_30$$9); zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 593); zephir_array_update_string(&_29$$9, SL("onDelete"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 31, &name, &_29$$9); + ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 34, &name, &_29$$9); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_28$$9, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1401,7 +1401,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeReferences) ZEPHIR_OBS_NVAR(&_34$$10); zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 593); zephir_array_update_string(&_33$$10, SL("onDelete"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 31, &name, &_33$$10); + ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 34, &name, &_33$$10); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_32$$10, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); @@ -1448,7 +1448,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, getDefaultIdValue) object_init_ex(return_value, phalcon_db_rawvalue_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "DEFAULT"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 35, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/db/adapter/pdo/sqlite.zep.c b/ext/phalcon/db/adapter/pdo/sqlite.zep.c index b6e6d53b4ec..cd7f752af75 100644 --- a/ext/phalcon/db/adapter/pdo/sqlite.zep.c +++ b/ext/phalcon/db/adapter/pdo/sqlite.zep.c @@ -436,7 +436,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) zephir_array_fetch_long(&_32$$3, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); ZEPHIR_INIT_NVAR(&_33$$3); ZVAL_STRING(&_33$$3, "null"); - ZEPHIR_CALL_FUNCTION(&_34$$3, "strcasecmp", &_35, 35, &_32$$3, &_33$$3); + ZEPHIR_CALL_FUNCTION(&_34$$3, "strcasecmp", &_35, 38, &_32$$3, &_33$$3); zephir_check_call_status(); _31$$3 = !ZEPHIR_IS_LONG_IDENTICAL(&_34$$3, 0); } @@ -446,14 +446,14 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) ZVAL_STRING(&_37$$27, "/^'|'$/"); ZEPHIR_INIT_NVAR(&_38$$27); ZVAL_STRING(&_38$$27, ""); - ZEPHIR_CALL_FUNCTION(&_39$$27, "preg_replace", &_40, 37, &_37$$27, &_38$$27, &_36$$27); + ZEPHIR_CALL_FUNCTION(&_39$$27, "preg_replace", &_40, 40, &_37$$27, &_38$$27, &_36$$27); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_39$$27, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, &field, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 306); ZEPHIR_INIT_NVAR(&_33$$3); object_init_ex(&_33$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_33$$3, "__construct", &_41, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_33$$3, "__construct", &_41, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_33$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 307); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -600,7 +600,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) zephir_array_fetch_long(&_70$$28, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); ZEPHIR_INIT_NVAR(&_71$$28); ZVAL_STRING(&_71$$28, "null"); - ZEPHIR_CALL_FUNCTION(&_72$$28, "strcasecmp", &_35, 35, &_70$$28, &_71$$28); + ZEPHIR_CALL_FUNCTION(&_72$$28, "strcasecmp", &_35, 38, &_70$$28, &_71$$28); zephir_check_call_status(); _69$$28 = !ZEPHIR_IS_LONG_IDENTICAL(&_72$$28, 0); } @@ -610,7 +610,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) ZVAL_STRING(&_74$$52, "/^'|'$/"); ZEPHIR_INIT_NVAR(&_75$$52); ZVAL_STRING(&_75$$52, ""); - ZEPHIR_CALL_FUNCTION(&_76$$52, "preg_replace", &_40, 37, &_74$$52, &_75$$52, &_73$$52); + ZEPHIR_CALL_FUNCTION(&_76$$52, "preg_replace", &_40, 40, &_74$$52, &_75$$52, &_73$$52); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_76$$52, PH_COPY | PH_SEPARATE); } @@ -618,7 +618,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) zephir_array_fetch_long(&columnName, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 306); ZEPHIR_INIT_NVAR(&_71$$28); object_init_ex(&_71$$28, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_71$$28, "__construct", &_41, 209, &columnName, &definition); + ZEPHIR_CALL_METHOD(NULL, &_71$$28, "__construct", &_41, 212, &columnName, &definition); zephir_check_call_status(); zephir_array_append(&columns, &_71$$28, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 307); ZEPHIR_CPY_WRT(&oldColumn, &columnName); @@ -950,7 +950,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) object_init_ex(&_49$$23, phalcon_db_index_ce); zephir_array_fetch_string(&_50$$23, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 374); zephir_array_fetch_string(&_51$$23, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 376); - ZEPHIR_CALL_METHOD(NULL, &_49$$23, "__construct", &_52, 30, &name, &_50$$23, &_51$$23); + ZEPHIR_CALL_METHOD(NULL, &_49$$23, "__construct", &_52, 33, &name, &_50$$23, &_51$$23); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_49$$23, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -971,7 +971,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) object_init_ex(&_53$$24, phalcon_db_index_ce); zephir_array_fetch_string(&_54$$24, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 374); zephir_array_fetch_string(&_55$$24, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 376); - ZEPHIR_CALL_METHOD(NULL, &_53$$24, "__construct", &_52, 30, &name, &_54$$24, &_55$$24); + ZEPHIR_CALL_METHOD(NULL, &_53$$24, "__construct", &_52, 33, &name, &_54$$24, &_55$$24); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, &name, &_53$$24, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); @@ -1215,7 +1215,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) ZEPHIR_OBS_NVAR(&_28$$9); zephir_array_fetch_string(&_28$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 429); zephir_array_update_string(&_27$$9, SL("referencedColumns"), &_28$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_26$$9, "__construct", &_29, 31, &name, &_27$$9); + ZEPHIR_CALL_METHOD(NULL, &_26$$9, "__construct", &_29, 34, &name, &_27$$9); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_26$$9, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -1248,7 +1248,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) ZEPHIR_OBS_NVAR(&_32$$10); zephir_array_fetch_string(&_32$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 429); zephir_array_update_string(&_31$$10, SL("referencedColumns"), &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_30$$10, "__construct", &_29, 31, &name, &_31$$10); + ZEPHIR_CALL_METHOD(NULL, &_30$$10, "__construct", &_29, 34, &name, &_31$$10); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, &name, &_30$$10, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); @@ -1294,7 +1294,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, getDefaultValue) object_init_ex(return_value, phalcon_db_rawvalue_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "NULL"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 35, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/db/adapter/pdofactory.zep.c b/ext/phalcon/db/adapter/pdofactory.zep.c index 8b139a36c8b..00468bf1a33 100644 --- a/ext/phalcon/db/adapter/pdofactory.zep.c +++ b/ext/phalcon/db/adapter/pdofactory.zep.c @@ -139,7 +139,7 @@ PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, load) array_init(&_2); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "options"); - ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 155, config, &_3, &_2); + ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 158, config, &_3, &_2); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); zephir_check_call_status(); diff --git a/ext/phalcon/db/dialect.zep.c b/ext/phalcon/db/dialect.zep.c index 16b60c5a04d..47cbe8de392 100644 --- a/ext/phalcon/db/dialect.zep.c +++ b/ext/phalcon/db/dialect.zep.c @@ -420,7 +420,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getColumnList) { ZEPHIR_INIT_NVAR(&column); ZVAL_COPY(&column, _0); - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getsqlcolumn", &_3, 40, &column, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getsqlcolumn", &_3, 43, &column, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&columns, &_2$$3, PH_SEPARATE, "phalcon/Db/Dialect.zep", 125); } ZEND_HASH_FOREACH_END(); @@ -435,7 +435,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getColumnList) } ZEPHIR_CALL_METHOD(&column, &columnList, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$4, this_ptr, "getsqlcolumn", &_3, 40, &column, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_4$$4, this_ptr, "getsqlcolumn", &_3, 43, &column, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&columns, &_4$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 125); ZEPHIR_CALL_METHOD(NULL, &columnList, "next", NULL, 0); @@ -647,17 +647,17 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) } do { if (ZEPHIR_IS_STRING(&type, "scalar")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionscalar", NULL, 41, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionscalar", NULL, 44, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "object")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionobject", NULL, 42, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionobject", NULL, 45, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "qualified")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionqualified", NULL, 43, &expression, &escapeChar); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionqualified", NULL, 46, &expression, &escapeChar); zephir_check_call_status(); RETURN_MM(); } @@ -706,34 +706,34 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) RETURN_CTOR(&_6$$8); } if (ZEPHIR_IS_STRING(&type, "binary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionbinaryoperations", NULL, 44, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionbinaryoperations", NULL, 47, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "unary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionunaryoperations", NULL, 45, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionunaryoperations", NULL, 48, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "parentheses")) { zephir_array_fetch_string(&_8$$14, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 304); - ZEPHIR_CALL_METHOD(&_7$$14, this_ptr, "getsqlexpression", NULL, 46, &_8$$14, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_7$$14, this_ptr, "getsqlexpression", NULL, 49, &_8$$14, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, "(", &_7$$14, ")"); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "functionCall")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionfunctioncall", NULL, 47, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionfunctioncall", NULL, 50, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "list")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionlist", NULL, 48, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionlist", NULL, 51, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "all")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionall", NULL, 49, &expression, &escapeChar); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionall", NULL, 52, &expression, &escapeChar); zephir_check_call_status(); RETURN_MM(); } @@ -745,17 +745,17 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "cast")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncastvalue", NULL, 50, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncastvalue", NULL, 53, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "convert")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionconvertvalue", NULL, 51, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionconvertvalue", NULL, 54, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(&type, "case")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncase", NULL, 52, &expression, &escapeChar, &bindCounts); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncase", NULL, 55, &expression, &escapeChar, &bindCounts); zephir_check_call_status(); RETURN_MM(); } @@ -765,7 +765,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) object_init_ex(&_11, phalcon_db_exception_ce); ZEPHIR_INIT_VAR(&_12); ZEPHIR_CONCAT_SVS(&_12, "Invalid SQL expression type '", &type, "'"); - ZEPHIR_CALL_METHOD(NULL, &_11, "__construct", NULL, 29, &_12); + ZEPHIR_CALL_METHOD(NULL, &_11, "__construct", NULL, 32, &_12); zephir_check_call_status(); zephir_throw_exception_debug(&_11, "phalcon/Db/Dialect.zep", 369); ZEPHIR_MM_RESTORE(); @@ -819,7 +819,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, table, &escapeChar); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 56, table, &escapeChar); zephir_check_call_status(); RETURN_MM(); } @@ -1088,12 +1088,12 @@ PHP_METHOD(Phalcon_Db_Dialect, select) } zephir_read_property(&_0, this_ptr, ZEND_STRL("escapeChar"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&escapeChar, &_0); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &columns, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 57, &columns, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_SV(&_2, " ", &_1); zephir_concat_self(&sql, &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpressionfrom", NULL, 55, &tables, &escapeChar); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpressionfrom", NULL, 58, &tables, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZEPHIR_CONCAT_SV(&_4, " ", &_3); @@ -1105,7 +1105,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) } if (_5) { zephir_array_fetch_string(&_7$$10, &definition, SL("joins"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 517); - ZEPHIR_CALL_METHOD(&_6$$10, this_ptr, "getsqlexpressionjoins", NULL, 56, &_7$$10, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_6$$10, this_ptr, "getsqlexpressionjoins", NULL, 59, &_7$$10, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_8$$10); ZEPHIR_CONCAT_SV(&_8$$10, " ", &_6$$10); @@ -1117,7 +1117,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) _9 = zephir_is_true(&where); } if (_9) { - ZEPHIR_CALL_METHOD(&_10$$11, this_ptr, "getsqlexpressionwhere", NULL, 57, &where, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_10$$11, this_ptr, "getsqlexpressionwhere", NULL, 60, &where, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_11$$11); ZEPHIR_CONCAT_SV(&_11$$11, " ", &_10$$11); @@ -1129,7 +1129,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) _12 = zephir_is_true(&groupBy); } if (_12) { - ZEPHIR_CALL_METHOD(&_13$$12, this_ptr, "getsqlexpressiongroupby", NULL, 58, &groupBy, &escapeChar); + ZEPHIR_CALL_METHOD(&_13$$12, this_ptr, "getsqlexpressiongroupby", NULL, 61, &groupBy, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_14$$12); ZEPHIR_CONCAT_SV(&_14$$12, " ", &_13$$12); @@ -1141,7 +1141,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) _15 = zephir_is_true(&having); } if (_15) { - ZEPHIR_CALL_METHOD(&_16$$13, this_ptr, "getsqlexpressionhaving", NULL, 59, &having, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_16$$13, this_ptr, "getsqlexpressionhaving", NULL, 62, &having, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_17$$13); ZEPHIR_CONCAT_SV(&_17$$13, " ", &_16$$13); @@ -1153,7 +1153,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) _18 = zephir_is_true(&orderBy); } if (_18) { - ZEPHIR_CALL_METHOD(&_19$$14, this_ptr, "getsqlexpressionorderby", NULL, 60, &orderBy, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_19$$14, this_ptr, "getsqlexpressionorderby", NULL, 63, &orderBy, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_20$$14); ZEPHIR_CONCAT_SV(&_20$$14, " ", &_19$$14); @@ -1169,7 +1169,7 @@ PHP_METHOD(Phalcon_Db_Dialect, select) zephir_create_array(&_22$$15, 2, 0); zephir_array_update_string(&_22$$15, SL("sql"), &sql, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_22$$15, SL("value"), &limit, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sql, this_ptr, "getsqlexpressionlimit", NULL, 61, &_22$$15, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&sql, this_ptr, "getsqlexpressionlimit", NULL, 64, &_22$$15, &escapeChar, &bindCounts); zephir_check_call_status(); } _23 = zephir_array_isset_string_fetch(&forUpdate, &definition, SL("forUpdate"), 1); @@ -1447,7 +1447,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations) ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 660); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 49, &_1, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_2, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 665); ZEPHIR_CONCAT_VSVSV(return_value, &left, " ", &_2, " ", &right); @@ -1543,17 +1543,17 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCase) zephir_array_fetch_string(&_6$$3, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 685); if (ZEPHIR_IS_STRING(&_6$$3, "when")) { zephir_array_fetch_string(&_8$$4, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 687); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "getsqlexpression", NULL, 46, &_8$$4, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "getsqlexpression", NULL, 49, &_8$$4, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_10$$4, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 689); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "getsqlexpression", NULL, 46, &_10$$4, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "getsqlexpression", NULL, 49, &_10$$4, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_11$$4); ZEPHIR_CONCAT_SVSV(&_11$$4, " WHEN ", &_7$$4, " THEN ", &_9$$4); zephir_concat_self(&sql, &_11$$4); } else { zephir_array_fetch_string(&_13$$5, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 691); - ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "getsqlexpression", NULL, 46, &_13$$5, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "getsqlexpression", NULL, 49, &_13$$5, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$5); ZEPHIR_CONCAT_SV(&_14$$5, " ELSE ", &_12$$5); @@ -1574,17 +1574,17 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCase) zephir_array_fetch_string(&_15$$6, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 685); if (ZEPHIR_IS_STRING(&_15$$6, "when")) { zephir_array_fetch_string(&_17$$7, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 687); - ZEPHIR_CALL_METHOD(&_16$$7, this_ptr, "getsqlexpression", NULL, 46, &_17$$7, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_16$$7, this_ptr, "getsqlexpression", NULL, 49, &_17$$7, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_19$$7, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 689); - ZEPHIR_CALL_METHOD(&_18$$7, this_ptr, "getsqlexpression", NULL, 46, &_19$$7, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_18$$7, this_ptr, "getsqlexpression", NULL, 49, &_19$$7, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_20$$7); ZEPHIR_CONCAT_SVSV(&_20$$7, " WHEN ", &_16$$7, " THEN ", &_18$$7); zephir_concat_self(&sql, &_20$$7); } else { zephir_array_fetch_string(&_22$$8, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 691); - ZEPHIR_CALL_METHOD(&_21$$8, this_ptr, "getsqlexpression", NULL, 46, &_22$$8, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_21$$8, this_ptr, "getsqlexpression", NULL, 49, &_22$$8, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_23$$8); ZEPHIR_CONCAT_SV(&_23$$8, " ELSE ", &_21$$8); @@ -1655,7 +1655,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue) ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 718); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 49, &_1, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "CAST(", &left, " AS ", &right, ")"); RETURN_MM(); @@ -1717,7 +1717,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue) ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 746); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 49, &_1, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "CONVERT(", &left, " USING ", &right, ")"); RETURN_MM(); @@ -1771,7 +1771,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom) { ZEPHIR_INIT_NVAR(&table); ZVAL_COPY(&table, _0$$3); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqltable", &_3, 62, &table, &escapeChar); + ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqltable", &_3, 65, &table, &escapeChar); zephir_check_call_status(); zephir_array_append(&tables, &_2$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 765); } ZEND_HASH_FOREACH_END(); @@ -1786,7 +1786,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom) } ZEPHIR_CALL_METHOD(&table, expression, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqltable", &_3, 62, &table, &escapeChar); + ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqltable", &_3, 65, &table, &escapeChar); zephir_check_call_status(); zephir_array_append(&tables, &_4$$5, PH_SEPARATE, "phalcon/Db/Dialect.zep", 765); ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); @@ -1984,7 +1984,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/Db/Dialect.zep", 834); return; } - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getsqlexpression", &_3, 46, &field, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getsqlexpression", &_3, 49, &field, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&fields, &_4$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); @@ -2153,7 +2153,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) { ZEPHIR_INIT_NVAR(&condition); ZVAL_COPY(&condition, _4$$6); - ZEPHIR_CALL_METHOD(&_6$$7, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_6$$7, this_ptr, "getsqlexpression", &_3, 49, &condition, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&joinCondition, &_6$$7, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); } ZEND_HASH_FOREACH_END(); @@ -2168,7 +2168,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) } ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "getsqlexpression", &_3, 49, &condition, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&joinCondition, &_7$$8, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); @@ -2193,7 +2193,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) zephir_concat_self_str(&joinType, SL(" ")); } zephir_array_fetch_string(&_10$$3, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 913); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 62, &_10$$3, &escapeChar); + ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 65, &_10$$3, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_12$$3); ZEPHIR_CONCAT_SVSVSV(&_12$$3, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); @@ -2217,7 +2217,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) } if (_13$$11) { if (!(zephir_array_isset_long(&joinConditionsArray, 0))) { - ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 46, &joinConditionsArray, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 49, &joinConditionsArray, &escapeChar, &bindCounts); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&joinCondition); @@ -2228,7 +2228,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) { ZEPHIR_INIT_NVAR(&condition); ZVAL_COPY(&condition, _14$$14); - ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "getsqlexpression", &_3, 49, &condition, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&joinCondition, &_16$$15, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); } ZEND_HASH_FOREACH_END(); @@ -2243,7 +2243,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) } ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_17$$16, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_17$$16, this_ptr, "getsqlexpression", &_3, 49, &condition, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&joinCondition, &_17$$16, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); @@ -2268,7 +2268,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) zephir_concat_self_str(&joinType, SL(" ")); } zephir_array_fetch_string(&_20$$11, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 913); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 62, &_20$$11, &escapeChar); + ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 65, &_20$$11, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_21$$11); ZEPHIR_CONCAT_SVSVSV(&_21$$11, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); @@ -2364,7 +2364,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit) _2$$4 = Z_TYPE_P(&offset) == IS_ARRAY; } if (_2$$4) { - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "getsqlexpression", NULL, 46, &offset, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "getsqlexpression", NULL, 49, &offset, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_CPY_WRT(&offset, &_3$$7); } @@ -2479,7 +2479,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList) } ZEPHIR_CALL_METHOD(&item, &values, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "getsqlexpression", &_5, 46, &item, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "getsqlexpression", &_5, 49, &item, &escapeChar, &bindCounts); zephir_check_call_status(); zephir_array_append(&items, &_6$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 993); ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); @@ -2684,7 +2684,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy) return; } zephir_array_fetch_long(&_6$$7, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1053); - ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 46, &_6$$7, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 49, &_6$$7, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&type); _7$$7 = zephir_array_isset_long_fetch(&type, &field, 1, 0); @@ -2810,7 +2810,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar) if (zephir_array_isset_string(&expression, SL("column"))) { zephir_array_fetch_string(&_0$$3, &expression, SL("column"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1107); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlcolumn", NULL, 40, &_0$$3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlcolumn", NULL, 43, &_0$$3); zephir_check_call_status(); RETURN_MM(); } @@ -2892,7 +2892,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations) ZEPHIR_OBS_VAR(&right); if (zephir_array_isset_string_fetch(&right, &expression, SL("right"), 0)) { zephir_array_fetch_string(&_2$$4, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1145); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "getsqlexpression", NULL, 46, &right, &escapeChar, &bindCounts); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "getsqlexpression", NULL, 49, &right, &escapeChar, &bindCounts); zephir_check_call_status(); ZEPHIR_CONCAT_VSV(return_value, &_2$$4, " ", &_3$$4); RETURN_MM(); @@ -3009,7 +3009,7 @@ PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias) if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "escape", NULL, 53, &alias, &escapeChar); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "escape", NULL, 56, &alias, &escapeChar); zephir_check_call_status(); ZEPHIR_CONCAT_VSV(return_value, &qualified, " AS ", &_0$$3); RETURN_MM(); @@ -3077,18 +3077,18 @@ PHP_METHOD(Phalcon_Db_Dialect, prepareTable) } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 53, &table, &escapeChar); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 56, &table, &escapeChar); zephir_check_call_status(); zephir_get_strval(&table, &_0); if (!ZEPHIR_IS_STRING(&schema, "")) { - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "escapeschema", NULL, 63, &schema, &escapeChar); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "escapeschema", NULL, 66, &schema, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_VSV(&_2$$3, &_1$$3, ".", &table); zephir_get_strval(&table, &_2$$3); } if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "escape", NULL, 53, &alias, &escapeChar); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "escape", NULL, 56, &alias, &escapeChar); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4$$4); ZEPHIR_CONCAT_VSV(&_4$$4, &table, " AS ", &_3$$4); @@ -3149,11 +3149,11 @@ PHP_METHOD(Phalcon_Db_Dialect, prepareQualified) if (!ZEPHIR_IS_STRING(&domain, "")) { ZEPHIR_INIT_VAR(&_0$$3); ZEPHIR_CONCAT_VSV(&_0$$3, &domain, ".", &column); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, &_0$$3, &escapeChar); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 56, &_0$$3, &escapeChar); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, &column, &escapeChar); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 56, &column, &escapeChar); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/db/dialect/mysql.zep.c b/ext/phalcon/db/dialect/mysql.zep.c index 8b0f3ee1f9a..14c6e3f33b1 100644 --- a/ext/phalcon/db/dialect/mysql.zep.c +++ b/ext/phalcon/db/dialect/mysql.zep.c @@ -143,7 +143,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addColumn) } _8$$5 = _7$$5; if (!(_8$$5)) { - ZEPHIR_CALL_FUNCTION(&_9$$5, "is_float", NULL, 210, &defaultValue); + ZEPHIR_CALL_FUNCTION(&_9$$5, "is_float", NULL, 213, &defaultValue); zephir_check_call_status(); _8$$5 = zephir_is_true(&_9$$5); } @@ -154,7 +154,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addColumn) } else { ZEPHIR_INIT_VAR(&_11$$7); ZVAL_STRING(&_11$$7, "\""); - ZEPHIR_CALL_FUNCTION(&_12$$7, "addcslashes", NULL, 211, &defaultValue, &_11$$7); + ZEPHIR_CALL_FUNCTION(&_12$$7, "addcslashes", NULL, 214, &defaultValue, &_11$$7); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_13$$7); ZEPHIR_CONCAT_SVS(&_13$$7, " DEFAULT \"", &_12$$7, "\""); @@ -262,7 +262,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addForeignKey) } ZEPHIR_CALL_METHOD(&_6, reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 57, &_6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_8, reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); @@ -272,7 +272,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addForeignKey) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_11, reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "getcolumnlist", NULL, 54, &_11); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "getcolumnlist", NULL, 57, &_11); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_12); ZEPHIR_CONCAT_SVSVSVS(&_12, " FOREIGN KEY (", &_5, ") REFERENCES ", &_7, "(", &_10, ")"); @@ -367,7 +367,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addIndex) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_5, index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getcolumnlist", NULL, 54, &_5); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "getcolumnlist", NULL, 57, &_5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SVSVS(&_6, "`", &_3, "` (", &_4, ")"); @@ -428,7 +428,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, addPrimaryKey) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &_2); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 57, &_2); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " ADD PRIMARY KEY (", &_1, ")"); RETURN_MM(); @@ -642,7 +642,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } _11$$10 = _10$$10; if (!(_11$$10)) { - ZEPHIR_CALL_FUNCTION(&_12$$10, "is_float", &_13, 210, &defaultValue); + ZEPHIR_CALL_FUNCTION(&_12$$10, "is_float", &_13, 213, &defaultValue); zephir_check_call_status(); _11$$10 = zephir_is_true(&_12$$10); } @@ -653,7 +653,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } else { ZEPHIR_INIT_NVAR(&_15$$12); ZVAL_STRING(&_15$$12, "\""); - ZEPHIR_CALL_FUNCTION(&_16$$12, "addcslashes", &_17, 211, &defaultValue, &_15$$12); + ZEPHIR_CALL_FUNCTION(&_16$$12, "addcslashes", &_17, 214, &defaultValue, &_15$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_18$$12); ZEPHIR_CONCAT_SVS(&_18$$12, " DEFAULT \"", &_16$$12, "\""); @@ -722,7 +722,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } _30$$19 = _29$$19; if (!(_30$$19)) { - ZEPHIR_CALL_FUNCTION(&_31$$19, "is_float", &_13, 210, &defaultValue); + ZEPHIR_CALL_FUNCTION(&_31$$19, "is_float", &_13, 213, &defaultValue); zephir_check_call_status(); _30$$19 = zephir_is_true(&_31$$19); } @@ -733,7 +733,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } else { ZEPHIR_INIT_NVAR(&_33$$21); ZVAL_STRING(&_33$$21, "\""); - ZEPHIR_CALL_FUNCTION(&_34$$21, "addcslashes", &_17, 211, &defaultValue, &_33$$21); + ZEPHIR_CALL_FUNCTION(&_34$$21, "addcslashes", &_17, 214, &defaultValue, &_33$$21); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_35$$21); ZEPHIR_CONCAT_SVS(&_35$$21, " DEFAULT \"", &_34$$21, "\""); @@ -780,7 +780,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { ZEPHIR_CALL_METHOD(&_44$$27, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_43$$27, this_ptr, "getcolumnlist", &_45, 54, &_44$$27); + ZEPHIR_CALL_METHOD(&_43$$27, this_ptr, "getcolumnlist", &_45, 57, &_44$$27); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_46$$27); ZEPHIR_CONCAT_SVS(&_46$$27, "PRIMARY KEY (", &_43$$27, ")"); @@ -789,7 +789,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) if (!(ZEPHIR_IS_EMPTY(&indexType))) { ZEPHIR_CALL_METHOD(&_48$$29, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_47$$29, this_ptr, "getcolumnlist", &_45, 54, &_48$$29); + ZEPHIR_CALL_METHOD(&_47$$29, this_ptr, "getcolumnlist", &_45, 57, &_48$$29); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_49$$29); ZEPHIR_CONCAT_VSVSVS(&_49$$29, &indexType, " KEY `", &indexName, "` (", &_47$$29, ")"); @@ -797,7 +797,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } else { ZEPHIR_CALL_METHOD(&_51$$30, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_50$$30, this_ptr, "getcolumnlist", &_45, 54, &_51$$30); + ZEPHIR_CALL_METHOD(&_50$$30, this_ptr, "getcolumnlist", &_45, 57, &_51$$30); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_52$$30); ZEPHIR_CONCAT_SVSVS(&_52$$30, "KEY `", &indexName, "` (", &_50$$30, ")"); @@ -824,7 +824,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { ZEPHIR_CALL_METHOD(&_54$$32, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_53$$32, this_ptr, "getcolumnlist", &_45, 54, &_54$$32); + ZEPHIR_CALL_METHOD(&_53$$32, this_ptr, "getcolumnlist", &_45, 57, &_54$$32); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_55$$32); ZEPHIR_CONCAT_SVS(&_55$$32, "PRIMARY KEY (", &_53$$32, ")"); @@ -833,7 +833,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) if (!(ZEPHIR_IS_EMPTY(&indexType))) { ZEPHIR_CALL_METHOD(&_57$$34, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_56$$34, this_ptr, "getcolumnlist", &_45, 54, &_57$$34); + ZEPHIR_CALL_METHOD(&_56$$34, this_ptr, "getcolumnlist", &_45, 57, &_57$$34); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_58$$34); ZEPHIR_CONCAT_VSVSVS(&_58$$34, &indexType, " KEY `", &indexName, "` (", &_56$$34, ")"); @@ -841,7 +841,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) } else { ZEPHIR_CALL_METHOD(&_60$$35, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_59$$35, this_ptr, "getcolumnlist", &_45, 54, &_60$$35); + ZEPHIR_CALL_METHOD(&_59$$35, this_ptr, "getcolumnlist", &_45, 57, &_60$$35); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_61$$35); ZEPHIR_CONCAT_SVSVS(&_61$$35, "KEY `", &indexName, "` (", &_59$$35, ")"); @@ -867,7 +867,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_66$$37, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_65$$37, this_ptr, "getcolumnlist", &_45, 54, &_66$$37); + ZEPHIR_CALL_METHOD(&_65$$37, this_ptr, "getcolumnlist", &_45, 57, &_66$$37); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_68$$37, &reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); @@ -877,7 +877,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_71$$37, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_70$$37, this_ptr, "getcolumnlist", &_45, 54, &_71$$37); + ZEPHIR_CALL_METHOD(&_70$$37, this_ptr, "getcolumnlist", &_45, 57, &_71$$37); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_72$$37); ZEPHIR_CONCAT_SVSVSSVSVS(&_72$$37, "CONSTRAINT `", &_64$$37, "` FOREIGN KEY (", &_65$$37, ")", " REFERENCES ", &_67$$37, " (", &_70$$37, ")"); @@ -913,7 +913,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_77$$40, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_76$$40, this_ptr, "getcolumnlist", &_45, 54, &_77$$40); + ZEPHIR_CALL_METHOD(&_76$$40, this_ptr, "getcolumnlist", &_45, 57, &_77$$40); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_79$$40, &reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); @@ -923,7 +923,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_82$$40, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_81$$40, this_ptr, "getcolumnlist", &_45, 54, &_82$$40); + ZEPHIR_CALL_METHOD(&_81$$40, this_ptr, "getcolumnlist", &_45, 57, &_82$$40); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_83$$40); ZEPHIR_CONCAT_SVSVSSVSVS(&_83$$40, "CONSTRAINT `", &_75$$40, "` FOREIGN KEY (", &_76$$40, ")", " REFERENCES ", &_78$$40, " (", &_81$$40, ")"); @@ -1635,7 +1635,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getcolumnsize", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_VV(&_2$$3, &_0$$3, &_1$$3); @@ -1697,7 +1697,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_7$$18, this_ptr, "getcolumnsizeandscale", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$18, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_8$$18, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$18); ZEPHIR_CONCAT_VV(&_9$$18, &_7$$18, &_8$$18); @@ -1708,9 +1708,9 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) if (ZEPHIR_IS_EMPTY(&columnSql)) { zephir_concat_self_str(&columnSql, SL("DOUBLE")); } - ZEPHIR_CALL_METHOD(&_10$$20, this_ptr, "checkcolumnsizeandscale", NULL, 213, column); + ZEPHIR_CALL_METHOD(&_10$$20, this_ptr, "checkcolumnsizeandscale", NULL, 216, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_11$$20, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_11$$20, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_12$$20); ZEPHIR_CONCAT_VV(&_12$$20, &_10$$20, &_11$$20); @@ -1730,9 +1730,9 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) if (ZEPHIR_IS_EMPTY(&columnSql)) { zephir_concat_self_str(&columnSql, SL("FLOAT")); } - ZEPHIR_CALL_METHOD(&_14$$24, this_ptr, "checkcolumnsizeandscale", NULL, 213, column); + ZEPHIR_CALL_METHOD(&_14$$24, this_ptr, "checkcolumnsizeandscale", NULL, 216, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_15$$24, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_15$$24, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_16$$24); ZEPHIR_CONCAT_VV(&_16$$24, &_14$$24, &_15$$24); @@ -1745,7 +1745,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_17$$26, this_ptr, "getcolumnsize", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_18$$26, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_18$$26, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_19$$26); ZEPHIR_CONCAT_VV(&_19$$26, &_17$$26, &_18$$26); @@ -1782,7 +1782,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_20$$36, this_ptr, "getcolumnsize", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_21$$36, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_21$$36, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_22$$36); ZEPHIR_CONCAT_VV(&_22$$36, &_20$$36, &_21$$36); @@ -1801,7 +1801,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_23$$40, this_ptr, "getcolumnsize", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24$$40, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_24$$40, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_25$$40); ZEPHIR_CONCAT_VV(&_25$$40, &_23$$40, &_24$$40); @@ -1852,7 +1852,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } ZEPHIR_CALL_METHOD(&_30$$52, this_ptr, "getcolumnsize", NULL, 0, column); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_31$$52, this_ptr, "checkcolumnunsigned", NULL, 212, column); + ZEPHIR_CALL_METHOD(&_31$$52, this_ptr, "checkcolumnunsigned", NULL, 215, column); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_32$$52); ZEPHIR_CONCAT_VV(&_32$$52, &_30$$52, &_31$$52); @@ -1881,7 +1881,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_36$$59); ZEPHIR_CONCAT_SV(&_36$$59, "Unrecognized MySQL data type at column ", &_35$$59); - ZEPHIR_CALL_METHOD(NULL, &_34$$59, "__construct", NULL, 29, &_36$$59); + ZEPHIR_CALL_METHOD(NULL, &_34$$59, "__construct", NULL, 32, &_36$$59); zephir_check_call_status(); zephir_throw_exception_debug(&_34$$59, "phalcon/Db/Dialect/Mysql.zep", 635); ZEPHIR_MM_RESTORE(); @@ -1901,7 +1901,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) ZVAL_COPY(&value$$61, _37$$61); ZEPHIR_INIT_NVAR(&_39$$62); ZVAL_STRING(&_39$$62, "\""); - ZEPHIR_CALL_FUNCTION(&_40$$62, "addcslashes", &_41, 211, &value$$61, &_39$$62); + ZEPHIR_CALL_FUNCTION(&_40$$62, "addcslashes", &_41, 214, &value$$61, &_39$$62); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_42$$62); ZEPHIR_CONCAT_SVS(&_42$$62, "\"", &_40$$62, "\", "); @@ -1920,7 +1920,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_43$$63); ZVAL_STRING(&_43$$63, "\""); - ZEPHIR_CALL_FUNCTION(&_44$$63, "addcslashes", &_41, 211, &value$$61, &_43$$63); + ZEPHIR_CALL_FUNCTION(&_44$$63, "addcslashes", &_41, 214, &value$$61, &_43$$63); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_45$$63); ZEPHIR_CONCAT_SVS(&_45$$63, "\"", &_44$$63, "\", "); @@ -1940,7 +1940,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) } else { ZEPHIR_INIT_VAR(&_50$$64); ZVAL_STRING(&_50$$64, "\""); - ZEPHIR_CALL_FUNCTION(&_51$$64, "addcslashes", &_41, 211, &typeValues, &_50$$64); + ZEPHIR_CALL_FUNCTION(&_51$$64, "addcslashes", &_41, 214, &typeValues, &_50$$64); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_52$$64); ZEPHIR_CONCAT_SVS(&_52$$64, "(\"", &_51$$64, "\")"); @@ -2187,7 +2187,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, modifyColumn) } _13$$8 = _12$$8; if (!(_13$$8)) { - ZEPHIR_CALL_FUNCTION(&_14$$8, "is_float", NULL, 210, &defaultValue); + ZEPHIR_CALL_FUNCTION(&_14$$8, "is_float", NULL, 213, &defaultValue); zephir_check_call_status(); _13$$8 = zephir_is_true(&_14$$8); } @@ -2198,7 +2198,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, modifyColumn) } else { ZEPHIR_INIT_VAR(&_16$$10); ZVAL_STRING(&_16$$10, "\""); - ZEPHIR_CALL_FUNCTION(&_17$$10, "addcslashes", NULL, 211, &defaultValue, &_16$$10); + ZEPHIR_CALL_FUNCTION(&_17$$10, "addcslashes", NULL, 214, &defaultValue, &_16$$10); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_18$$10); ZEPHIR_CONCAT_SVS(&_18$$10, " DEFAULT \"", &_17$$10, "\""); diff --git a/ext/phalcon/db/dialect/postgresql.zep.c b/ext/phalcon/db/dialect/postgresql.zep.c index e1a5f44f113..3a1cf209e2c 100644 --- a/ext/phalcon/db/dialect/postgresql.zep.c +++ b/ext/phalcon/db/dialect/postgresql.zep.c @@ -210,13 +210,13 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addForeignKey) } ZEPHIR_CALL_METHOD(&_6, reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 57, &_6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_9, reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "getcolumnlist", NULL, 54, &_9); + ZEPHIR_CALL_METHOD(&_8, this_ptr, "getcolumnlist", NULL, 57, &_9); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_10); ZEPHIR_CONCAT_SVSSVSVS(&_10, " FOREIGN KEY (", &_5, ")", " REFERENCES \"", &_7, "\" (", &_8, ")"); @@ -319,7 +319,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addIndex) zephir_concat_self(&sql, &_4); ZEPHIR_CALL_METHOD(&_6, index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 57, &_6); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_7); ZEPHIR_CONCAT_SVS(&_7, " (", &_5, ")"); @@ -380,7 +380,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addPrimaryKey) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &_2); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 57, &_2); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVSVS(return_value, "ALTER TABLE ", &_0, " ADD CONSTRAINT \"", &tableName, "_PRIMARY\" PRIMARY KEY (", &_1, ")"); RETURN_MM(); @@ -674,7 +674,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) } ZEPHIR_INIT_NVAR(&column); if (!(ZEPHIR_IS_EMPTY(&primaryColumns))) { - ZEPHIR_CALL_METHOD(&_30$$19, this_ptr, "getcolumnlist", NULL, 54, &primaryColumns); + ZEPHIR_CALL_METHOD(&_30$$19, this_ptr, "getcolumnlist", NULL, 57, &primaryColumns); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_31$$19); ZEPHIR_CONCAT_SVS(&_31$$19, "PRIMARY KEY (", &_30$$19, ")"); @@ -696,7 +696,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { ZEPHIR_CALL_METHOD(&_35$$22, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_34$$22, this_ptr, "getcolumnlist", NULL, 54, &_35$$22); + ZEPHIR_CALL_METHOD(&_34$$22, this_ptr, "getcolumnlist", NULL, 57, &_35$$22); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_36$$22); ZEPHIR_CONCAT_SVS(&_36$$22, "CONSTRAINT \"PRIMARY\" PRIMARY KEY (", &_34$$22, ")"); @@ -705,7 +705,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) if (!(ZEPHIR_IS_EMPTY(&indexType))) { ZEPHIR_CALL_METHOD(&_38$$24, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_37$$24, this_ptr, "getcolumnlist", NULL, 54, &_38$$24); + ZEPHIR_CALL_METHOD(&_37$$24, this_ptr, "getcolumnlist", NULL, 57, &_38$$24); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_39$$24); ZEPHIR_CONCAT_SVSVSVS(&_39$$24, "CONSTRAINT \"", &indexName, "\" ", &indexType, " (", &_37$$24, ")"); @@ -720,7 +720,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_concat_self(&indexSqlAfterCreate, &_42$$25); ZEPHIR_CALL_METHOD(&_44$$25, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_43$$25, this_ptr, "getcolumnlist", NULL, 54, &_44$$25); + ZEPHIR_CALL_METHOD(&_43$$25, this_ptr, "getcolumnlist", NULL, 57, &_44$$25); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_45$$25); ZEPHIR_CONCAT_SVS(&_45$$25, " (", &_43$$25, ");"); @@ -750,7 +750,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { ZEPHIR_CALL_METHOD(&_47$$28, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_46$$28, this_ptr, "getcolumnlist", NULL, 54, &_47$$28); + ZEPHIR_CALL_METHOD(&_46$$28, this_ptr, "getcolumnlist", NULL, 57, &_47$$28); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_48$$28); ZEPHIR_CONCAT_SVS(&_48$$28, "CONSTRAINT \"PRIMARY\" PRIMARY KEY (", &_46$$28, ")"); @@ -759,7 +759,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) if (!(ZEPHIR_IS_EMPTY(&indexType))) { ZEPHIR_CALL_METHOD(&_50$$30, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_49$$30, this_ptr, "getcolumnlist", NULL, 54, &_50$$30); + ZEPHIR_CALL_METHOD(&_49$$30, this_ptr, "getcolumnlist", NULL, 57, &_50$$30); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_51$$30); ZEPHIR_CONCAT_SVSVSVS(&_51$$30, "CONSTRAINT \"", &indexName, "\" ", &indexType, " (", &_49$$30, ")"); @@ -774,7 +774,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_concat_self(&indexSqlAfterCreate, &_54$$31); ZEPHIR_CALL_METHOD(&_56$$31, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_55$$31, this_ptr, "getcolumnlist", NULL, 54, &_56$$31); + ZEPHIR_CALL_METHOD(&_55$$31, this_ptr, "getcolumnlist", NULL, 57, &_56$$31); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_57$$31); ZEPHIR_CONCAT_SVS(&_57$$31, " (", &_55$$31, ");"); @@ -802,7 +802,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_62$$34, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_61$$34, this_ptr, "getcolumnlist", NULL, 54, &_62$$34); + ZEPHIR_CALL_METHOD(&_61$$34, this_ptr, "getcolumnlist", NULL, 57, &_62$$34); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_63$$34); ZEPHIR_CONCAT_SVSVS(&_63$$34, "CONSTRAINT \"", &_60$$34, "\" FOREIGN KEY (", &_61$$34, ") REFERENCES "); @@ -814,7 +814,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_concat_self(&referenceSql, &_64$$34); ZEPHIR_CALL_METHOD(&_67$$34, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_66$$34, this_ptr, "getcolumnlist", NULL, 54, &_67$$34); + ZEPHIR_CALL_METHOD(&_66$$34, this_ptr, "getcolumnlist", NULL, 57, &_67$$34); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_68$$34); ZEPHIR_CONCAT_SVS(&_68$$34, " (", &_66$$34, ")"); @@ -850,7 +850,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_73$$37, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_72$$37, this_ptr, "getcolumnlist", NULL, 54, &_73$$37); + ZEPHIR_CALL_METHOD(&_72$$37, this_ptr, "getcolumnlist", NULL, 57, &_73$$37); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_74$$37); ZEPHIR_CONCAT_SVSVS(&_74$$37, "CONSTRAINT \"", &_71$$37, "\" FOREIGN KEY (", &_72$$37, ") REFERENCES "); @@ -862,7 +862,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) zephir_concat_self(&referenceSql, &_75$$37); ZEPHIR_CALL_METHOD(&_78$$37, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_77$$37, this_ptr, "getcolumnlist", NULL, 54, &_78$$37); + ZEPHIR_CALL_METHOD(&_77$$37, this_ptr, "getcolumnlist", NULL, 57, &_78$$37); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_79$$37); ZEPHIR_CONCAT_SVS(&_79$$37, " (", &_77$$37, ")"); @@ -1638,7 +1638,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_7$$36); ZEPHIR_CONCAT_SV(&_7$$36, "Unrecognized PostgreSQL data type at column ", &_6$$36); - ZEPHIR_CALL_METHOD(NULL, &_5$$36, "__construct", NULL, 29, &_7$$36); + ZEPHIR_CALL_METHOD(NULL, &_5$$36, "__construct", NULL, 32, &_7$$36); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$36, "phalcon/Db/Dialect/Postgresql.zep", 511); ZEPHIR_MM_RESTORE(); @@ -1657,7 +1657,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) ZVAL_COPY(&value$$38, _8$$38); ZEPHIR_INIT_NVAR(&_10$$39); ZVAL_STRING(&_10$$39, "\'"); - ZEPHIR_CALL_FUNCTION(&_11$$39, "addcslashes", &_12, 211, &value$$38, &_10$$39); + ZEPHIR_CALL_FUNCTION(&_11$$39, "addcslashes", &_12, 214, &value$$38, &_10$$39); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_13$$39); ZEPHIR_CONCAT_SVS(&_13$$39, "'", &_11$$39, "', "); @@ -1676,7 +1676,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$40); ZVAL_STRING(&_14$$40, "\'"); - ZEPHIR_CALL_FUNCTION(&_15$$40, "addcslashes", &_12, 211, &value$$38, &_14$$40); + ZEPHIR_CALL_FUNCTION(&_15$$40, "addcslashes", &_12, 214, &value$$38, &_14$$40); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_16$$40); ZEPHIR_CONCAT_SVS(&_16$$40, "'", &_15$$40, "', "); @@ -1696,7 +1696,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) } else { ZEPHIR_INIT_VAR(&_21$$41); ZVAL_STRING(&_21$$41, "\'"); - ZEPHIR_CALL_FUNCTION(&_22$$41, "addcslashes", &_12, 211, &typeValues, &_21$$41); + ZEPHIR_CALL_FUNCTION(&_22$$41, "addcslashes", &_12, 214, &typeValues, &_21$$41); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_23$$41); ZEPHIR_CONCAT_SVS(&_23$$41, "('", &_22$$41, "')"); @@ -2305,7 +2305,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, castDefault) } else { ZEPHIR_INIT_VAR(&_7$$6); ZVAL_STRING(&_7$$6, "\'"); - ZEPHIR_CALL_FUNCTION(&_8$$6, "addcslashes", NULL, 211, &defaultValue, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_8$$6, "addcslashes", NULL, 214, &defaultValue, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$6); ZEPHIR_CONCAT_SVS(&_9$$6, "'", &_8$$6, "'"); diff --git a/ext/phalcon/db/dialect/sqlite.zep.c b/ext/phalcon/db/dialect/sqlite.zep.c index a35e44a2f3b..854d7298336 100644 --- a/ext/phalcon/db/dialect/sqlite.zep.c +++ b/ext/phalcon/db/dialect/sqlite.zep.c @@ -129,7 +129,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addColumn) } else { ZEPHIR_INIT_VAR(&_7$$5); ZVAL_STRING(&_7$$5, "\""); - ZEPHIR_CALL_FUNCTION(&_8$$5, "addcslashes", NULL, 211, &defaultValue, &_7$$5); + ZEPHIR_CALL_FUNCTION(&_8$$5, "addcslashes", NULL, 214, &defaultValue, &_7$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$5); ZEPHIR_CONCAT_SVS(&_9$$5, " DEFAULT \"", &_8$$5, "\""); @@ -281,7 +281,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addIndex) } ZEPHIR_CALL_METHOD(&_6, index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 57, &_6); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_7); ZEPHIR_CONCAT_SVSVS(&_7, " ON \"", &tableName, "\" (", &_5, ")"); @@ -533,7 +533,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) } else { ZEPHIR_INIT_NVAR(&_13$$12); ZVAL_STRING(&_13$$12, "\""); - ZEPHIR_CALL_FUNCTION(&_14$$12, "addcslashes", &_15, 211, &defaultValue, &_13$$12); + ZEPHIR_CALL_FUNCTION(&_14$$12, "addcslashes", &_15, 214, &defaultValue, &_13$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_16$$12); ZEPHIR_CONCAT_SVS(&_16$$12, " DEFAULT \"", &_14$$12, "\""); @@ -597,7 +597,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) } else { ZEPHIR_INIT_NVAR(&_26$$20); ZVAL_STRING(&_26$$20, "\""); - ZEPHIR_CALL_FUNCTION(&_27$$20, "addcslashes", &_15, 211, &defaultValue, &_26$$20); + ZEPHIR_CALL_FUNCTION(&_27$$20, "addcslashes", &_15, 214, &defaultValue, &_26$$20); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_28$$20); ZEPHIR_CONCAT_SVS(&_28$$20, " DEFAULT \"", &_27$$20, "\""); @@ -642,7 +642,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) if (_32$$24) { ZEPHIR_CALL_METHOD(&_36$$25, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_35$$25, this_ptr, "getcolumnlist", &_37, 54, &_36$$25); + ZEPHIR_CALL_METHOD(&_35$$25, this_ptr, "getcolumnlist", &_37, 57, &_36$$25); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_38$$25); ZEPHIR_CONCAT_SVS(&_38$$25, "PRIMARY KEY (", &_35$$25, ")"); @@ -650,7 +650,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) } else if (_33$$24) { ZEPHIR_CALL_METHOD(&_40$$26, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_39$$26, this_ptr, "getcolumnlist", &_37, 54, &_40$$26); + ZEPHIR_CALL_METHOD(&_39$$26, this_ptr, "getcolumnlist", &_37, 57, &_40$$26); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_41$$26); ZEPHIR_CONCAT_SVS(&_41$$26, "UNIQUE (", &_39$$26, ")"); @@ -685,7 +685,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) if (_42$$27) { ZEPHIR_CALL_METHOD(&_46$$28, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_45$$28, this_ptr, "getcolumnlist", &_37, 54, &_46$$28); + ZEPHIR_CALL_METHOD(&_45$$28, this_ptr, "getcolumnlist", &_37, 57, &_46$$28); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_47$$28); ZEPHIR_CONCAT_SVS(&_47$$28, "PRIMARY KEY (", &_45$$28, ")"); @@ -693,7 +693,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) } else if (_43$$27) { ZEPHIR_CALL_METHOD(&_49$$29, &index, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_48$$29, this_ptr, "getcolumnlist", &_37, 54, &_49$$29); + ZEPHIR_CALL_METHOD(&_48$$29, this_ptr, "getcolumnlist", &_37, 57, &_49$$29); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_50$$29); ZEPHIR_CONCAT_SVS(&_50$$29, "UNIQUE (", &_48$$29, ")"); @@ -717,13 +717,13 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_55$$31, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_54$$31, this_ptr, "getcolumnlist", &_37, 54, &_55$$31); + ZEPHIR_CALL_METHOD(&_54$$31, this_ptr, "getcolumnlist", &_37, 57, &_55$$31); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_56$$31, &reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_58$$31, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_57$$31, this_ptr, "getcolumnlist", &_37, 54, &_58$$31); + ZEPHIR_CALL_METHOD(&_57$$31, this_ptr, "getcolumnlist", &_37, 57, &_58$$31); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&referenceSql); ZEPHIR_CONCAT_SVSVSSVSVS(&referenceSql, "CONSTRAINT `", &_53$$31, "` FOREIGN KEY (", &_54$$31, ")", " REFERENCES `", &_56$$31, "`(", &_57$$31, ")"); @@ -758,13 +758,13 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_63$$34, &reference, "getcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_62$$34, this_ptr, "getcolumnlist", &_37, 54, &_63$$34); + ZEPHIR_CALL_METHOD(&_62$$34, this_ptr, "getcolumnlist", &_37, 57, &_63$$34); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_64$$34, &reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_66$$34, &reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_65$$34, this_ptr, "getcolumnlist", &_37, 54, &_66$$34); + ZEPHIR_CALL_METHOD(&_65$$34, this_ptr, "getcolumnlist", &_37, 57, &_66$$34); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&referenceSql); ZEPHIR_CONCAT_SVSVSSVSVS(&referenceSql, "CONSTRAINT `", &_61$$34, "` FOREIGN KEY (", &_62$$34, ")", " REFERENCES `", &_64$$34, "`(", &_65$$34, ")"); @@ -1594,7 +1594,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_7$$38); ZEPHIR_CONCAT_SV(&_7$$38, "Unrecognized SQLite data type at column ", &_6$$38); - ZEPHIR_CALL_METHOD(NULL, &_5$$38, "__construct", NULL, 29, &_7$$38); + ZEPHIR_CALL_METHOD(NULL, &_5$$38, "__construct", NULL, 32, &_7$$38); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$38, "phalcon/Db/Dialect/Sqlite.zep", 520); ZEPHIR_MM_RESTORE(); @@ -1614,7 +1614,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) ZVAL_COPY(&value$$40, _8$$40); ZEPHIR_INIT_NVAR(&_10$$41); ZVAL_STRING(&_10$$41, "\""); - ZEPHIR_CALL_FUNCTION(&_11$$41, "addcslashes", &_12, 211, &value$$40, &_10$$41); + ZEPHIR_CALL_FUNCTION(&_11$$41, "addcslashes", &_12, 214, &value$$40, &_10$$41); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_13$$41); ZEPHIR_CONCAT_SVS(&_13$$41, "\"", &_11$$41, "\", "); @@ -1633,7 +1633,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$42); ZVAL_STRING(&_14$$42, "\""); - ZEPHIR_CALL_FUNCTION(&_15$$42, "addcslashes", &_12, 211, &value$$40, &_14$$42); + ZEPHIR_CALL_FUNCTION(&_15$$42, "addcslashes", &_12, 214, &value$$40, &_14$$42); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_16$$42); ZEPHIR_CONCAT_SVS(&_16$$42, "\"", &_15$$42, "\", "); @@ -1653,7 +1653,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) } else { ZEPHIR_INIT_VAR(&_21$$43); ZVAL_STRING(&_21$$43, "\""); - ZEPHIR_CALL_FUNCTION(&_22$$43, "addcslashes", &_12, 211, &typeValues, &_21$$43); + ZEPHIR_CALL_FUNCTION(&_22$$43, "addcslashes", &_12, 214, &typeValues, &_21$$43); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_23$$43); ZEPHIR_CONCAT_SVS(&_23$$43, "(\"", &_22$$43, "\")"); @@ -1724,13 +1724,13 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listIndexesSql) } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 53, &table); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 56, &table); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SVS(&_1, "SELECT sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ", &_0, " COLLATE NOCASE"); zephir_get_strval(&sql, &_1); if (!(ZEPHIR_IS_EMPTY(&keyName))) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "escape", NULL, 53, &keyName); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "escape", NULL, 56, &keyName); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SVS(&_3$$3, " AND name = ", &_2$$3, " COLLATE NOCASE"); diff --git a/ext/phalcon/db/profiler.zep.c b/ext/phalcon/db/profiler.zep.c index 131ce9144c9..5ada31d421f 100644 --- a/ext/phalcon/db/profiler.zep.c +++ b/ext/phalcon/db/profiler.zep.c @@ -267,15 +267,15 @@ PHP_METHOD(Phalcon_Db_Profiler, startProfile) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlstatement", NULL, 214, &sqlStatement); + ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlstatement", NULL, 217, &sqlStatement); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlvariables", NULL, 215, &sqlVariables); + ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlvariables", NULL, 218, &sqlVariables); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlbindtypes", NULL, 216, &sqlBindTypes); + ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlbindtypes", NULL, 219, &sqlBindTypes); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "hrtime", NULL, 199, &__$true); + ZEPHIR_CALL_FUNCTION(&_0, "hrtime", NULL, 202, &__$true); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setinitialtime", NULL, 217, &_0); + ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setinitialtime", NULL, 220, &_0); zephir_check_call_status(); if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("beforestartprofile")) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "beforestartprofile", NULL, 0, &activeProfile); @@ -307,7 +307,7 @@ PHP_METHOD(Phalcon_Db_Profiler, stopProfile) zephir_read_property(&_0, this_ptr, ZEND_STRL("activeProfile"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&activeProfile, &_0); - ZEPHIR_CALL_FUNCTION(&_1, "hrtime", NULL, 199, &__$true); + ZEPHIR_CALL_FUNCTION(&_1, "hrtime", NULL, 202, &__$true); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setfinaltime", NULL, 0, &_1); zephir_check_call_status(); diff --git a/ext/phalcon/di/di.zep.c b/ext/phalcon/di/di.zep.c index 1992b1116be..89549cbe8cd 100644 --- a/ext/phalcon/di/di.zep.c +++ b/ext/phalcon/di/di.zep.c @@ -179,7 +179,7 @@ PHP_METHOD(Phalcon_Di_Di, __call) ZVAL_LONG(&_0$$3, 3); ZEPHIR_INIT_VAR(&_1$$3); zephir_substr(&_1$$3, &method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_FUNCTION(&possibleService, "lcfirst", NULL, 73, &_1$$3); + ZEPHIR_CALL_FUNCTION(&possibleService, "lcfirst", NULL, 76, &_1$$3); zephir_check_call_status(); zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset(&_2$$3, &possibleService)) { @@ -194,7 +194,7 @@ PHP_METHOD(Phalcon_Di_Di, __call) ZVAL_LONG(&_3$$6, 3); ZEPHIR_INIT_VAR(&_4$$6); zephir_substr(&_4$$6, &method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_FUNCTION(&_5$$6, "lcfirst", NULL, 73, &_4$$6); + ZEPHIR_CALL_FUNCTION(&_5$$6, "lcfirst", NULL, 76, &_4$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_5$$6, &definition); zephir_check_call_status(); @@ -205,7 +205,7 @@ PHP_METHOD(Phalcon_Di_Di, __call) object_init_ex(&_6, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(&_7); ZEPHIR_CONCAT_SVS(&_7, "Call to undefined method or service '", &method, "'"); - ZEPHIR_CALL_METHOD(NULL, &_6, "__construct", NULL, 29, &_7); + ZEPHIR_CALL_METHOD(NULL, &_6, "__construct", NULL, 32, &_7); zephir_check_call_status(); zephir_throw_exception_debug(&_6, "phalcon/Di/Di.zep", 147); ZEPHIR_MM_RESTORE(); @@ -273,7 +273,7 @@ PHP_METHOD(Phalcon_Di_Di, attempt) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 74, definition, &_2); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 77, definition, &_2); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("services"), &name, &_1); zephir_read_property(&_3, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); @@ -395,7 +395,7 @@ PHP_METHOD(Phalcon_Di_Di, get) object_init_ex(&_10$$9, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(&_11$$9); ZEPHIR_CONCAT_SVS(&_11$$9, "Service '", &name, "' cannot be resolved"); - ZEPHIR_CALL_METHOD(NULL, &_10$$9, "__construct", NULL, 29, &_11$$9); + ZEPHIR_CALL_METHOD(NULL, &_10$$9, "__construct", NULL, 32, &_11$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$9, "phalcon/Di/Di.zep", 210); ZEPHIR_MM_RESTORE(); @@ -411,7 +411,7 @@ PHP_METHOD(Phalcon_Di_Di, get) object_init_ex(&_12$$12, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(&_13$$12); ZEPHIR_CONCAT_SVS(&_13$$12, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_12$$12, "__construct", NULL, 29, &_13$$12); + ZEPHIR_CALL_METHOD(NULL, &_12$$12, "__construct", NULL, 32, &_13$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_12$$12, "phalcon/Di/Di.zep", 225); ZEPHIR_MM_RESTORE(); @@ -528,7 +528,7 @@ PHP_METHOD(Phalcon_Di_Di, getRaw) object_init_ex(&_1$$3, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Di/Di.zep", 295); ZEPHIR_MM_RESTORE(); @@ -583,7 +583,7 @@ PHP_METHOD(Phalcon_Di_Di, getService) object_init_ex(&_1$$3, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Di/Di.zep", 311); ZEPHIR_MM_RESTORE(); @@ -813,7 +813,7 @@ PHP_METHOD(Phalcon_Di_Di, loadFromPhp) ZEPHIR_INIT_VAR(&services); object_init_ex(&services, phalcon_config_adapter_php_ce); - ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 75, &filePath); + ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 78, &filePath); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "loadfromconfig", NULL, 0, &services); zephir_check_call_status(); @@ -895,7 +895,7 @@ PHP_METHOD(Phalcon_Di_Di, loadFromYaml) ZEPHIR_INIT_VAR(&services); object_init_ex(&services, phalcon_config_adapter_yaml_ce); - ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 76, &filePath, &callbacks); + ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 79, &filePath, &callbacks); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "loadfromconfig", NULL, 0, &services); zephir_check_call_status(); @@ -1227,7 +1227,7 @@ PHP_METHOD(Phalcon_Di_Di, set) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 74, definition, &_1); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 77, definition, &_1); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("services"), &name, &_0); zephir_read_property(&_2, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); diff --git a/ext/phalcon/di/factorydefault.zep.c b/ext/phalcon/di/factorydefault.zep.c index 3905f6b2102..d06fd4f61e6 100644 --- a/ext/phalcon/di/factorydefault.zep.c +++ b/ext/phalcon/di/factorydefault.zep.c @@ -81,7 +81,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -98,7 +98,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) zephir_array_fast_append(&_6, &_7); zephir_array_update_string(&_5, SL("arguments"), &_6, PH_COPY | PH_SEPARATE); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_5, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_5, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("assets"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -106,7 +106,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Encryption\\Crypt"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("crypt"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -114,7 +114,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Http\\Response\\Cookies"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("cookies"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -122,7 +122,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Dispatcher"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -130,7 +130,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Html\\Escaper"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -138,7 +138,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -146,7 +146,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Flash\\Direct"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("flash"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -154,15 +154,15 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Flash\\Session"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("flashSession"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_CALL_METHOD(&_8, &filter, "newinstance", NULL, 90); + ZEPHIR_CALL_METHOD(&_8, &filter, "newinstance", NULL, 93); zephir_check_call_status(); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_8, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_8, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -170,7 +170,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Support\\HelperFactory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("helper"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -178,7 +178,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -186,7 +186,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -194,7 +194,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Http\\Request"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("request"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -202,7 +202,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Http\\Response"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("response"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -210,7 +210,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Router"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -218,7 +218,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Encryption\\Security"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -235,7 +235,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) zephir_array_fast_append(&_7, &_9); zephir_array_update_string(&_6, SL("arguments"), &_7, PH_COPY | PH_SEPARATE); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_6, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_6, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("tag"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -243,7 +243,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -251,7 +251,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Url"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("url"), &_2, PH_COPY | PH_SEPARATE); zephir_update_property_zval(this_ptr, ZEND_STRL("services"), &_1); diff --git a/ext/phalcon/di/factorydefault/cli.zep.c b/ext/phalcon/di/factorydefault/cli.zep.c index ec2e6c0008c..d951e82ce06 100644 --- a/ext/phalcon/di/factorydefault/cli.zep.c +++ b/ext/phalcon/di/factorydefault/cli.zep.c @@ -82,7 +82,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -90,7 +90,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Cli\\Dispatcher"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -98,7 +98,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Html\\Escaper"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -106,15 +106,15 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_CALL_METHOD(&_5, &filter, "newinstance", NULL, 90); + ZEPHIR_CALL_METHOD(&_5, &filter, "newinstance", NULL, 93); zephir_check_call_status(); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_5, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_5, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -122,7 +122,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Support\\HelperFactory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("helper"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -130,7 +130,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -138,7 +138,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -146,7 +146,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Cli\\Router"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -154,7 +154,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Encryption\\Security"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -171,7 +171,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) zephir_array_fast_append(&_7, &_8); zephir_array_update_string(&_6, SL("arguments"), &_7, PH_COPY | PH_SEPARATE); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_6, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_6, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("tag"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_2); @@ -179,7 +179,7 @@ PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 77, &_3, &_4); zephir_check_call_status(); zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); zephir_update_property_zval(this_ptr, ZEND_STRL("services"), &_1); diff --git a/ext/phalcon/di/service.zep.c b/ext/phalcon/di/service.zep.c index 17094a8ae1f..25ab60712b4 100644 --- a/ext/phalcon/di/service.zep.c +++ b/ext/phalcon/di/service.zep.c @@ -295,7 +295,7 @@ PHP_METHOD(Phalcon_Di_Service, resolve) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&instance, &builder, "build", NULL, 218, container, &definition, parameters); + ZEPHIR_CALL_METHOD(&instance, &builder, "build", NULL, 221, container, &definition, parameters); zephir_check_call_status(); } else { found = 0; @@ -305,7 +305,7 @@ PHP_METHOD(Phalcon_Di_Service, resolve) if (UNEXPECTED(found == 0)) { ZEPHIR_INIT_VAR(&_5$$20); object_init_ex(&_5$$20, phalcon_di_exception_serviceresolutionexception_ce); - ZEPHIR_CALL_METHOD(NULL, &_5$$20, "__construct", NULL, 29); + ZEPHIR_CALL_METHOD(NULL, &_5$$20, "__construct", NULL, 32); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$20, "phalcon/Di/Service.zep", 202); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/di/service/builder.zep.c b/ext/phalcon/di/service/builder.zep.c index cfe6c086e93..1e0de1604ee 100644 --- a/ext/phalcon/di/service/builder.zep.c +++ b/ext/phalcon/di/service/builder.zep.c @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) } else { ZEPHIR_OBS_VAR(&arguments); if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 0)) { - ZEPHIR_CALL_METHOD(&_0$$8, this_ptr, "buildparameters", NULL, 219, container, &arguments); + ZEPHIR_CALL_METHOD(&_0$$8, this_ptr, "buildparameters", NULL, 222, container, &arguments); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &className, &_0$$8); @@ -190,7 +190,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_5$$14, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_6$$14); ZEPHIR_CONCAT_SV(&_6$$14, "Method call must be an array on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_5$$14, "__construct", &_7, 29, &_6$$14); + ZEPHIR_CALL_METHOD(NULL, &_5$$14, "__construct", &_7, 32, &_6$$14); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$14, "phalcon/Di/Service/Builder.zep", 97); ZEPHIR_MM_RESTORE(); @@ -202,7 +202,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_8$$15, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_9$$15); ZEPHIR_CONCAT_SV(&_9$$15, "The method name is required on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_8$$15, "__construct", &_7, 29, &_9$$15); + ZEPHIR_CALL_METHOD(NULL, &_8$$15, "__construct", &_7, 32, &_9$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_8$$15, "phalcon/Di/Service/Builder.zep", 106); ZEPHIR_MM_RESTORE(); @@ -220,7 +220,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) zephir_cast_to_string(&_11$$17, &methodPosition); ZEPHIR_INIT_NVAR(&_12$$17); ZEPHIR_CONCAT_SV(&_12$$17, "Call arguments must be an array on position ", &_11$$17); - ZEPHIR_CALL_METHOD(NULL, &_10$$17, "__construct", &_7, 29, &_12$$17); + ZEPHIR_CALL_METHOD(NULL, &_10$$17, "__construct", &_7, 32, &_12$$17); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$17, "phalcon/Di/Service/Builder.zep", 119); ZEPHIR_MM_RESTORE(); @@ -228,7 +228,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) } if (zephir_fast_count_int(&arguments)) { ZEPHIR_INIT_NVAR(&_13$$18); - ZEPHIR_CALL_METHOD(&_14$$18, this_ptr, "buildparameters", NULL, 219, container, &arguments); + ZEPHIR_CALL_METHOD(&_14$$18, this_ptr, "buildparameters", NULL, 222, container, &arguments); zephir_check_call_status(); ZEPHIR_CALL_USER_FUNC_ARRAY(&_13$$18, &methodCall, &_14$$18); zephir_check_call_status(); @@ -257,7 +257,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_16$$20, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_17$$20); ZEPHIR_CONCAT_SV(&_17$$20, "Method call must be an array on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_16$$20, "__construct", &_7, 29, &_17$$20); + ZEPHIR_CALL_METHOD(NULL, &_16$$20, "__construct", &_7, 32, &_17$$20); zephir_check_call_status(); zephir_throw_exception_debug(&_16$$20, "phalcon/Di/Service/Builder.zep", 97); ZEPHIR_MM_RESTORE(); @@ -269,7 +269,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_18$$21, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_19$$21); ZEPHIR_CONCAT_SV(&_19$$21, "The method name is required on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_18$$21, "__construct", &_7, 29, &_19$$21); + ZEPHIR_CALL_METHOD(NULL, &_18$$21, "__construct", &_7, 32, &_19$$21); zephir_check_call_status(); zephir_throw_exception_debug(&_18$$21, "phalcon/Di/Service/Builder.zep", 106); ZEPHIR_MM_RESTORE(); @@ -288,7 +288,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) zephir_cast_to_string(&_22$$23, &methodPosition); ZEPHIR_INIT_NVAR(&_23$$23); ZEPHIR_CONCAT_SV(&_23$$23, "Call arguments must be an array on position ", &_22$$23); - ZEPHIR_CALL_METHOD(NULL, &_21$$23, "__construct", &_7, 29, &_23$$23); + ZEPHIR_CALL_METHOD(NULL, &_21$$23, "__construct", &_7, 32, &_23$$23); zephir_check_call_status(); zephir_throw_exception_debug(&_21$$23, "phalcon/Di/Service/Builder.zep", 119); ZEPHIR_MM_RESTORE(); @@ -296,7 +296,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) } if (zephir_fast_count_int(&arguments)) { ZEPHIR_INIT_NVAR(&_24$$24); - ZEPHIR_CALL_METHOD(&_25$$24, this_ptr, "buildparameters", NULL, 219, container, &arguments); + ZEPHIR_CALL_METHOD(&_25$$24, this_ptr, "buildparameters", NULL, 222, container, &arguments); zephir_check_call_status(); ZEPHIR_CALL_USER_FUNC_ARRAY(&_24$$24, &methodCall, &_25$$24); zephir_check_call_status(); @@ -340,7 +340,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_31$$29, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_32$$29); ZEPHIR_CONCAT_SV(&_32$$29, "Property must be an array on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_31$$29, "__construct", &_7, 29, &_32$$29); + ZEPHIR_CALL_METHOD(NULL, &_31$$29, "__construct", &_7, 32, &_32$$29); zephir_check_call_status(); zephir_throw_exception_debug(&_31$$29, "phalcon/Di/Service/Builder.zep", 171); ZEPHIR_MM_RESTORE(); @@ -352,7 +352,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_33$$30, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_34$$30); ZEPHIR_CONCAT_SV(&_34$$30, "The property name is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_33$$30, "__construct", &_7, 29, &_34$$30); + ZEPHIR_CALL_METHOD(NULL, &_33$$30, "__construct", &_7, 32, &_34$$30); zephir_check_call_status(); zephir_throw_exception_debug(&_33$$30, "phalcon/Di/Service/Builder.zep", 180); ZEPHIR_MM_RESTORE(); @@ -364,13 +364,13 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_35$$31, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_36$$31); ZEPHIR_CONCAT_SV(&_36$$31, "The property value is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_35$$31, "__construct", &_7, 29, &_36$$31); + ZEPHIR_CALL_METHOD(NULL, &_35$$31, "__construct", &_7, 32, &_36$$31); zephir_check_call_status(); zephir_throw_exception_debug(&_35$$31, "phalcon/Di/Service/Builder.zep", 189); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_37$$28, this_ptr, "buildparameter", &_38, 220, container, &propertyPosition, &propertyValue); + ZEPHIR_CALL_METHOD(&_37$$28, this_ptr, "buildparameter", &_38, 223, container, &propertyPosition, &propertyValue); zephir_check_call_status(); zephir_update_property_zval_zval(&instance, &propertyName, &_37$$28); } ZEND_HASH_FOREACH_END(); @@ -392,7 +392,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_39$$33, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_40$$33); ZEPHIR_CONCAT_SV(&_40$$33, "Property must be an array on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_39$$33, "__construct", &_7, 29, &_40$$33); + ZEPHIR_CALL_METHOD(NULL, &_39$$33, "__construct", &_7, 32, &_40$$33); zephir_check_call_status(); zephir_throw_exception_debug(&_39$$33, "phalcon/Di/Service/Builder.zep", 171); ZEPHIR_MM_RESTORE(); @@ -404,7 +404,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_41$$34, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_42$$34); ZEPHIR_CONCAT_SV(&_42$$34, "The property name is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_41$$34, "__construct", &_7, 29, &_42$$34); + ZEPHIR_CALL_METHOD(NULL, &_41$$34, "__construct", &_7, 32, &_42$$34); zephir_check_call_status(); zephir_throw_exception_debug(&_41$$34, "phalcon/Di/Service/Builder.zep", 180); ZEPHIR_MM_RESTORE(); @@ -416,13 +416,13 @@ PHP_METHOD(Phalcon_Di_Service_Builder, build) object_init_ex(&_43$$35, phalcon_di_exception_ce); ZEPHIR_INIT_NVAR(&_44$$35); ZEPHIR_CONCAT_SV(&_44$$35, "The property value is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_43$$35, "__construct", &_7, 29, &_44$$35); + ZEPHIR_CALL_METHOD(NULL, &_43$$35, "__construct", &_7, 32, &_44$$35); zephir_check_call_status(); zephir_throw_exception_debug(&_43$$35, "phalcon/Di/Service/Builder.zep", 189); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "buildparameter", &_38, 220, container, &propertyPosition, &propertyValue); + ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "buildparameter", &_38, 223, container, &propertyPosition, &propertyValue); zephir_check_call_status(); zephir_update_property_zval_zval(&instance, &propertyName, &_45$$32); ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "next", NULL, 0); @@ -494,7 +494,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) ZVAL_LONG(&_1$$3, position); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Argument at position ", &_1$$3, " must have a type"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Di/Service/Builder.zep", 221); ZEPHIR_MM_RESTORE(); @@ -510,7 +510,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) ZVAL_LONG(&_4$$5, position); ZEPHIR_INIT_VAR(&_5$$5); ZEPHIR_CONCAT_SV(&_5$$5, "Service 'name' is required in parameter on position ", &_4$$5); - ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 29, &_5$$5); + ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 32, &_5$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$5, "phalcon/Di/Service/Builder.zep", 233); ZEPHIR_MM_RESTORE(); @@ -529,7 +529,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) ZVAL_LONG(&_7$$7, position); ZEPHIR_INIT_VAR(&_8$$7); ZEPHIR_CONCAT_SV(&_8$$7, "Service 'value' is required in parameter on position ", &_7$$7); - ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", NULL, 29, &_8$$7); + ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", NULL, 32, &_8$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$7, "phalcon/Di/Service/Builder.zep", 245); ZEPHIR_MM_RESTORE(); @@ -546,7 +546,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) ZVAL_LONG(&_10$$9, position); ZEPHIR_INIT_VAR(&_11$$9); ZEPHIR_CONCAT_SV(&_11$$9, "Service 'className' is required in parameter on position ", &_10$$9); - ZEPHIR_CALL_METHOD(NULL, &_9$$9, "__construct", NULL, 29, &_11$$9); + ZEPHIR_CALL_METHOD(NULL, &_9$$9, "__construct", NULL, 32, &_11$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_9$$9, "phalcon/Di/Service/Builder.zep", 257); ZEPHIR_MM_RESTORE(); @@ -568,7 +568,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) ZVAL_LONG(&_13$$11, position); ZEPHIR_INIT_VAR(&_14$$11); ZEPHIR_CONCAT_SV(&_14$$11, "Unknown service type in parameter on position ", &_13$$11); - ZEPHIR_CALL_METHOD(NULL, &_12$$11, "__construct", NULL, 29, &_14$$11); + ZEPHIR_CALL_METHOD(NULL, &_12$$11, "__construct", NULL, 32, &_14$$11); zephir_check_call_status(); zephir_throw_exception_debug(&_12$$11, "phalcon/Di/Service/Builder.zep", 279); ZEPHIR_MM_RESTORE(); @@ -628,7 +628,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameters) } ZEPHIR_INIT_NVAR(&argument); ZVAL_COPY(&argument, _0); - ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "buildparameter", &_5, 220, container, &position, &argument); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "buildparameter", &_5, 223, container, &position, &argument); zephir_check_call_status(); zephir_array_append(&buildArguments, &_4$$3, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 298); } ZEND_HASH_FOREACH_END(); @@ -645,7 +645,7 @@ PHP_METHOD(Phalcon_Di_Service_Builder, buildParameters) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&argument, &arguments, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "buildparameter", &_5, 220, container, &position, &argument); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "buildparameter", &_5, 223, container, &position, &argument); zephir_check_call_status(); zephir_array_append(&buildArguments, &_6$$4, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 298); ZEPHIR_CALL_METHOD(NULL, &arguments, "next", NULL, 0); diff --git a/ext/phalcon/dispatcher/abstractdispatcher.zep.c b/ext/phalcon/dispatcher/abstractdispatcher.zep.c index 607f2dd197f..0b3be11809e 100644 --- a/ext/phalcon/dispatcher/abstractdispatcher.zep.c +++ b/ext/phalcon/dispatcher/abstractdispatcher.zep.c @@ -487,7 +487,7 @@ PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, dispatch) } break; } - ZEPHIR_CALL_FUNCTION(&handlerHash, "spl_object_hash", &_35, 77, &handler); + ZEPHIR_CALL_FUNCTION(&handlerHash, "spl_object_hash", &_35, 80, &handler); zephir_check_call_status(); zephir_read_property(&_36$$10, this_ptr, ZEND_STRL("handlerHashes"), PH_NOISY_CC | PH_READONLY); isNewHandler = !((zephir_array_isset(&_36$$10, &handlerHash))); @@ -1093,7 +1093,7 @@ PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getActiveMethod) zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "tocamelcase", NULL, 0, &_3$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&activeMethodName, "lcfirst", NULL, 73, &_2$$3); + ZEPHIR_CALL_FUNCTION(&activeMethodName, "lcfirst", NULL, 76, &_2$$3); zephir_check_call_status(); ZEPHIR_OBS_VAR(&_4$$3); zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC); @@ -2014,11 +2014,11 @@ PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, toCamelCase) if (!(zephir_array_isset_fetch(&camelCaseInput, &_0, &input, 0))) { ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "/[_-]+/"); - ZEPHIR_CALL_FUNCTION(&_2$$3, "preg_split", NULL, 67, &_1$$3, &input); + ZEPHIR_CALL_FUNCTION(&_2$$3, "preg_split", NULL, 70, &_1$$3, &input); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1$$3); ZVAL_STRING(&_1$$3, "ucfirst"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "array_map", NULL, 66, &_1$$3, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "array_map", NULL, 69, &_1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&camelCaseInput); zephir_fast_join_str(&camelCaseInput, SL(""), &_3$$3); diff --git a/ext/phalcon/encryption/crypt.zep.c b/ext/phalcon/encryption/crypt.zep.c index d47dd1a007b..ae94cc65a00 100644 --- a/ext/phalcon/encryption/crypt.zep.c +++ b/ext/phalcon/encryption/crypt.zep.c @@ -194,7 +194,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, __construct) if (Z_TYPE_P(padFactory) == IS_NULL) { ZEPHIR_INIT_NVAR(padFactory); object_init_ex(padFactory, phalcon_encryption_crypt_padfactory_ce); - ZEPHIR_CALL_METHOD(NULL, padFactory, "__construct", NULL, 221); + ZEPHIR_CALL_METHOD(NULL, padFactory, "__construct", NULL, 224); zephir_check_call_status(); } zephir_update_property_zval(this_ptr, ZEND_STRL("padFactory"), padFactory); @@ -303,14 +303,14 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decrypt) ZVAL_STRING(&_1, "cipher"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkcipherhashisavailable", NULL, 0, &cipher, &_1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&mode, this_ptr, "getmode", NULL, 222); + ZEPHIR_CALL_METHOD(&mode, this_ptr, "getmode", NULL, 225); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&blockSize, this_ptr, "getblocksize", NULL, 223, &mode); + ZEPHIR_CALL_METHOD(&blockSize, this_ptr, "getblocksize", NULL, 226, &mode); zephir_check_call_status(); ZVAL_LONG(&_0, 0); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "8bit"); - ZEPHIR_CALL_FUNCTION(&iv, "mb_substr", NULL, 224, &input, &_0, &ivLength, &_1); + ZEPHIR_CALL_FUNCTION(&iv, "mb_substr", NULL, 227, &input, &_0, &ivLength, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(&digest); ZVAL_STRING(&digest, ""); @@ -320,24 +320,24 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decrypt) if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { ZEPHIR_INIT_VAR(&_2$$5); ZVAL_STRING(&_2$$5, ""); - ZEPHIR_CALL_FUNCTION(&_3$$5, "hash", NULL, 68, &hashAlgorithm, &_2$$5, &__$true); + ZEPHIR_CALL_FUNCTION(&_3$$5, "hash", NULL, 71, &hashAlgorithm, &_2$$5, &__$true); zephir_check_call_status(); ZEPHIR_INIT_VAR(&hashLength); ZVAL_LONG(&hashLength, zephir_fast_strlen_ev(&_3$$5)); ZEPHIR_INIT_NVAR(&_2$$5); ZVAL_STRING(&_2$$5, "8bit"); - ZEPHIR_CALL_FUNCTION(&digest, "mb_substr", NULL, 224, &input, &ivLength, &hashLength, &_2$$5); + ZEPHIR_CALL_FUNCTION(&digest, "mb_substr", NULL, 227, &input, &ivLength, &hashLength, &_2$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4$$5); zephir_add_function(&_4$$5, &ivLength, &hashLength); ZEPHIR_INIT_NVAR(&_2$$5); ZVAL_STRING(&_2$$5, "8bit"); - ZEPHIR_CALL_FUNCTION(&cipherText, "mb_substr", NULL, 224, &input, &_4$$5, &__$null, &_2$$5); + ZEPHIR_CALL_FUNCTION(&cipherText, "mb_substr", NULL, 227, &input, &_4$$5, &__$null, &_2$$5); zephir_check_call_status(); } else { ZEPHIR_INIT_VAR(&_5$$6); ZVAL_STRING(&_5$$6, "8bit"); - ZEPHIR_CALL_FUNCTION(&cipherText, "mb_substr", NULL, 224, &input, &ivLength, &__$null, &_5$$6); + ZEPHIR_CALL_FUNCTION(&cipherText, "mb_substr", NULL, 227, &input, &ivLength, &__$null, &_5$$6); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&decrypted, this_ptr, "decryptgcmccmauth", NULL, 0, &mode, &cipherText, &decryptKey, &iv); @@ -348,7 +348,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decrypt) ZEPHIR_CPY_WRT(&decrypted, &_6); zephir_read_property(&_7, this_ptr, ZEND_STRL("useSigning"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_7)) { - ZEPHIR_CALL_FUNCTION(&_8$$7, "hash_hmac", NULL, 225, &hashAlgorithm, &padded, &decryptKey, &__$true); + ZEPHIR_CALL_FUNCTION(&_8$$7, "hash_hmac", NULL, 228, &hashAlgorithm, &padded, &decryptKey, &__$true); zephir_check_call_status(); if (!ZEPHIR_IS_IDENTICAL(&digest, &_8$$7)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_crypt_exception_mismatch_ce, "Hash does not match.", "phalcon/Encryption/Crypt.zep", 224); @@ -428,7 +428,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decryptBase64) ZEPHIR_CONCAT_VV(&_4$$3, &_2$$3, &_1$$3); zephir_get_strval(&input, &_4$$3); } - ZEPHIR_CALL_FUNCTION(&_5, "base64_decode", NULL, 226, &input); + ZEPHIR_CALL_FUNCTION(&_5, "base64_decode", NULL, 229, &input); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "decrypt", NULL, 0, &_5, &key); zephir_check_call_status(); @@ -511,9 +511,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encrypt) ZVAL_STRING(&_1, "cipher"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkcipherhashisavailable", NULL, 0, &cipher, &_1); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&mode, this_ptr, "getmode", NULL, 222); + ZEPHIR_CALL_METHOD(&mode, this_ptr, "getmode", NULL, 225); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&blockSize, this_ptr, "getblocksize", NULL, 223, &mode); + ZEPHIR_CALL_METHOD(&blockSize, this_ptr, "getblocksize", NULL, 226, &mode); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&iv, this_ptr, "phpopensslrandompseudobytes", NULL, 0, &ivLength); zephir_check_call_status(); @@ -529,7 +529,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encrypt) if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { ZEPHIR_CALL_METHOD(&_2$$6, this_ptr, "gethashalgorithm", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&digest, "hash_hmac", NULL, 225, &_2$$6, &padded, &encryptKey, &__$true); + ZEPHIR_CALL_FUNCTION(&digest, "hash_hmac", NULL, 228, &_2$$6, &padded, &encryptKey, &__$true); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &iv, &digest, &encrypted); RETURN_MM(); @@ -594,7 +594,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encryptBase64) if (safe) { ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "encrypt", NULL, 0, &input, &key); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1$$3, "base64_encode", NULL, 227, &_0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "base64_encode", NULL, 230, &_0$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "+/"); @@ -609,7 +609,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encryptBase64) } ZEPHIR_CALL_METHOD(&_5, this_ptr, "encrypt", NULL, 0, &input, &key); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 227, &_5); + ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 230, &_5); zephir_check_call_status(); RETURN_MM(); } @@ -693,11 +693,11 @@ PHP_METHOD(Phalcon_Encryption_Crypt, getAvailableHashAlgorithms) ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpfunctionexists", NULL, 0, &_1); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_RETURN_CALL_FUNCTION("hash_hmac_algos", NULL, 228); + ZEPHIR_RETURN_CALL_FUNCTION("hash_hmac_algos", NULL, 231); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_RETURN_CALL_FUNCTION("hash_algos", NULL, 229); + ZEPHIR_RETURN_CALL_FUNCTION("hash_algos", NULL, 232); zephir_check_call_status(); RETURN_MM(); } @@ -783,7 +783,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, isValidDecryptLength) if (ZEPHIR_IS_FALSE_IDENTICAL(&length)) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_FUNCTION(&_1, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&_1, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_LE(&length, &_1)); } @@ -914,7 +914,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, setCipher) ZVAL_STRING(&_0, "cipher"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkcipherhashisavailable", NULL, 0, &cipher, &_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getivlength", NULL, 231, &cipher); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getivlength", NULL, 234, &cipher); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("ivLength"), &_1); zephir_update_property_zval(this_ptr, ZEND_STRL("cipher"), &cipher); @@ -1128,9 +1128,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt, checkCipherHashIsAvailable) object_init_ex(&_1$$5, phalcon_encryption_crypt_exception_exception_ce); ZEPHIR_INIT_VAR(&_2$$5); ZVAL_STRING(&_2$$5, "The %s algorithm '%s' is not supported on this system."); - ZEPHIR_CALL_FUNCTION(&_3$$5, "sprintf", NULL, 113, &_2$$5, &type, &cipher); + ZEPHIR_CALL_FUNCTION(&_3$$5, "sprintf", NULL, 116, &_2$$5, &type, &cipher); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_1$$5, "__construct", NULL, 29, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_1$$5, "__construct", NULL, 32, &_3$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$5, "phalcon/Encryption/Crypt.zep", 608); ZEPHIR_MM_RESTORE(); @@ -1205,10 +1205,10 @@ PHP_METHOD(Phalcon_Encryption_Crypt, cryptPadText) ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "ecb"); zephir_array_fast_append(&_1, &_2); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkismode", NULL, 232, &_1, &mode); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkismode", NULL, 235, &_1, &mode); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_CALL_FUNCTION(&_3$$3, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&_3$$3, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); paddingSize = (blockSize - zephir_safe_mod_zval_long(&_3$$3, blockSize)); _4$$3 = paddingSize >= 256; @@ -1316,7 +1316,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, cryptUnpadText) ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "ecb"); zephir_array_fast_append(&_3, &_4); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkismode", NULL, 232, &_3, &mode); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkismode", NULL, 235, &_3, &mode); zephir_check_call_status(); _1 = ZEPHIR_IS_TRUE_IDENTICAL(&_2); } @@ -1401,7 +1401,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decryptGetUnpadded) ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "ecb"); zephir_array_fast_append(&_1, &_2); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkismode", NULL, 232, &_1, &mode); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkismode", NULL, 235, &_1, &mode); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("padding"), PH_NOISY_CC | PH_READONLY); @@ -1478,7 +1478,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decryptGcmCcmAuth) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "gcm"); zephir_array_fast_append(&_2, &_3); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "checkismode", NULL, 232, &_2, &mode); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "checkismode", NULL, 235, &_2, &mode); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_1)) { zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("authData"), PH_NOISY_CC | PH_READONLY); @@ -1493,11 +1493,11 @@ PHP_METHOD(Phalcon_Encryption_Crypt, decryptGcmCcmAuth) ZEPHIR_INIT_VAR(&encrypted); zephir_fast_str_replace(&encrypted, &authTag, &_5$$3, &cipherText); ZVAL_LONG(&_4$$3, 1); - ZEPHIR_CALL_FUNCTION(&decrypted, "openssl_decrypt", NULL, 233, &encrypted, &cipher, &decryptKey, &_4$$3, &iv, &authTag, &authData); + ZEPHIR_CALL_FUNCTION(&decrypted, "openssl_decrypt", NULL, 236, &encrypted, &cipher, &decryptKey, &_4$$3, &iv, &authTag, &authData); zephir_check_call_status(); } else { ZVAL_LONG(&_6$$4, 1); - ZEPHIR_CALL_FUNCTION(&decrypted, "openssl_decrypt", NULL, 233, &cipherText, &cipher, &decryptKey, &_6$$4, &iv); + ZEPHIR_CALL_FUNCTION(&decrypted, "openssl_decrypt", NULL, 236, &cipherText, &cipher, &decryptKey, &_6$$4, &iv); zephir_check_call_status(); } if (ZEPHIR_IS_FALSE_IDENTICAL(&decrypted)) { @@ -1561,7 +1561,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encryptGetPadded) ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "ecb"); zephir_array_fast_append(&_3, &_4); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkismode", NULL, 232, &_3, &mode); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checkismode", NULL, 235, &_3, &mode); zephir_check_call_status(); _1 = ZEPHIR_IS_TRUE_IDENTICAL(&_2); } @@ -1639,7 +1639,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encryptGcmCcm) ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "gcm"); zephir_array_fast_append(&_2, &_3); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "checkismode", NULL, 232, &_2, &mode); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "checkismode", NULL, 235, &_2, &mode); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_1)) { zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("authData"), PH_NOISY_CC | PH_READONLY); @@ -1654,13 +1654,13 @@ PHP_METHOD(Phalcon_Encryption_Crypt, encryptGcmCcm) ZEPHIR_CPY_WRT(&authTagLength, &_4$$3); ZVAL_LONG(&_4$$3, 1); ZEPHIR_MAKE_REF(&authTag); - ZEPHIR_CALL_FUNCTION(&encrypted, "openssl_encrypt", NULL, 234, &padded, &cipher, &encryptKey, &_4$$3, &iv, &authTag, &authData, &authTagLength); + ZEPHIR_CALL_FUNCTION(&encrypted, "openssl_encrypt", NULL, 237, &padded, &cipher, &encryptKey, &_4$$3, &iv, &authTag, &authData, &authTagLength); ZEPHIR_UNREF(&authTag); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("authTag"), &authTag); } else { ZVAL_LONG(&_5$$5, 1); - ZEPHIR_CALL_FUNCTION(&encrypted, "openssl_encrypt", NULL, 234, &padded, &cipher, &encryptKey, &_5$$5, &iv); + ZEPHIR_CALL_FUNCTION(&encrypted, "openssl_encrypt", NULL, 237, &padded, &cipher, &encryptKey, &_5$$5, &iv); zephir_check_call_status(); } if (ZEPHIR_IS_FALSE_IDENTICAL(&encrypted)) { @@ -1705,7 +1705,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, initializeAvailableCiphers) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_crypt_exception_exception_ce, "This class requires the openssl extension for PHP", "phalcon/Encryption/Crypt.zep", 892); return; } - ZEPHIR_CALL_FUNCTION(&available, "openssl_get_cipher_methods", NULL, 235, &__$true); + ZEPHIR_CALL_FUNCTION(&available, "openssl_get_cipher_methods", NULL, 238, &__$true); zephir_check_call_status(); ZEPHIR_INIT_VAR(&allowed); array_init(&allowed); @@ -1846,9 +1846,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt, getBlockSize) zephir_read_property(&_2, this_ptr, ZEND_STRL("cipher"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, ""); - ZEPHIR_CALL_FUNCTION(&_4, "str_ireplace", NULL, 236, &_1, &_3, &_2); + ZEPHIR_CALL_FUNCTION(&_4, "str_ireplace", NULL, 239, &_1, &_3, &_2); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getivlength", NULL, 231, &_4); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getivlength", NULL, 234, &_4); zephir_check_call_status(); RETURN_MM(); } @@ -1884,7 +1884,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, getIvLength) zephir_get_strval(&cipher, cipher_param); - ZEPHIR_CALL_FUNCTION(&length, "openssl_cipher_iv_length", NULL, 237, &cipher); + ZEPHIR_CALL_FUNCTION(&length, "openssl_cipher_iv_length", NULL, 240, &cipher); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&length)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_crypt_exception_exception_ce, "Cannot calculate the initialization vector (IV) length of the cipher", "phalcon/Encryption/Crypt.zep", 962); @@ -1919,7 +1919,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, getMode) zephir_read_property(&_0, this_ptr, ZEND_STRL("cipher"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "-"); - ZEPHIR_CALL_FUNCTION(&_2, "strrpos", NULL, 238, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "strrpos", NULL, 241, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(&position); ZVAL_LONG(&position, zephir_get_intval(&_2)); @@ -1982,7 +1982,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, phpOpensslCipherIvLength) zephir_get_strval(&cipher, cipher_param); - ZEPHIR_RETURN_CALL_FUNCTION("openssl_cipher_iv_length", NULL, 237, &cipher); + ZEPHIR_RETURN_CALL_FUNCTION("openssl_cipher_iv_length", NULL, 240, &cipher); zephir_check_call_status(); RETURN_MM(); } @@ -2009,7 +2009,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt, phpOpensslRandomPseudoBytes) ZVAL_LONG(&_0, length); - ZEPHIR_RETURN_CALL_FUNCTION("openssl_random_pseudo_bytes", NULL, 239, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("openssl_random_pseudo_bytes", NULL, 242, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/encryption/crypt/padding/ansi.zep.c b/ext/phalcon/encryption/crypt/padding/ansi.zep.c index dc45a040675..ae5b2e81d77 100644 --- a/ext/phalcon/encryption/crypt/padding/ansi.zep.c +++ b/ext/phalcon/encryption/crypt/padding/ansi.zep.c @@ -71,13 +71,13 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Ansi, pad) ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 243, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, (paddingSize - 1)); ZEPHIR_CALL_FUNCTION(&_2, "str_repeat", NULL, 1, &_1, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, paddingSize); - ZEPHIR_CALL_FUNCTION(&_3, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "chr", NULL, 243, &_0); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, &_2, &_3); RETURN_MM(); @@ -133,7 +133,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Ansi, unpad) ZVAL_LONG(&_1, 1); ZEPHIR_INIT_VAR(&last); zephir_substr(&last, &input, zephir_get_intval(&_0), 1 , 0); - ZEPHIR_CALL_FUNCTION(&ord, "ord", NULL, 241, &last); + ZEPHIR_CALL_FUNCTION(&ord, "ord", NULL, 244, &last); zephir_check_call_status(); if (ZEPHIR_LE_LONG(&ord, blockSize)) { ZEPHIR_CPY_WRT(&paddingSize, &ord); @@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Ansi, unpad) ZVAL_STRING(&repeat, ""); if (ZEPHIR_GT_LONG(&paddingSize, 1)) { ZVAL_LONG(&_2$$4, 0); - ZEPHIR_CALL_FUNCTION(&_3$$4, "chr", NULL, 240, &_2$$4); + ZEPHIR_CALL_FUNCTION(&_3$$4, "chr", NULL, 243, &_2$$4); zephir_check_call_status(); ZVAL_LONG(&_2$$4, (zephir_get_numberval(&paddingSize) - 1)); ZEPHIR_CALL_FUNCTION(&repeat, "str_repeat", NULL, 1, &_3$$4, &_2$$4); diff --git a/ext/phalcon/encryption/crypt/padding/iso10126.zep.c b/ext/phalcon/encryption/crypt/padding/iso10126.zep.c index e56845f7a98..62daf661d68 100644 --- a/ext/phalcon/encryption/crypt/padding/iso10126.zep.c +++ b/ext/phalcon/encryption/crypt/padding/iso10126.zep.c @@ -91,15 +91,15 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Iso10126, pad) } ZEPHIR_INIT_NVAR(&counter); ZVAL_LONG(&counter, _1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "rand", &_4, 242); + ZEPHIR_CALL_FUNCTION(&_3$$3, "rand", &_4, 245); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_5$$3, "chr", &_6, 240, &_3$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "chr", &_6, 243, &_3$$3); zephir_check_call_status(); zephir_concat_self(&padding, &_5$$3); } } ZVAL_LONG(&_7, paddingSize); - ZEPHIR_CALL_FUNCTION(&_8, "chr", &_6, 240, &_7); + ZEPHIR_CALL_FUNCTION(&_8, "chr", &_6, 243, &_7); zephir_check_call_status(); zephir_concat_self(&padding, &_8); RETURN_CCTOR(&padding); @@ -145,7 +145,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Iso10126, unpad) ZVAL_LONG(&_1, 1); ZEPHIR_INIT_VAR(&last); zephir_substr(&last, &input, zephir_get_intval(&_0), 1 , 0); - ZEPHIR_RETURN_CALL_FUNCTION("ord", NULL, 241, &last); + ZEPHIR_RETURN_CALL_FUNCTION("ord", NULL, 244, &last); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/encryption/crypt/padding/isoiek.zep.c b/ext/phalcon/encryption/crypt/padding/isoiek.zep.c index 4b79068edd7..607d35ac97e 100644 --- a/ext/phalcon/encryption/crypt/padding/isoiek.zep.c +++ b/ext/phalcon/encryption/crypt/padding/isoiek.zep.c @@ -71,10 +71,10 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_IsoIek, pad) ZVAL_LONG(&_0, 0x80); - ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 243, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&_2, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "chr", NULL, 243, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, (paddingSize - 1)); ZEPHIR_CALL_FUNCTION(&_3, "str_repeat", NULL, 1, &_2, &_0); @@ -123,9 +123,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_IsoIek, unpad) paddingSize = 0; - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 84, &input); + ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 87, &input); zephir_check_call_status(); counter = (zephir_get_numberval(&length) - 1); while (1) { @@ -133,7 +133,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_IsoIek, unpad) if (_0) { zephir_array_fetch_long(&_1, &inputArray, counter, PH_NOISY | PH_READONLY, "phalcon/Encryption/Crypt/Padding/IsoIek.zep", 48); ZVAL_LONG(&_2, 0); - ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 240, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 243, &_2); zephir_check_call_status(); _0 = ZEPHIR_IS_IDENTICAL(&_1, &_3); } @@ -149,7 +149,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_IsoIek, unpad) } zephir_array_fetch_long(&_6, &inputArray, counter, PH_NOISY | PH_READONLY, "phalcon/Encryption/Crypt/Padding/IsoIek.zep", 55); ZVAL_LONG(&_2, 0x80); - ZEPHIR_CALL_FUNCTION(&_7, "chr", &_4, 240, &_2); + ZEPHIR_CALL_FUNCTION(&_7, "chr", &_4, 243, &_2); zephir_check_call_status(); if (ZEPHIR_IS_EQUAL(&_6, &_7)) { paddingSize++; diff --git a/ext/phalcon/encryption/crypt/padding/pkcs7.zep.c b/ext/phalcon/encryption/crypt/padding/pkcs7.zep.c index 8f26ca62de7..d48e3355eb9 100644 --- a/ext/phalcon/encryption/crypt/padding/pkcs7.zep.c +++ b/ext/phalcon/encryption/crypt/padding/pkcs7.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Pkcs7, pad) ZVAL_LONG(&_0, paddingSize); - ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 243, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, paddingSize); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 1, &_1, &_0); @@ -116,17 +116,17 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Pkcs7, unpad) blockSize = zephir_get_intval(blockSize_param); - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); ZVAL_LONG(&_0, (zephir_get_numberval(&length) - 1)); ZVAL_LONG(&_1, 1); ZEPHIR_INIT_VAR(&last); zephir_substr(&last, &input, zephir_get_intval(&_0), 1 , 0); - ZEPHIR_CALL_FUNCTION(&ord, "ord", NULL, 241, &last); + ZEPHIR_CALL_FUNCTION(&ord, "ord", NULL, 244, &last); zephir_check_call_status(); if (ZEPHIR_LE_LONG(&ord, blockSize)) { ZEPHIR_CPY_WRT(&paddingSize, &ord); - ZEPHIR_CALL_FUNCTION(&_2$$3, "chr", NULL, 240, &paddingSize); + ZEPHIR_CALL_FUNCTION(&_2$$3, "chr", NULL, 243, &paddingSize); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&padding, "str_repeat", NULL, 1, &_2$$3, &paddingSize); zephir_check_call_status(); diff --git a/ext/phalcon/encryption/crypt/padding/space.zep.c b/ext/phalcon/encryption/crypt/padding/space.zep.c index 5bb1c1d5a63..151bcc756ab 100644 --- a/ext/phalcon/encryption/crypt/padding/space.zep.c +++ b/ext/phalcon/encryption/crypt/padding/space.zep.c @@ -112,9 +112,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Space, unpad) blockSize = zephir_get_intval(blockSize_param); - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 84, &input); + ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 87, &input); zephir_check_call_status(); counter = (zephir_get_numberval(&length) - 1); paddingSize = 0; @@ -123,7 +123,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Space, unpad) if (_0) { zephir_array_fetch_long(&_1, &inputArray, counter, PH_NOISY | PH_READONLY, "phalcon/Encryption/Crypt/Padding/Space.zep", 48); ZVAL_LONG(&_2, 32); - ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 240, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 243, &_2); zephir_check_call_status(); _0 = ZEPHIR_IS_EQUAL(&_1, &_3); } diff --git a/ext/phalcon/encryption/crypt/padding/zero.zep.c b/ext/phalcon/encryption/crypt/padding/zero.zep.c index a54ebcdff6c..7b7605d9435 100644 --- a/ext/phalcon/encryption/crypt/padding/zero.zep.c +++ b/ext/phalcon/encryption/crypt/padding/zero.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Zero, pad) ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 240, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "chr", NULL, 243, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, paddingSize); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 1, &_1, &_0); @@ -113,9 +113,9 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Zero, unpad) blockSize = zephir_get_intval(blockSize_param); - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &input); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &input); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 84, &input); + ZEPHIR_CALL_FUNCTION(&inputArray, "str_split", NULL, 87, &input); zephir_check_call_status(); counter = (zephir_get_numberval(&length) - 1); paddingSize = 0; @@ -124,7 +124,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_Padding_Zero, unpad) if (_0) { zephir_array_fetch_long(&_1, &inputArray, counter, PH_NOISY | PH_READONLY, "phalcon/Encryption/Crypt/Padding/Zero.zep", 48); ZVAL_LONG(&_2, 0); - ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 240, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "chr", &_4, 243, &_2); zephir_check_call_status(); _0 = ZEPHIR_IS_EQUAL(&_1, &_3); } diff --git a/ext/phalcon/encryption/crypt/padfactory.zep.c b/ext/phalcon/encryption/crypt/padfactory.zep.c index faa6269e5c6..576287b4ac7 100644 --- a/ext/phalcon/encryption/crypt/padfactory.zep.c +++ b/ext/phalcon/encryption/crypt/padfactory.zep.c @@ -173,7 +173,7 @@ PHP_METHOD(Phalcon_Encryption_Crypt_PadFactory, padNumberToService) ZVAL_LONG(&_1, number); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "noop"); - ZEPHIR_RETURN_CALL_METHOD(&_0, "__invoke", NULL, 155, &map, &_1, &_2); + ZEPHIR_RETURN_CALL_METHOD(&_0, "__invoke", NULL, 158, &map, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/encryption/security.zep.c b/ext/phalcon/encryption/security.zep.c index 709af18a410..98637080cf0 100644 --- a/ext/phalcon/encryption/security.zep.c +++ b/ext/phalcon/encryption/security.zep.c @@ -227,7 +227,7 @@ PHP_METHOD(Phalcon_Encryption_Security, checkHash) if (_0) { RETURN_MM_BOOL(0); } - ZEPHIR_RETURN_CALL_FUNCTION("password_verify", NULL, 243, &password, &passwordHash); + ZEPHIR_RETURN_CALL_FUNCTION("password_verify", NULL, 246, &password, &passwordHash); zephir_check_call_status(); RETURN_MM(); } @@ -287,13 +287,13 @@ PHP_METHOD(Phalcon_Encryption_Security, checkToken) } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "processtokenkey", NULL, 244, &tokenKey); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "processtokenkey", NULL, 247, &tokenKey); zephir_check_call_status(); zephir_get_strval(&tokenKey, &_0); if (!(!(ZEPHIR_IS_EMPTY(&tokenKey)))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&userToken, this_ptr, "processusertoken", NULL, 245, &tokenKey, tokenValue); + ZEPHIR_CALL_METHOD(&userToken, this_ptr, "processusertoken", NULL, 248, &tokenKey, tokenValue); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&knownToken, this_ptr, "getrequesttoken", NULL, 0); zephir_check_call_status(); @@ -371,16 +371,16 @@ PHP_METHOD(Phalcon_Encryption_Security, computeHmac) ZVAL_BOOL(&_0, (raw ? 1 : 0)); - ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 225, &algo, &data, &key, &_0); + ZEPHIR_CALL_FUNCTION(&hmac, "hash_hmac", NULL, 228, &algo, &data, &key, &_0); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&hmac))) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_encryption_security_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "Unknown hashing algorithm: %s"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "sprintf", NULL, 113, &_2$$3, &algo); + ZEPHIR_CALL_FUNCTION(&_3$$3, "sprintf", NULL, 116, &_2$$3, &algo); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Encryption/Security.zep", 219); ZEPHIR_MM_RESTORE(); @@ -472,7 +472,7 @@ PHP_METHOD(Phalcon_Encryption_Security, getHashInformation) zephir_get_strval(&hash, hash_param); - ZEPHIR_RETURN_CALL_FUNCTION("password_get_info", NULL, 246, &hash); + ZEPHIR_RETURN_CALL_FUNCTION("password_get_info", NULL, 249, &hash); zephir_check_call_status(); RETURN_MM(); } @@ -790,11 +790,11 @@ PHP_METHOD(Phalcon_Encryption_Security, hash) } - ZEPHIR_CALL_METHOD(&cost, this_ptr, "processcost", NULL, 247, &options); + ZEPHIR_CALL_METHOD(&cost, this_ptr, "processcost", NULL, 250, &options); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "%02s"); - ZEPHIR_CALL_FUNCTION(&formatted, "sprintf", NULL, 113, &_0, &cost); + ZEPHIR_CALL_FUNCTION(&formatted, "sprintf", NULL, 116, &_0, &cost); zephir_check_call_status(); ZEPHIR_INIT_VAR(&prefix); ZVAL_STRING(&prefix, ""); @@ -824,14 +824,14 @@ PHP_METHOD(Phalcon_Encryption_Security, hash) if (ZEPHIR_IS_LONG(&_1, 5)) { ZEPHIR_INIT_VAR(&_2$$6); ZVAL_STRING(&_2$$6, "$2a$%s$"); - ZEPHIR_CALL_FUNCTION(&prefix, "sprintf", NULL, 113, &_2$$6, &formatted); + ZEPHIR_CALL_FUNCTION(&prefix, "sprintf", NULL, 116, &_2$$6, &formatted); zephir_check_call_status(); break; } if (ZEPHIR_IS_LONG(&_1, 6)) { ZEPHIR_INIT_VAR(&_3$$7); ZVAL_STRING(&_3$$7, "$2x$%s$"); - ZEPHIR_CALL_FUNCTION(&prefix, "sprintf", NULL, 113, &_3$$7, &formatted); + ZEPHIR_CALL_FUNCTION(&prefix, "sprintf", NULL, 116, &_3$$7, &formatted); zephir_check_call_status(); break; } @@ -845,7 +845,7 @@ PHP_METHOD(Phalcon_Encryption_Security, hash) zephir_check_call_status(); ZEPHIR_INIT_VAR(&salt); ZEPHIR_CONCAT_VVS(&salt, &prefix, &_4$$9, "$"); - ZEPHIR_RETURN_CALL_FUNCTION("crypt", NULL, 248, &password, &salt); + ZEPHIR_RETURN_CALL_FUNCTION("crypt", NULL, 251, &password, &salt); zephir_check_call_status(); RETURN_MM(); } @@ -853,11 +853,11 @@ PHP_METHOD(Phalcon_Encryption_Security, hash) zephir_create_array(&_6, 1, 0); zephir_array_update_string(&_6, SL("cost"), &cost, PH_COPY | PH_SEPARATE); ZEPHIR_CPY_WRT(&options, &_6); - ZEPHIR_CALL_METHOD(&algorithm, this_ptr, "processalgorithm", NULL, 249); + ZEPHIR_CALL_METHOD(&algorithm, this_ptr, "processalgorithm", NULL, 252); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "processargonoptions", NULL, 250, &options); + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "processargonoptions", NULL, 253, &options); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("password_hash", NULL, 251, &password, &algorithm, &arguments); + ZEPHIR_RETURN_CALL_FUNCTION("password_hash", NULL, 254, &password, &algorithm, &arguments); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/encryption/security/jwt/builder.zep.c b/ext/phalcon/encryption/security/jwt/builder.zep.c index 45fa5defed9..970fe5564fc 100644 --- a/ext/phalcon/encryption/security/jwt/builder.zep.c +++ b/ext/phalcon/encryption/security/jwt/builder.zep.c @@ -33,7 +33,14 @@ * file that was distributed with this source code. */ /** - * JWT Builder + * Builder + * + * The builder offers + * + * @property CollectionInterface $claims + * @property CollectionInterface $jose + * @property string $passphrase + * @property SignerInterface $signer * * @link https://tools.ietf.org/html/rfc7519 */ @@ -202,6 +209,53 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, addClaim) RETURN_THIS(); } +/** + * Adds a custom claim + * + * @param string $name + * @param mixed $value + * + * @return Builder + */ +PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, addHeader) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *value, value_sub, _0; + zval name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name_param, &value); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); + } else { + ZEPHIR_INIT_VAR(&name); + } + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("jose"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "set", NULL, 0, &name, value); + zephir_check_call_status(); + RETURN_THIS(); +} + /** * @return array|string */ @@ -507,7 +561,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getToken) zephir_read_property(&_0, this_ptr, ZEND_STRL("passphrase"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_EMPTY(&_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid passphrase (empty)", "phalcon/Encryption/Security/JWT/Builder.zep", 198); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid passphrase (empty)", "phalcon/Encryption/Security/JWT/Builder.zep", 220); return; } zephir_read_property(&_1, this_ptr, ZEND_STRL("encode"), PH_NOISY_CC | PH_READONLY); @@ -515,26 +569,26 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getToken) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, &_1, "__invoke", NULL, 0, &_3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&encodedClaims, this_ptr, "encodeurl", NULL, 252, &_2); + ZEPHIR_CALL_METHOD(&encodedClaims, this_ptr, "encodeurl", NULL, 255, &_2); zephir_check_call_status(); ZEPHIR_INIT_VAR(&claims); object_init_ex(&claims, phalcon_encryption_security_jwt_token_item_ce); ZEPHIR_CALL_METHOD(&_4, this_ptr, "getclaims", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &claims, "__construct", NULL, 253, &_4, &encodedClaims); + ZEPHIR_CALL_METHOD(NULL, &claims, "__construct", NULL, 256, &_4, &encodedClaims); zephir_check_call_status(); zephir_read_property(&_5, this_ptr, ZEND_STRL("encode"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&_7, this_ptr, "getheaders", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_6, &_5, "__invoke", NULL, 0, &_7); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&encodedHeaders, this_ptr, "encodeurl", NULL, 252, &_6); + ZEPHIR_CALL_METHOD(&encodedHeaders, this_ptr, "encodeurl", NULL, 255, &_6); zephir_check_call_status(); ZEPHIR_INIT_VAR(&headers); object_init_ex(&headers, phalcon_encryption_security_jwt_token_item_ce); ZEPHIR_CALL_METHOD(&_8, this_ptr, "getheaders", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &headers, "__construct", NULL, 253, &_8, &encodedHeaders); + ZEPHIR_CALL_METHOD(NULL, &headers, "__construct", NULL, 256, &_8, &encodedHeaders); zephir_check_call_status(); zephir_read_property(&_9, this_ptr, ZEND_STRL("signer"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_10); @@ -542,14 +596,14 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getToken) zephir_read_property(&_11, this_ptr, ZEND_STRL("passphrase"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&signatureHash, &_9, "sign", NULL, 0, &_10, &_11); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&encodedSignature, this_ptr, "encodeurl", NULL, 252, &signatureHash); + ZEPHIR_CALL_METHOD(&encodedSignature, this_ptr, "encodeurl", NULL, 255, &signatureHash); zephir_check_call_status(); ZEPHIR_INIT_VAR(&signature); object_init_ex(&signature, phalcon_encryption_security_jwt_token_signature_ce); - ZEPHIR_CALL_METHOD(NULL, &signature, "__construct", NULL, 254, &signatureHash, &encodedSignature); + ZEPHIR_CALL_METHOD(NULL, &signature, "__construct", NULL, 257, &signatureHash, &encodedSignature); zephir_check_call_status(); object_init_ex(return_value, phalcon_encryption_security_jwt_token_token_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 255, &headers, &claims, &signature); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 258, &headers, &claims, &signature); zephir_check_call_status(); RETURN_MM(); } @@ -612,7 +666,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, setAudience) _0 = Z_TYPE_P(audience) != IS_ARRAY; } if (_0) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Audience", "phalcon/Encryption/Security/JWT/Builder.zep", 248); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Audience", "phalcon/Encryption/Security/JWT/Builder.zep", 270); return; } if (Z_TYPE_P(audience) == IS_STRING) { @@ -708,7 +762,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, setExpirationTime) ZEPHIR_INIT_VAR(&_0); zephir_time(&_0); if (ZEPHIR_GT_LONG(&_0, timestamp)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Expiration Time", "phalcon/Encryption/Security/JWT/Builder.zep", 293); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Expiration Time", "phalcon/Encryption/Security/JWT/Builder.zep", 315); return; } ZEPHIR_INIT_VAR(&_1); @@ -907,7 +961,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, setNotBefore) ZEPHIR_INIT_VAR(&_0); zephir_time(&_0); if (ZEPHIR_LT_LONG(&_0, timestamp)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Not Before", "phalcon/Encryption/Security/JWT/Builder.zep", 367); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid Not Before", "phalcon/Encryption/Security/JWT/Builder.zep", 389); return; } ZEPHIR_INIT_VAR(&_1); @@ -1016,7 +1070,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, setPassphrase) ZVAL_STRING(&_3, "/(?=^.{16,}$)((?=.*\\d)|(?=.*\\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/"); zephir_preg_match(&_2, &_3, &passphrase, &_0, 0, 0 , 0 ); if (!(zephir_is_true(&_2))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid passphrase (too weak)", "phalcon/Encryption/Security/JWT/Builder.zep", 405); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Invalid passphrase (too weak)", "phalcon/Encryption/Security/JWT/Builder.zep", 427); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("passphrase"), &passphrase); @@ -1108,7 +1162,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, encodeUrl) } - ZEPHIR_CALL_FUNCTION(&_0, "base64_encode", NULL, 227, &input); + ZEPHIR_CALL_FUNCTION(&_0, "base64_encode", NULL, 230, &input); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "+/"); diff --git a/ext/phalcon/encryption/security/jwt/builder.zep.h b/ext/phalcon/encryption/security/jwt/builder.zep.h index c1212f5db0a..e605310cc29 100644 --- a/ext/phalcon/encryption/security/jwt/builder.zep.h +++ b/ext/phalcon/encryption/security/jwt/builder.zep.h @@ -6,6 +6,7 @@ ZEPHIR_INIT_CLASS(Phalcon_Encryption_Security_JWT_Builder); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, __construct); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, init); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, addClaim); +PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, addHeader); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getAudience); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getClaims); PHP_METHOD(Phalcon_Encryption_Security_JWT_Builder, getContentType); @@ -42,6 +43,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_encryption_security_jwt_b ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_encryption_security_jwt_builder_addheader, 0, 2, Phalcon\\Encryption\\Security\\JWT\\Builder, 0) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_encryption_security_jwt_builder_getaudience, 0, 0, 0) ZEND_END_ARG_INFO() @@ -127,6 +133,7 @@ ZEPHIR_INIT_FUNCS(phalcon_encryption_security_jwt_builder_method_entry) { PHP_ME(Phalcon_Encryption_Security_JWT_Builder, __construct, arginfo_phalcon_encryption_security_jwt_builder___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Phalcon_Encryption_Security_JWT_Builder, init, arginfo_phalcon_encryption_security_jwt_builder_init, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Encryption_Security_JWT_Builder, addClaim, arginfo_phalcon_encryption_security_jwt_builder_addclaim, ZEND_ACC_PUBLIC) + PHP_ME(Phalcon_Encryption_Security_JWT_Builder, addHeader, arginfo_phalcon_encryption_security_jwt_builder_addheader, ZEND_ACC_PUBLIC) #if PHP_VERSION_ID >= 80000 PHP_ME(Phalcon_Encryption_Security_JWT_Builder, getAudience, arginfo_phalcon_encryption_security_jwt_builder_getaudience, ZEND_ACC_PUBLIC) #else diff --git a/ext/phalcon/encryption/security/jwt/signer/hmac.zep.c b/ext/phalcon/encryption/security/jwt/signer/hmac.zep.c index c1810ca2ba7..626d1c7b77a 100644 --- a/ext/phalcon/encryption/security/jwt/signer/hmac.zep.c +++ b/ext/phalcon/encryption/security/jwt/signer/hmac.zep.c @@ -177,7 +177,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Signer_Hmac, sign) } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethash", NULL, 256, &payload, &passphrase); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethash", NULL, 259, &payload, &passphrase); zephir_check_call_status(); RETURN_MM(); } @@ -220,7 +220,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Signer_Hmac, verify) zephir_get_strval(&passphrase, passphrase_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "gethash", NULL, 256, &payload, &passphrase); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "gethash", NULL, 259, &payload, &passphrase); zephir_check_call_status(); RETURN_MM_BOOL(zephir_hash_equals(&source, &_0)); } @@ -262,7 +262,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Signer_Hmac, getHash) ZEPHIR_CALL_METHOD(&_0, this_ptr, "getalgorithm", NULL, 0); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("hash_hmac", NULL, 225, &_0, &payload, &passphrase, &__$true); + ZEPHIR_RETURN_CALL_FUNCTION("hash_hmac", NULL, 228, &_0, &payload, &passphrase, &__$true); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/encryption/security/jwt/token/parser.zep.c b/ext/phalcon/encryption/security/jwt/token/parser.zep.c index d1529172358..7cc41b63dd8 100644 --- a/ext/phalcon/encryption/security/jwt/token/parser.zep.c +++ b/ext/phalcon/encryption/security/jwt/token/parser.zep.c @@ -133,7 +133,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, parse) } - ZEPHIR_CALL_METHOD(&results, this_ptr, "parsetoken", NULL, 257, &token); + ZEPHIR_CALL_METHOD(&results, this_ptr, "parsetoken", NULL, 260, &token); zephir_check_call_status(); ZEPHIR_OBS_VAR(&encodedHeaders); zephir_array_fetch_long(&encodedHeaders, &results, 0, PH_NOISY, "phalcon/Encryption/Security/JWT/Token/Parser.zep", 55); @@ -141,14 +141,14 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, parse) zephir_array_fetch_long(&encodedClaims, &results, 1, PH_NOISY, "phalcon/Encryption/Security/JWT/Token/Parser.zep", 56); ZEPHIR_OBS_VAR(&encodedSignature); zephir_array_fetch_long(&encodedSignature, &results, 2, PH_NOISY, "phalcon/Encryption/Security/JWT/Token/Parser.zep", 57); - ZEPHIR_CALL_METHOD(&headers, this_ptr, "decodeheaders", NULL, 258, &encodedHeaders); + ZEPHIR_CALL_METHOD(&headers, this_ptr, "decodeheaders", NULL, 261, &encodedHeaders); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&claims, this_ptr, "decodeclaims", NULL, 259, &encodedClaims); + ZEPHIR_CALL_METHOD(&claims, this_ptr, "decodeclaims", NULL, 262, &encodedClaims); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&signature, this_ptr, "decodesignature", NULL, 260, &headers, &encodedSignature); + ZEPHIR_CALL_METHOD(&signature, this_ptr, "decodesignature", NULL, 263, &headers, &encodedSignature); zephir_check_call_status(); object_init_ex(return_value, phalcon_encryption_security_jwt_token_token_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 255, &headers, &claims, &signature); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 258, &headers, &claims, &signature); zephir_check_call_status(); RETURN_MM(); } @@ -192,7 +192,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeClaims) zephir_read_property(&_0, this_ptr, ZEND_STRL("decode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "decodeurl", NULL, 261, &claims); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "decodeurl", NULL, 264, &claims); zephir_check_call_status(); ZVAL_BOOL(&_2, 1); ZEPHIR_CALL_METHOD(&decoded, &_0, "__invoke", NULL, 0, &_1, &_2); @@ -216,7 +216,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeClaims) zephir_array_update_string(&decoded, SL("aud"), &_5$$4, PH_COPY | PH_SEPARATE); } object_init_ex(return_value, phalcon_encryption_security_jwt_token_item_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 253, &decoded, &claims); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 256, &decoded, &claims); zephir_check_call_status(); RETURN_MM(); } @@ -255,7 +255,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeHeaders) zephir_read_property(&_0, this_ptr, ZEND_STRL("decode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "decodeurl", NULL, 261, &headers); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "decodeurl", NULL, 264, &headers); zephir_check_call_status(); ZVAL_BOOL(&_2, 1); ZEPHIR_CALL_METHOD(&decoded, &_0, "__invoke", NULL, 0, &_1, &_2); @@ -269,7 +269,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeHeaders) return; } object_init_ex(return_value, phalcon_encryption_security_jwt_token_item_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 253, &decoded, &headers); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 256, &decoded, &headers); zephir_check_call_status(); RETURN_MM(); } @@ -324,11 +324,11 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeSignature) ZVAL_STRING(&decoded, ""); ZEPHIR_INIT_NVAR(&signature); } else { - ZEPHIR_CALL_METHOD(&decoded, this_ptr, "decodeurl", NULL, 261, &signature); + ZEPHIR_CALL_METHOD(&decoded, this_ptr, "decodeurl", NULL, 264, &signature); zephir_check_call_status(); } object_init_ex(return_value, phalcon_encryption_security_jwt_token_signature_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 254, &decoded, &signature); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 257, &decoded, &signature); zephir_check_call_status(); RETURN_MM(); } @@ -434,7 +434,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Parser, decodeUrl) ZVAL_STRING(&_4, "+/"); ZEPHIR_CALL_FUNCTION(&_5, "strtr", NULL, 5, &input, &_3, &_4); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&data, "base64_decode", NULL, 226, &_5); + ZEPHIR_CALL_FUNCTION(&data, "base64_decode", NULL, 229, &_5); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&data)) { ZEPHIR_INIT_NVAR(&data); diff --git a/ext/phalcon/encryption/security/jwt/token/token.zep.c b/ext/phalcon/encryption/security/jwt/token/token.zep.c index 83dc2e8b8e2..424245a002f 100644 --- a/ext/phalcon/encryption/security/jwt/token/token.zep.c +++ b/ext/phalcon/encryption/security/jwt/token/token.zep.c @@ -89,6 +89,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, __construct) } /** + * Return the registered claims + * * @return Item */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getClaims) @@ -101,6 +103,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getClaims) } /** + * Return the registered headers + * * @return Item */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getHeaders) @@ -113,6 +117,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getHeaders) } /** + * Return the payload + * * @return string */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getPayload) @@ -141,6 +147,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getPayload) } /** + * Return the signature + * * @return Signature */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getSignature) @@ -153,6 +161,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getSignature) } /** + * Return the token + * * @return string */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, getToken) @@ -245,7 +255,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Token_Token, validate) ZEPHIR_CALL_METHOD(&_0, validator, "get", NULL, 0, &_1); zephir_check_call_status(); zephir_array_update_string(&methods, SL("validateNotBefore"), &_0, PH_COPY | PH_SEPARATE); - zephir_is_iterable(&methods, 0, "phalcon/Encryption/Security/JWT/Token/Token.zep", 121); + zephir_is_iterable(&methods, 0, "phalcon/Encryption/Security/JWT/Token/Token.zep", 131); if (Z_TYPE_P(&methods) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methods), _4, _5, _2) { diff --git a/ext/phalcon/encryption/security/jwt/validator.zep.c b/ext/phalcon/encryption/security/jwt/validator.zep.c index b57b4b63418..d8e58d65c43 100644 --- a/ext/phalcon/encryption/security/jwt/validator.zep.c +++ b/ext/phalcon/encryption/security/jwt/validator.zep.c @@ -115,6 +115,11 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, __construct) ZEPHIR_MM_RESTORE(); } +/** + * Return an array with validation errors (if any) + * + * @return array + */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, getErrors) { zval *this_ptr = getThis(); @@ -124,6 +129,13 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, getErrors) RETURN_MEMBER(getThis(), "errors"); } +/** + * Return the value of a claim + * + * @param string $claim + * + * @return mixed + */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; @@ -151,12 +163,20 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, get) zephir_read_property(&_0, this_ptr, ZEND_STRL("claims"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset(&_0, &claim)) { zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("claims"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_2$$3, &_1$$3, &claim, PH_NOISY | PH_READONLY, "phalcon/Encryption/Security/JWT/Validator.zep", 75); + zephir_array_fetch(&_2$$3, &_1$$3, &claim, PH_NOISY | PH_READONLY, "phalcon/Encryption/Security/JWT/Validator.zep", 87); RETURN_CTOR(&_2$$3); } RETURN_MM_NULL(); } +/** + * Set the value of a claim, for comparison with the token values + * + * @param string $claim + * @param mixed $value + * + * @return Validator + */ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, set) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; @@ -185,6 +205,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, set) } /** + * Set the token to be validated + * * @param Token $token * * @return Validator @@ -211,6 +233,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, setToken) } /** + * Validate the audience + * * @param string|array $audience * * @return Validator @@ -253,7 +277,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateAudience) _0 = Z_TYPE_P(audience) != IS_ARRAY; } if (_0) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Audience must be a string or an array", "phalcon/Encryption/Security/JWT/Validator.zep", 113); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_encryption_security_jwt_exceptions_validatorexception_ce, "Audience must be a string or an array", "phalcon/Encryption/Security/JWT/Validator.zep", 137); return; } if (Z_TYPE_P(audience) == IS_STRING) { @@ -271,7 +295,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateAudience) ZVAL_STRING(&_5, "aud"); ZEPHIR_CALL_METHOD(&tokenAudience, &_3, "get", NULL, 0, &_5, &_4); zephir_check_call_status(); - zephir_is_iterable(audience, 0, "phalcon/Encryption/Security/JWT/Validator.zep", 128); + zephir_is_iterable(audience, 0, "phalcon/Encryption/Security/JWT/Validator.zep", 152); if (Z_TYPE_P(audience) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(audience), _6) { @@ -310,6 +334,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateAudience) } /** + * Validate the expiration time of the token + * * @param int $timestamp * * @return Validator @@ -364,7 +390,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateExpiration) _7 = zephir_is_true(&_6); if (_7) { ZVAL_LONG(&_9, timestamp); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "gettimestamp", NULL, 262, &_9); + ZEPHIR_CALL_METHOD(&_8, this_ptr, "gettimestamp", NULL, 265, &_9); zephir_check_call_status(); _7 = ZEPHIR_GT_LONG(&_8, tokenExpirationTime); } @@ -378,6 +404,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateExpiration) } /** + * Validate the id of the token + * * @param string $id * * @return Validator @@ -431,6 +459,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateId) } /** + * Validate the issued at (iat) of the token + * * @param int $timestamp * * @return Validator @@ -472,7 +502,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateIssuedAt) zephir_check_call_status(); tokenIssuedAt = zephir_get_intval(&_2); ZVAL_LONG(&_5, timestamp); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettimestamp", NULL, 262, &_5); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettimestamp", NULL, 265, &_5); zephir_check_call_status(); if (ZEPHIR_LE_LONG(&_4, tokenIssuedAt)) { ZEPHIR_INIT_ZVAL_NREF(_6$$3); @@ -484,6 +514,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateIssuedAt) } /** + * Validate the issuer of the token + * * @param string $issuer * * @return Validator @@ -545,6 +577,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateIssuer) } /** + * Validate the notbefore (nbf) of the token + * * @param int $timestamp * * @return Validator @@ -586,7 +620,7 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateNotBefore) zephir_check_call_status(); tokenNotBefore = zephir_get_intval(&_2); ZVAL_LONG(&_5, timestamp); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettimestamp", NULL, 262, &_5); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettimestamp", NULL, 265, &_5); zephir_check_call_status(); if (ZEPHIR_LE_LONG(&_4, tokenNotBefore)) { ZEPHIR_INIT_ZVAL_NREF(_6$$3); @@ -598,6 +632,8 @@ PHP_METHOD(Phalcon_Encryption_Security_JWT_Validator, validateNotBefore) } /** + * Validate the signature of the token + * * @param SignerInterface $signer * @param string $passphrase * diff --git a/ext/phalcon/encryption/security/random.zep.c b/ext/phalcon/encryption/security/random.zep.c index bfe3c32f1eb..5fa0ddebb69 100644 --- a/ext/phalcon/encryption/security/random.zep.c +++ b/ext/phalcon/encryption/security/random.zep.c @@ -259,7 +259,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, base64) ZVAL_LONG(&_1, len); ZEPHIR_CALL_METHOD(&_0, this_ptr, "bytes", NULL, 0, &_1); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 227, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 230, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -327,7 +327,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, base64Safe) ZVAL_LONG(&_1, len); ZEPHIR_CALL_METHOD(&_0, this_ptr, "base64", NULL, 0, &_1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_2, "base64_encode", NULL, 227, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "base64_encode", NULL, 230, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "+/"); @@ -339,7 +339,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, base64Safe) ZVAL_STRING(&_3, "#[^a-z0-9_=-]+#i"); ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, ""); - ZEPHIR_CALL_FUNCTION(&_5, "preg_replace", NULL, 37, &_3, &_4, &s); + ZEPHIR_CALL_FUNCTION(&_5, "preg_replace", NULL, 40, &_3, &_4, &s); zephir_check_call_status(); ZEPHIR_CPY_WRT(&s, &_5); if (!(padding)) { @@ -400,7 +400,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, bytes) len = 16; } ZVAL_LONG(&_0, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 263, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("random_bytes", NULL, 266, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -453,7 +453,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, hex) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "H*"); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 264, &_2, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 267, &_2, &_0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&_3); ZEPHIR_RETURN_CALL_FUNCTION("array_shift", NULL, 21, &_3); @@ -503,7 +503,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, number) } ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, len); - ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 265, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("random_int", NULL, 268, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -555,7 +555,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, uuid) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "N1a/n1b/n1c/n1d/n1e/N1f"); - ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 264, &_2, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "unpack", NULL, 267, &_2, &_0); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&ary, "array_values", NULL, 14, &_3); zephir_check_call_status(); @@ -570,7 +570,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, uuid) ZEPHIR_INIT_VAR(&_7); ZVAL_STRING(&_7, "%08x-%04x-%04x-%04x-%04x%08x"); ZEPHIR_MAKE_REF(&ary); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 266, &ary, &_7); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 269, &ary, &_7); ZEPHIR_UNREF(&ary); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7); @@ -636,7 +636,7 @@ PHP_METHOD(Phalcon_Encryption_Security_Random, base) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "C*"); - ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 264, &_1, &_0); + ZEPHIR_CALL_FUNCTION(&bytes, "unpack", NULL, 267, &_1, &_0); zephir_check_call_status(); zephir_is_iterable(&bytes, 0, "phalcon/Encryption/Security/Random.zep", 351); if (Z_TYPE_P(&bytes) == IS_ARRAY) { diff --git a/ext/phalcon/events/event.zep.c b/ext/phalcon/events/event.zep.c index bc8273cb697..ba41a866f5b 100644 --- a/ext/phalcon/events/event.zep.c +++ b/ext/phalcon/events/event.zep.c @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Events_Event, __construct) zephir_gettype(&_2$$3, source); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SVSV(&_3$$3, "The source of ", &type, " event must be an object, got ", &_2$$3); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Events/Event.zep", 73); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/events/manager.zep.c b/ext/phalcon/events/manager.zep.c index 36caac18515..bba26bf033f 100644 --- a/ext/phalcon/events/manager.zep.c +++ b/ext/phalcon/events/manager.zep.c @@ -137,7 +137,7 @@ PHP_METHOD(Phalcon_Events_Manager, attach) } ZVAL_LONG(&_2$$4, 1); - ZEPHIR_CALL_METHOD(NULL, &priorityQueue, "setextractflags", NULL, 267, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &priorityQueue, "setextractflags", NULL, 270, &_2$$4); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("events"), &eventType, &priorityQueue); } @@ -146,7 +146,7 @@ PHP_METHOD(Phalcon_Events_Manager, attach) priority = 100; } ZVAL_LONG(&_4, priority); - ZEPHIR_CALL_METHOD(NULL, &priorityQueue, "insert", NULL, 268, handler, &_4); + ZEPHIR_CALL_METHOD(NULL, &priorityQueue, "insert", NULL, 271, handler, &_4); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -259,7 +259,7 @@ PHP_METHOD(Phalcon_Events_Manager, detach) } ZVAL_LONG(&_2$$4, 1); - ZEPHIR_CALL_METHOD(NULL, &newPriorityQueue, "setextractflags", NULL, 267, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &newPriorityQueue, "setextractflags", NULL, 270, &_2$$4); zephir_check_call_status(); ZVAL_LONG(&_2$$4, 3); ZEPHIR_CALL_METHOD(NULL, &priorityQueue, "setextractflags", NULL, 0, &_2$$4); @@ -280,7 +280,7 @@ PHP_METHOD(Phalcon_Events_Manager, detach) if (!ZEPHIR_IS_IDENTICAL(&_6$$5, handler)) { zephir_array_fetch_string(&_7$$6, &data, SL("data"), PH_NOISY | PH_READONLY, "phalcon/Events/Manager.zep", 134); zephir_array_fetch_string(&_8$$6, &data, SL("priority"), PH_NOISY | PH_READONLY, "phalcon/Events/Manager.zep", 136); - ZEPHIR_CALL_METHOD(NULL, &newPriorityQueue, "insert", &_9, 268, &_7$$6, &_8$$6); + ZEPHIR_CALL_METHOD(NULL, &newPriorityQueue, "insert", &_9, 271, &_7$$6, &_8$$6); zephir_check_call_status(); } } @@ -461,7 +461,7 @@ PHP_METHOD(Phalcon_Events_Manager, fire) object_init_ex(&_1$$4, phalcon_events_exception_ce); ZEPHIR_INIT_VAR(&_2$$4); ZEPHIR_CONCAT_SV(&_2$$4, "Invalid event type ", &eventType); - ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 29, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_2$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$4, "phalcon/Events/Manager.zep", 198); ZEPHIR_MM_RESTORE(); @@ -488,19 +488,19 @@ PHP_METHOD(Phalcon_Events_Manager, fire) } else { ZVAL_BOOL(&_4, 0); } - ZEPHIR_CALL_METHOD(NULL, &event, "__construct", NULL, 269, &eventName, source, data, &_4); + ZEPHIR_CALL_METHOD(NULL, &event, "__construct", NULL, 272, &eventName, source, data, &_4); zephir_check_call_status(); ZEPHIR_OBS_VAR(&fireEvents); if (zephir_array_isset_fetch(&fireEvents, &events, &type, 0)) { if (Z_TYPE_P(&fireEvents) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&status, this_ptr, "firequeue", NULL, 270, &fireEvents, &event); + ZEPHIR_CALL_METHOD(&status, this_ptr, "firequeue", NULL, 273, &fireEvents, &event); zephir_check_call_status(); } } ZEPHIR_OBS_NVAR(&fireEvents); if (zephir_array_isset_fetch(&fireEvents, &events, &eventType, 0)) { if (Z_TYPE_P(&fireEvents) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&status, this_ptr, "firequeue", NULL, 270, &fireEvents, &event); + ZEPHIR_CALL_METHOD(&status, this_ptr, "firequeue", NULL, 273, &fireEvents, &event); zephir_check_call_status(); } } diff --git a/ext/phalcon/filter/filter.zep.c b/ext/phalcon/filter/filter.zep.c index 4c684f330d8..f3c6bf02148 100644 --- a/ext/phalcon/filter/filter.zep.c +++ b/ext/phalcon/filter/filter.zep.c @@ -254,7 +254,7 @@ PHP_METHOD(Phalcon_Filter_Filter, get) object_init_ex(&_1$$3, phalcon_filter_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Filter ", &name, " is not registered"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Filter/Filter.zep", 121); ZEPHIR_MM_RESTORE(); @@ -265,7 +265,7 @@ PHP_METHOD(Phalcon_Filter_Filter, get) zephir_read_property(&_4$$4, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&definition); zephir_array_fetch(&definition, &_4$$4, &name, PH_NOISY, "phalcon/Filter/Filter.zep", 125); - ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "createinstance", NULL, 271, &definition); + ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "createinstance", NULL, 274, &definition); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("services"), &name, &_5$$4); } @@ -354,7 +354,7 @@ PHP_METHOD(Phalcon_Filter_Filter, sanitize) } else { ZVAL_BOOL(&_0$$3, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processarraysanitizers", NULL, 272, sanitizers, value, &_0$$3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processarraysanitizers", NULL, 275, sanitizers, value, &_0$$3); zephir_check_call_status(); RETURN_MM(); } @@ -363,11 +363,11 @@ PHP_METHOD(Phalcon_Filter_Filter, sanitize) _1 = !noRecursive; } if (_1) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processarrayvalues", NULL, 273, value, sanitizers); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "processarrayvalues", NULL, 276, value, sanitizers); zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "sanitizer", NULL, 274, value, sanitizers); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "sanitizer", NULL, 277, value, sanitizers); zephir_check_call_status(); RETURN_MM(); } @@ -583,7 +583,7 @@ PHP_METHOD(Phalcon_Filter_Filter, processArraySanitizers) } ZEPHIR_INIT_NVAR(&sanitizer); ZVAL_COPY(&sanitizer, _0); - ZEPHIR_CALL_METHOD(&split, this_ptr, "splitsanitizerparameters", &_4, 275, &sanitizerKey, &sanitizer); + ZEPHIR_CALL_METHOD(&split, this_ptr, "splitsanitizerparameters", &_4, 278, &sanitizerKey, &sanitizer); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&sanitizerName); zephir_array_fetch_long(&sanitizerName, &split, 0, PH_NOISY, "phalcon/Filter/Filter.zep", 281); @@ -595,11 +595,11 @@ PHP_METHOD(Phalcon_Filter_Filter, processArraySanitizers) } else { ZVAL_BOOL(&_6$$5, 0); } - ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "processvalueisarray", &_7, 276, value, &sanitizerName, &sanitizerParams, &_6$$5); + ZEPHIR_CALL_METHOD(&_5$$5, this_ptr, "processvalueisarray", &_7, 279, value, &sanitizerName, &sanitizerParams, &_6$$5); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_5$$5); } else { - ZEPHIR_CALL_METHOD(&_8$$6, this_ptr, "processvalueisnotarray", &_9, 277, value, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_8$$6, this_ptr, "processvalueisnotarray", &_9, 280, value, &sanitizerName, &sanitizerParams); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_8$$6); } @@ -617,7 +617,7 @@ PHP_METHOD(Phalcon_Filter_Filter, processArraySanitizers) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&sanitizer, &sanitizers, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&split, this_ptr, "splitsanitizerparameters", &_4, 275, &sanitizerKey, &sanitizer); + ZEPHIR_CALL_METHOD(&split, this_ptr, "splitsanitizerparameters", &_4, 278, &sanitizerKey, &sanitizer); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&sanitizerName); zephir_array_fetch_long(&sanitizerName, &split, 0, PH_NOISY, "phalcon/Filter/Filter.zep", 281); @@ -629,11 +629,11 @@ PHP_METHOD(Phalcon_Filter_Filter, processArraySanitizers) } else { ZVAL_BOOL(&_11$$8, 0); } - ZEPHIR_CALL_METHOD(&_10$$8, this_ptr, "processvalueisarray", &_7, 276, value, &sanitizerName, &sanitizerParams, &_11$$8); + ZEPHIR_CALL_METHOD(&_10$$8, this_ptr, "processvalueisarray", &_7, 279, value, &sanitizerName, &sanitizerParams, &_11$$8); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_10$$8); } else { - ZEPHIR_CALL_METHOD(&_12$$9, this_ptr, "processvalueisnotarray", &_9, 277, value, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_12$$9, this_ptr, "processvalueisnotarray", &_9, 280, value, &sanitizerName, &sanitizerParams); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_12$$9); } @@ -715,7 +715,7 @@ PHP_METHOD(Phalcon_Filter_Filter, processArrayValues) } ZEPHIR_INIT_NVAR(&itemValue); ZVAL_COPY(&itemValue, _0); - ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "sanitizer", &_5, 274, &itemValue, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "sanitizer", &_5, 277, &itemValue, &sanitizerName, &sanitizerParams); zephir_check_call_status(); zephir_array_update_zval(&arrayValues, &itemKey, &_4$$3, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); @@ -732,7 +732,7 @@ PHP_METHOD(Phalcon_Filter_Filter, processArrayValues) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&itemValue, &values, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "sanitizer", &_5, 274, &itemValue, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "sanitizer", &_5, 277, &itemValue, &sanitizerName, &sanitizerParams); zephir_check_call_status(); zephir_array_update_zval(&arrayValues, &itemKey, &_6$$4, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); @@ -863,11 +863,11 @@ PHP_METHOD(Phalcon_Filter_Filter, processValueIsArray) if (noRecursive) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "sanitizer", NULL, 274, value, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "sanitizer", NULL, 277, value, &sanitizerName, &sanitizerParams); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_0$$3); } else { - ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "processarrayvalues", NULL, 273, value, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "processarrayvalues", NULL, 276, value, &sanitizerName, &sanitizerParams); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_1$$4); } @@ -914,7 +914,7 @@ PHP_METHOD(Phalcon_Filter_Filter, processValueIsNotArray) if (Z_TYPE_P(value) != IS_ARRAY) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "sanitizer", NULL, 274, value, &sanitizerName, &sanitizerParams); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "sanitizer", NULL, 277, value, &sanitizerName, &sanitizerParams); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_0$$3); } diff --git a/ext/phalcon/filter/filterfactory.zep.c b/ext/phalcon/filter/filterfactory.zep.c index 3407021a26a..5b30dc3c1ee 100644 --- a/ext/phalcon/filter/filterfactory.zep.c +++ b/ext/phalcon/filter/filterfactory.zep.c @@ -59,7 +59,7 @@ PHP_METHOD(Phalcon_Filter_FilterFactory, newInstance) object_init_ex(return_value, phalcon_filter_filter_ce); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getservices", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 278, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 281, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/absint.zep.c b/ext/phalcon/filter/sanitize/absint.zep.c index 19f9c8f74d3..d332cb207ec 100644 --- a/ext/phalcon/filter/sanitize/absint.zep.c +++ b/ext/phalcon/filter/sanitize/absint.zep.c @@ -66,10 +66,10 @@ PHP_METHOD(Phalcon_Filter_Sanitize_AbsInt, __invoke) ZVAL_LONG(&_0, 519); - ZEPHIR_CALL_FUNCTION(&_1, "filter_var", NULL, 279, input, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "filter_var", NULL, 282, input, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, zephir_get_intval(&_1)); - ZEPHIR_RETURN_CALL_FUNCTION("abs", NULL, 280, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("abs", NULL, 283, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/alnum.zep.c b/ext/phalcon/filter/sanitize/alnum.zep.c index 77e56e8f18f..526ad8d823e 100644 --- a/ext/phalcon/filter/sanitize/alnum.zep.c +++ b/ext/phalcon/filter/sanitize/alnum.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Alnum, __invoke) ZVAL_STRING(&_0, "/[^A-Za-z0-9]/"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, ""); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 37, &_0, &_1, input); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 40, &_0, &_1, input); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/alpha.zep.c b/ext/phalcon/filter/sanitize/alpha.zep.c index d5d3b5251d1..3e8059ae93c 100644 --- a/ext/phalcon/filter/sanitize/alpha.zep.c +++ b/ext/phalcon/filter/sanitize/alpha.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Alpha, __invoke) ZVAL_STRING(&_0, "/[^A-Za-z]/"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, ""); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 37, &_0, &_1, input); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 40, &_0, &_1, input); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/email.zep.c b/ext/phalcon/filter/sanitize/email.zep.c index 3358941b1ce..3c000ca7e7d 100644 --- a/ext/phalcon/filter/sanitize/email.zep.c +++ b/ext/phalcon/filter/sanitize/email.zep.c @@ -66,7 +66,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Email, __invoke) ZVAL_LONG(&_0, 517); ZVAL_LONG(&_1, 1048576); - ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 279, input, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 282, input, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/floatval.zep.c b/ext/phalcon/filter/sanitize/floatval.zep.c index 75ed8cb3784..62f9e26ca4e 100644 --- a/ext/phalcon/filter/sanitize/floatval.zep.c +++ b/ext/phalcon/filter/sanitize/floatval.zep.c @@ -72,7 +72,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_FloatVal, __invoke) zephir_create_array(&_0, 1, 0); add_assoc_long_ex(&_0, SL("flags"), 4096); ZVAL_LONG(&_1, 520); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 279, input, &_1, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 282, input, &_1, &_0); zephir_check_call_status(); RETURN_MM_DOUBLE(zephir_get_doubleval(&_2)); } diff --git a/ext/phalcon/filter/sanitize/intval.zep.c b/ext/phalcon/filter/sanitize/intval.zep.c index 713467512d4..43649fcd7a2 100644 --- a/ext/phalcon/filter/sanitize/intval.zep.c +++ b/ext/phalcon/filter/sanitize/intval.zep.c @@ -66,7 +66,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_IntVal, __invoke) ZVAL_LONG(&_0, 519); - ZEPHIR_CALL_FUNCTION(&_1, "filter_var", NULL, 279, input, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "filter_var", NULL, 282, input, &_0); zephir_check_call_status(); RETURN_MM_LONG(zephir_get_intval(&_1)); } diff --git a/ext/phalcon/filter/sanitize/lower.zep.c b/ext/phalcon/filter/sanitize/lower.zep.c index d1617980a16..953b4196cf7 100644 --- a/ext/phalcon/filter/sanitize/lower.zep.c +++ b/ext/phalcon/filter/sanitize/lower.zep.c @@ -87,7 +87,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Lower, __invoke) zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 281, &input); + ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 284, &input); zephir_check_call_status(); zephir_fast_strtolower(return_value, &_2); RETURN_MM(); diff --git a/ext/phalcon/filter/sanitize/lowerfirst.zep.c b/ext/phalcon/filter/sanitize/lowerfirst.zep.c index 47b8c23cac9..48e63fcaa72 100644 --- a/ext/phalcon/filter/sanitize/lowerfirst.zep.c +++ b/ext/phalcon/filter/sanitize/lowerfirst.zep.c @@ -75,7 +75,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_LowerFirst, __invoke) } - ZEPHIR_RETURN_CALL_FUNCTION("lcfirst", NULL, 73, &input); + ZEPHIR_RETURN_CALL_FUNCTION("lcfirst", NULL, 76, &input); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/regex.zep.c b/ext/phalcon/filter/sanitize/regex.zep.c index b0fa62060e7..cd99840574f 100644 --- a/ext/phalcon/filter/sanitize/regex.zep.c +++ b/ext/phalcon/filter/sanitize/regex.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Regex, __invoke) zephir_fetch_params(1, 3, 0, &input, &pattern, &replace); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 37, pattern, replace, input); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 40, pattern, replace, input); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/special.zep.c b/ext/phalcon/filter/sanitize/special.zep.c index a385fd928b0..90856af992d 100644 --- a/ext/phalcon/filter/sanitize/special.zep.c +++ b/ext/phalcon/filter/sanitize/special.zep.c @@ -64,7 +64,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Special, __invoke) ZVAL_LONG(&_0, 515); - ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 279, input, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 282, input, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/specialfull.zep.c b/ext/phalcon/filter/sanitize/specialfull.zep.c index ed381b828aa..cd506142e56 100644 --- a/ext/phalcon/filter/sanitize/specialfull.zep.c +++ b/ext/phalcon/filter/sanitize/specialfull.zep.c @@ -64,7 +64,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_SpecialFull, __invoke) ZVAL_LONG(&_0, 522); - ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 279, input, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 282, input, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/stringval.zep.c b/ext/phalcon/filter/sanitize/stringval.zep.c index 343fd0f2993..6bad4674f7f 100644 --- a/ext/phalcon/filter/sanitize/stringval.zep.c +++ b/ext/phalcon/filter/sanitize/stringval.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_StringVal, __invoke) ZVAL_LONG(&_0, flags); - ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 282, &input, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 285, &input, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/stringvallegacy.zep.c b/ext/phalcon/filter/sanitize/stringvallegacy.zep.c index 84d7e18dabf..94e64724308 100644 --- a/ext/phalcon/filter/sanitize/stringvallegacy.zep.c +++ b/ext/phalcon/filter/sanitize/stringvallegacy.zep.c @@ -83,7 +83,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_StringValLegacy, __invoke) } if (_0) { ZVAL_LONG(&_2$$3, 513); - ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 279, input, &_2$$3); + ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 282, input, &_2$$3); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/striptags.zep.c b/ext/phalcon/filter/sanitize/striptags.zep.c index 4e4425e464c..365dad2cce2 100644 --- a/ext/phalcon/filter/sanitize/striptags.zep.c +++ b/ext/phalcon/filter/sanitize/striptags.zep.c @@ -75,7 +75,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Striptags, __invoke) } - ZEPHIR_RETURN_CALL_FUNCTION("strip_tags", NULL, 283, &input); + ZEPHIR_RETURN_CALL_FUNCTION("strip_tags", NULL, 286, &input); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/upper.zep.c b/ext/phalcon/filter/sanitize/upper.zep.c index f894032d983..f788aeaad08 100644 --- a/ext/phalcon/filter/sanitize/upper.zep.c +++ b/ext/phalcon/filter/sanitize/upper.zep.c @@ -87,7 +87,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Upper, __invoke) zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 281, &input); + ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 284, &input); zephir_check_call_status(); zephir_fast_strtoupper(return_value, &_2); RETURN_MM(); diff --git a/ext/phalcon/filter/sanitize/upperwords.zep.c b/ext/phalcon/filter/sanitize/upperwords.zep.c index fac1480a1f6..9aec8cecfd8 100644 --- a/ext/phalcon/filter/sanitize/upperwords.zep.c +++ b/ext/phalcon/filter/sanitize/upperwords.zep.c @@ -86,9 +86,9 @@ PHP_METHOD(Phalcon_Filter_Sanitize_UpperWords, __invoke) zephir_check_call_status(); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 281, &input); + ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 284, &input); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("ucwords", NULL, 284, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("ucwords", NULL, 287, &_2); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/sanitize/url.zep.c b/ext/phalcon/filter/sanitize/url.zep.c index 9478222d823..ad2398ac9fa 100644 --- a/ext/phalcon/filter/sanitize/url.zep.c +++ b/ext/phalcon/filter/sanitize/url.zep.c @@ -64,7 +64,7 @@ PHP_METHOD(Phalcon_Filter_Sanitize_Url, __invoke) ZVAL_LONG(&_0, 518); - ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 279, input, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("filter_var", NULL, 282, input, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/filter/validation.zep.c b/ext/phalcon/filter/validation.zep.c index 4e2016cfb33..a9c6746932e 100644 --- a/ext/phalcon/filter/validation.zep.c +++ b/ext/phalcon/filter/validation.zep.c @@ -246,7 +246,7 @@ PHP_METHOD(Phalcon_Filter_Validation, appendMessage) ZEPHIR_CALL_METHOD(NULL, &messages, "__construct", NULL, 8); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &messages, "appendmessage", NULL, 285, message); + ZEPHIR_CALL_METHOD(NULL, &messages, "appendmessage", NULL, 288, message); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("messages"), &messages); RETURN_THIS(); @@ -647,7 +647,7 @@ PHP_METHOD(Phalcon_Filter_Validation, getValue) zephir_camelize(&_6$$13, &field, NULL ); ZEPHIR_INIT_VAR(&method); ZEPHIR_CONCAT_SV(&method, "set", &_6$$13); - ZEPHIR_CALL_FUNCTION(&_7$$13, "property_exists", NULL, 286, &entity, &field); + ZEPHIR_CALL_FUNCTION(&_7$$13, "property_exists", NULL, 289, &entity, &field); zephir_check_call_status(); if ((zephir_method_exists(&entity, &method) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(NULL, &entity, &method, NULL, 0, &value); @@ -1329,7 +1329,7 @@ PHP_METHOD(Phalcon_Filter_Validation, preChecking) { ZEPHIR_INIT_NVAR(&singleField); ZVAL_COPY(&singleField, _0$$3); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "prechecking", &_3, 287, &singleField, validator); + ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "prechecking", &_3, 290, &singleField, validator); zephir_check_call_status(); zephir_array_append(&results, &_2$$4, PH_SEPARATE, "phalcon/Filter/Validation.zep", 607); if (zephir_fast_in_array(&__$false, &results)) { @@ -1348,7 +1348,7 @@ PHP_METHOD(Phalcon_Filter_Validation, preChecking) } ZEPHIR_CALL_METHOD(&singleField, field, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "prechecking", &_3, 287, &singleField, validator); + ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "prechecking", &_3, 290, &singleField, validator); zephir_check_call_status(); zephir_array_append(&results, &_4$$6, PH_SEPARATE, "phalcon/Filter/Validation.zep", 607); if (zephir_fast_in_array(&__$false, &results)) { diff --git a/ext/phalcon/filter/validation/abstractvalidatorcomposite.zep.c b/ext/phalcon/filter/validation/abstractvalidatorcomposite.zep.c index 0657f380440..9cc13e1d900 100644 --- a/ext/phalcon/filter/validation/abstractvalidatorcomposite.zep.c +++ b/ext/phalcon/filter/validation/abstractvalidatorcomposite.zep.c @@ -100,7 +100,7 @@ PHP_METHOD(Phalcon_Filter_Validation_AbstractValidatorComposite, validate) zephir_get_class(&_2$$3, this_ptr, 0); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_VS(&_3$$3, &_2$$3, " does not have any validator added"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Filter/Validation/AbstractValidatorComposite.zep", 41); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/filter/validation/validator/alnum.zep.c b/ext/phalcon/filter/validation/validator/alnum.zep.c index ef57bf166f9..d34593ca226 100644 --- a/ext/phalcon/filter/validation/validator/alnum.zep.c +++ b/ext/phalcon/filter/validation/validator/alnum.zep.c @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Alnum, validate) RETURN_MM_BOOL(1); } zephir_cast_to_string(&_1, &value); - ZEPHIR_CALL_FUNCTION(&_2, "ctype_alnum", NULL, 288, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "ctype_alnum", NULL, 291, &_1); zephir_check_call_status(); if (!(zephir_is_true(&_2))) { ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "messagefactory", NULL, 0, validation, field); diff --git a/ext/phalcon/filter/validation/validator/callback.zep.c b/ext/phalcon/filter/validation/validator/callback.zep.c index e0ce7af5f02..95bc2931566 100644 --- a/ext/phalcon/filter/validation/validator/callback.zep.c +++ b/ext/phalcon/filter/validation/validator/callback.zep.c @@ -165,7 +165,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Callback, validate) ZEPHIR_CALL_METHOD(&data, validation, "getdata", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_FUNCTION(&returnedValue, "call_user_func", NULL, 184, &callback, &data); + ZEPHIR_CALL_FUNCTION(&returnedValue, "call_user_func", NULL, 187, &callback, &data); zephir_check_call_status(); _1$$3 = Z_TYPE_P(&returnedValue) == IS_OBJECT; if (_1$$3) { diff --git a/ext/phalcon/filter/validation/validator/confirmation.zep.c b/ext/phalcon/filter/validation/validator/confirmation.zep.c index e6c567245f3..1bfc269ed65 100644 --- a/ext/phalcon/filter/validation/validator/confirmation.zep.c +++ b/ext/phalcon/filter/validation/validator/confirmation.zep.c @@ -174,7 +174,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Confirmation, validate) zephir_check_call_status(); zephir_cast_to_string(&_3, &value); zephir_cast_to_string(&_4, &valueWith); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 289, &_3, &_4); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "compare", NULL, 292, &_3, &_4); zephir_check_call_status(); if (!(zephir_is_true(&_2))) { ZEPHIR_INIT_VAR(&_5$$4); @@ -257,7 +257,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Confirmation, compare) zephir_check_call_status(); zephir_get_strval(&b, &_5$$3); } - ZEPHIR_CALL_FUNCTION(&_6, "strcmp", NULL, 290, &a, &b); + ZEPHIR_CALL_FUNCTION(&_6, "strcmp", NULL, 293, &a, &b); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_LONG_IDENTICAL(&_6, 0)); } diff --git a/ext/phalcon/filter/validation/validator/creditcard.zep.c b/ext/phalcon/filter/validation/validator/creditcard.zep.c index ffaeae2bb34..49128df3724 100644 --- a/ext/phalcon/filter/validation/validator/creditcard.zep.c +++ b/ext/phalcon/filter/validation/validator/creditcard.zep.c @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_CreditCard, validate) RETURN_MM_BOOL(1); } zephir_cast_to_string(&_1, &value); - ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 291, &_1); + ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 294, &_1); zephir_check_call_status(); if (!(zephir_is_true(&valid))) { ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "messagefactory", NULL, 0, validation, field); @@ -208,11 +208,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_CreditCard, verifyByLuhnAlgorithm ZEPHIR_INIT_VAR(&hash); ZVAL_STRING(&hash, ""); - ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 84, &number); + ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 87, &number); zephir_check_call_status(); zephir_get_arrval(&_1, &_0); ZEPHIR_CPY_WRT(&digits, &_1); - ZEPHIR_CALL_FUNCTION(&_3, "array_reverse", NULL, 292, &digits); + ZEPHIR_CALL_FUNCTION(&_3, "array_reverse", NULL, 295, &digits); zephir_check_call_status(); zephir_is_iterable(&_3, 0, "phalcon/Filter/Validation/Validator/CreditCard.zep", 109); if (Z_TYPE_P(&_3) == IS_ARRAY) { @@ -262,9 +262,9 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_CreditCard, verifyByLuhnAlgorithm } ZEPHIR_INIT_NVAR(&digit); ZEPHIR_INIT_NVAR(&position); - ZEPHIR_CALL_FUNCTION(&_10, "str_split", NULL, 84, &hash); + ZEPHIR_CALL_FUNCTION(&_10, "str_split", NULL, 87, &hash); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 293, &_10); + ZEPHIR_CALL_FUNCTION(&result, "array_sum", NULL, 296, &_10); zephir_check_call_status(); RETURN_MM_BOOL((zephir_safe_mod_zval_long(&result, 10) == 0)); } diff --git a/ext/phalcon/filter/validation/validator/date.zep.c b/ext/phalcon/filter/validation/validator/date.zep.c index e616e46d2a0..6ffdd1b9452 100644 --- a/ext/phalcon/filter/validation/validator/date.zep.c +++ b/ext/phalcon/filter/validation/validator/date.zep.c @@ -171,7 +171,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Date, validate) ZEPHIR_INIT_NVAR(&format); ZVAL_STRING(&format, "Y-m-d"); } - ZEPHIR_CALL_METHOD(&_3, this_ptr, "checkdate", NULL, 294, &value, &format); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "checkdate", NULL, 297, &value, &format); zephir_check_call_status(); if (!(zephir_is_true(&_3))) { ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "messagefactory", NULL, 0, validation, field); diff --git a/ext/phalcon/filter/validation/validator/digit.zep.c b/ext/phalcon/filter/validation/validator/digit.zep.c index 2187dede171..cce3f6f3daa 100644 --- a/ext/phalcon/filter/validation/validator/digit.zep.c +++ b/ext/phalcon/filter/validation/validator/digit.zep.c @@ -155,7 +155,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Digit, validate) _1 = Z_TYPE_P(&value) == IS_LONG; if (!(_1)) { zephir_cast_to_string(&_2, &value); - ZEPHIR_CALL_FUNCTION(&_3, "ctype_digit", NULL, 295, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "ctype_digit", NULL, 298, &_2); zephir_check_call_status(); _1 = zephir_is_true(&_3); } diff --git a/ext/phalcon/filter/validation/validator/email.zep.c b/ext/phalcon/filter/validation/validator/email.zep.c index 00ee8621333..c78b3afc66a 100644 --- a/ext/phalcon/filter/validation/validator/email.zep.c +++ b/ext/phalcon/filter/validation/validator/email.zep.c @@ -151,7 +151,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Email, validate) RETURN_MM_BOOL(1); } ZVAL_LONG(&_1, 274); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 279, &value, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 282, &value, &_1); zephir_check_call_status(); if (!(zephir_is_true(&_2))) { ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "messagefactory", NULL, 0, validation, field); diff --git a/ext/phalcon/filter/validation/validator/exclusionin.zep.c b/ext/phalcon/filter/validation/validator/exclusionin.zep.c index e6fc892ae76..d29c6da1bb5 100644 --- a/ext/phalcon/filter/validation/validator/exclusionin.zep.c +++ b/ext/phalcon/filter/validation/validator/exclusionin.zep.c @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_ExclusionIn, validate) return; } } - ZEPHIR_CALL_FUNCTION(&_5, "in_array", NULL, 296, &value, &domain, &strict); + ZEPHIR_CALL_FUNCTION(&_5, "in_array", NULL, 299, &value, &domain, &strict); zephir_check_call_status(); if (zephir_is_true(&_5)) { ZEPHIR_INIT_VAR(&replacePairs); diff --git a/ext/phalcon/filter/validation/validator/file.zep.c b/ext/phalcon/filter/validation/validator/file.zep.c index 509396b0415..8e90691df79 100644 --- a/ext/phalcon/filter/validation/validator/file.zep.c +++ b/ext/phalcon/filter/validation/validator/file.zep.c @@ -242,21 +242,21 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) if (zephir_array_isset_string(&options, SL("messageFileEmpty"))) { ZEPHIR_INIT_VAR(&_0$$3); ZVAL_STRING(&_0$$3, "messageFileEmpty"); - ZEPHIR_CALL_METHOD(&messageFileEmpty, &helper, "__invoke", NULL, 155, &options, &_0$$3); + ZEPHIR_CALL_METHOD(&messageFileEmpty, &helper, "__invoke", NULL, 158, &options, &_0$$3); zephir_check_call_status(); zephir_array_unset_string(&options, SL("messageFileEmpty"), PH_SEPARATE); } if (zephir_array_isset_string(&options, SL("messageIniSize"))) { ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "messageIniSize"); - ZEPHIR_CALL_METHOD(&messageIniSize, &helper, "__invoke", NULL, 155, &options, &_1$$4); + ZEPHIR_CALL_METHOD(&messageIniSize, &helper, "__invoke", NULL, 158, &options, &_1$$4); zephir_check_call_status(); zephir_array_unset_string(&options, SL("messageIniSize"), PH_SEPARATE); } if (zephir_array_isset_string(&options, SL("messageValid"))) { ZEPHIR_INIT_VAR(&_2$$5); ZVAL_STRING(&_2$$5, "messageValid"); - ZEPHIR_CALL_METHOD(&messageValid, &helper, "__invoke", NULL, 155, &options, &_2$$5); + ZEPHIR_CALL_METHOD(&messageValid, &helper, "__invoke", NULL, 158, &options, &_2$$5); zephir_check_call_status(); zephir_array_unset_string(&options, SL("messageValid"), PH_SEPARATE); } @@ -274,40 +274,40 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) ZVAL_COPY(&value, _3); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "minSize"); - ZEPHIR_CALL_FUNCTION(&_8$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_8$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "maxSize"); - ZEPHIR_CALL_FUNCTION(&_10$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_10$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "equalSize"); - ZEPHIR_CALL_FUNCTION(&_11$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "allowedTypes"); - ZEPHIR_CALL_FUNCTION(&_12$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_12$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "maxResolution"); - ZEPHIR_CALL_FUNCTION(&_13$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_13$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "minResolution"); - ZEPHIR_CALL_FUNCTION(&_14$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_14$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_7$$6); ZVAL_STRING(&_7$$6, "equalResolution"); - ZEPHIR_CALL_FUNCTION(&_15$$6, "strcasecmp", &_9, 35, &key, &_7$$6); + ZEPHIR_CALL_FUNCTION(&_15$$6, "strcasecmp", &_9, 38, &key, &_7$$6); zephir_check_call_status(); if (ZEPHIR_IS_LONG_IDENTICAL(&_8$$6, 0)) { ZEPHIR_INIT_NVAR(&_16$$7); ZVAL_STRING(&_16$$7, "messageMinSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_16$$7); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_16$$7); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_16$$7); ZVAL_STRING(&_16$$7, "includedMinSize"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_16$$7); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_16$$7); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_min_ce); @@ -316,18 +316,18 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_17$$7, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_17$$7, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_17$$7, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_18, 297, &_17$$7); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_18, 300, &_17$$7); zephir_check_call_status(); zephir_array_unset_string(&options, SL("messageMinSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMinSize"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_10$$6, 0)) { ZEPHIR_INIT_NVAR(&_19$$8); ZVAL_STRING(&_19$$8, "messageSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_19$$8); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_19$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_19$$8); ZVAL_STRING(&_19$$8, "includedSize"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_19$$8); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_19$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_max_ce); @@ -336,7 +336,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_20$$8, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_20$$8, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_20$$8, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_21, 298, &_20$$8); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_21, 301, &_20$$8); zephir_check_call_status(); zephir_array_unset_string(&options, SL("maxSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageSize"), PH_SEPARATE); @@ -344,7 +344,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_11$$6, 0)) { ZEPHIR_INIT_NVAR(&_22$$9); ZVAL_STRING(&_22$$9, "messageEqualSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_22$$9); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_22$$9); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_equal_ce); @@ -352,14 +352,14 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_23$$9, 2, 0); zephir_array_update_string(&_23$$9, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_23$$9, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_24, 299, &_23$$9); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_24, 302, &_23$$9); zephir_check_call_status(); zephir_array_unset_string(&options, SL("equalSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageEqualSize"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_12$$6, 0)) { ZEPHIR_INIT_NVAR(&_25$$10); ZVAL_STRING(&_25$$10, "messageType"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_25$$10); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_25$$10); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_mimetype_ce); @@ -367,18 +367,18 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_26$$10, 2, 0); zephir_array_update_string(&_26$$10, SL("types"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_26$$10, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_27, 300, &_26$$10); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_27, 303, &_26$$10); zephir_check_call_status(); zephir_array_unset_string(&options, SL("allowedTypes"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageType"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_13$$6, 0)) { ZEPHIR_INIT_NVAR(&_28$$11); ZVAL_STRING(&_28$$11, "messageMaxResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_28$$11); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_28$$11); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_28$$11); ZVAL_STRING(&_28$$11, "includedMaxResolution"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_28$$11); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_28$$11); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_max_ce); @@ -387,7 +387,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_29$$11, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_29$$11, SL("included"), &included, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_29$$11, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_30, 301, &_29$$11); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_30, 304, &_29$$11); zephir_check_call_status(); zephir_array_unset_string(&options, SL("maxResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMaxResolution"), PH_SEPARATE); @@ -395,11 +395,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_14$$6, 0)) { ZEPHIR_INIT_NVAR(&_31$$12); ZVAL_STRING(&_31$$12, "messageMinResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_31$$12); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_31$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_31$$12); ZVAL_STRING(&_31$$12, "includedMinResolution"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_31$$12); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_31$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_min_ce); @@ -408,7 +408,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_32$$12, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_32$$12, SL("included"), &included, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_32$$12, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_33, 302, &_32$$12); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_33, 305, &_32$$12); zephir_check_call_status(); zephir_array_unset_string(&options, SL("minResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMinResolution"), PH_SEPARATE); @@ -416,7 +416,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_15$$6, 0)) { ZEPHIR_INIT_NVAR(&_34$$13); ZVAL_STRING(&_34$$13, "messageEqualResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_34$$13); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_34$$13); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_equal_ce); @@ -424,7 +424,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_35$$13, 2, 0); zephir_array_update_string(&_35$$13, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_35$$13, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_35$$13); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_35$$13); zephir_check_call_status(); zephir_array_unset_string(&options, SL("equalResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageEqualResolution"), PH_SEPARATE); @@ -432,15 +432,15 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) continue; } if (Z_TYPE_P(&messageFileEmpty) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagefileempty", &_37, 304, &messageFileEmpty); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagefileempty", &_37, 307, &messageFileEmpty); zephir_check_call_status(); } if (Z_TYPE_P(&messageIniSize) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessageinisize", &_38, 305, &messageIniSize); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessageinisize", &_38, 308, &messageIniSize); zephir_check_call_status(); } if (Z_TYPE_P(&messageValid) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagevalid", &_39, 306, &messageValid); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagevalid", &_39, 309, &messageValid); zephir_check_call_status(); } zephir_update_property_array_append(this_ptr, SL("validators"), &validator); @@ -460,40 +460,40 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "minSize"); - ZEPHIR_CALL_FUNCTION(&_41$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_41$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "maxSize"); - ZEPHIR_CALL_FUNCTION(&_42$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_42$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "equalSize"); - ZEPHIR_CALL_FUNCTION(&_43$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_43$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "allowedTypes"); - ZEPHIR_CALL_FUNCTION(&_44$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_44$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "maxResolution"); - ZEPHIR_CALL_FUNCTION(&_45$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_45$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "minResolution"); - ZEPHIR_CALL_FUNCTION(&_46$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_46$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_40$$18); ZVAL_STRING(&_40$$18, "equalResolution"); - ZEPHIR_CALL_FUNCTION(&_47$$18, "strcasecmp", &_9, 35, &key, &_40$$18); + ZEPHIR_CALL_FUNCTION(&_47$$18, "strcasecmp", &_9, 38, &key, &_40$$18); zephir_check_call_status(); if (ZEPHIR_IS_LONG_IDENTICAL(&_41$$18, 0)) { ZEPHIR_INIT_NVAR(&_48$$19); ZVAL_STRING(&_48$$19, "messageMinSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_48$$19); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_48$$19); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_48$$19); ZVAL_STRING(&_48$$19, "includedMinSize"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_48$$19); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_48$$19); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_min_ce); @@ -502,18 +502,18 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_49$$19, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_49$$19, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_49$$19, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_49$$19); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_49$$19); zephir_check_call_status(); zephir_array_unset_string(&options, SL("messageMinSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMinSize"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_42$$18, 0)) { ZEPHIR_INIT_NVAR(&_50$$20); ZVAL_STRING(&_50$$20, "messageSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_50$$20); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_50$$20); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_50$$20); ZVAL_STRING(&_50$$20, "includedSize"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_50$$20); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_50$$20); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_max_ce); @@ -522,7 +522,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_51$$20, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_51$$20, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_51$$20, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_51$$20); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_51$$20); zephir_check_call_status(); zephir_array_unset_string(&options, SL("maxSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageSize"), PH_SEPARATE); @@ -530,7 +530,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_43$$18, 0)) { ZEPHIR_INIT_NVAR(&_52$$21); ZVAL_STRING(&_52$$21, "messageEqualSize"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_52$$21); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_52$$21); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_size_equal_ce); @@ -538,14 +538,14 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_53$$21, 2, 0); zephir_array_update_string(&_53$$21, SL("size"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_53$$21, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_53$$21); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_53$$21); zephir_check_call_status(); zephir_array_unset_string(&options, SL("equalSize"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageEqualSize"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_44$$18, 0)) { ZEPHIR_INIT_NVAR(&_54$$22); ZVAL_STRING(&_54$$22, "messageType"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_54$$22); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_54$$22); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_mimetype_ce); @@ -553,18 +553,18 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_55$$22, 2, 0); zephir_array_update_string(&_55$$22, SL("types"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_55$$22, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_55$$22); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_55$$22); zephir_check_call_status(); zephir_array_unset_string(&options, SL("allowedTypes"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageType"), PH_SEPARATE); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_45$$18, 0)) { ZEPHIR_INIT_NVAR(&_56$$23); ZVAL_STRING(&_56$$23, "messageMaxResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_56$$23); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_56$$23); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_56$$23); ZVAL_STRING(&_56$$23, "includedMaxResolution"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_56$$23); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_56$$23); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_max_ce); @@ -573,7 +573,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_57$$23, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_57$$23, SL("included"), &included, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_57$$23, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_57$$23); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_57$$23); zephir_check_call_status(); zephir_array_unset_string(&options, SL("maxResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMaxResolution"), PH_SEPARATE); @@ -581,11 +581,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_46$$18, 0)) { ZEPHIR_INIT_NVAR(&_58$$24); ZVAL_STRING(&_58$$24, "messageMinResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_58$$24); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_58$$24); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_58$$24); ZVAL_STRING(&_58$$24, "includedMinResolution"); - ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 155, &options, &_58$$24); + ZEPHIR_CALL_METHOD(&included, &helper, "__invoke", NULL, 158, &options, &_58$$24); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_min_ce); @@ -594,7 +594,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_array_update_string(&_59$$24, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_59$$24, SL("included"), &included, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_59$$24, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_59$$24); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_59$$24); zephir_check_call_status(); zephir_array_unset_string(&options, SL("minResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("includedMinResolution"), PH_SEPARATE); @@ -602,7 +602,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) } else if (ZEPHIR_IS_LONG_IDENTICAL(&_47$$18, 0)) { ZEPHIR_INIT_NVAR(&_60$$25); ZVAL_STRING(&_60$$25, "messageEqualResolution"); - ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 155, &options, &_60$$25); + ZEPHIR_CALL_METHOD(&message, &helper, "__invoke", NULL, 158, &options, &_60$$25); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&validator); object_init_ex(&validator, phalcon_filter_validation_validator_file_resolution_equal_ce); @@ -610,7 +610,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) zephir_create_array(&_61$$25, 2, 0); zephir_array_update_string(&_61$$25, SL("resolution"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_61$$25, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 303, &_61$$25); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_36, 306, &_61$$25); zephir_check_call_status(); zephir_array_unset_string(&options, SL("equalResolution"), PH_SEPARATE); zephir_array_unset_string(&options, SL("messageEqualResolution"), PH_SEPARATE); @@ -618,15 +618,15 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File, __construct) continue; } if (Z_TYPE_P(&messageFileEmpty) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagefileempty", &_37, 304, &messageFileEmpty); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagefileempty", &_37, 307, &messageFileEmpty); zephir_check_call_status(); } if (Z_TYPE_P(&messageIniSize) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessageinisize", &_38, 305, &messageIniSize); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessageinisize", &_38, 308, &messageIniSize); zephir_check_call_status(); } if (Z_TYPE_P(&messageValid) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagevalid", &_39, 306, &messageValid); + ZEPHIR_CALL_METHOD(NULL, &validator, "setmessagevalid", &_39, 309, &messageValid); zephir_check_call_status(); } zephir_update_property_array_append(this_ptr, SL("validators"), &validator); diff --git a/ext/phalcon/filter/validation/validator/file/mimetype.zep.c b/ext/phalcon/filter/validation/validator/file/mimetype.zep.c index 5945ec2c6d6..7df6551a786 100644 --- a/ext/phalcon/filter/validation/validator/file/mimetype.zep.c +++ b/ext/phalcon/filter/validation/validator/file/mimetype.zep.c @@ -147,12 +147,12 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File_MimeType, validate) } if ((zephir_function_exists_ex(ZEND_STRL("finfo_open")) == SUCCESS)) { ZVAL_LONG(&_2$$6, 16); - ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 307, &_2$$6); + ZEPHIR_CALL_FUNCTION(&tmp, "finfo_open", NULL, 310, &_2$$6); zephir_check_call_status(); zephir_array_fetch_string(&_3$$6, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Filter/Validation/Validator/File/MimeType.zep", 101); - ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 308, &tmp, &_3$$6); + ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 311, &tmp, &_3$$6); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 309, &tmp); + ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 312, &tmp); zephir_check_call_status(); } else { ZEPHIR_OBS_NVAR(&mime); diff --git a/ext/phalcon/filter/validation/validator/file/resolution/equal.zep.c b/ext/phalcon/filter/validation/validator/file/resolution/equal.zep.c index 7f0e59ab96a..1ffad3f548d 100644 --- a/ext/phalcon/filter/validation/validator/file/resolution/equal.zep.c +++ b/ext/phalcon/filter/validation/validator/file/resolution/equal.zep.c @@ -169,7 +169,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File_Resolution_Equal, validate) ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); zephir_array_fetch_string(&_1, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Filter/Validation/Validator/File/Resolution/Equal.zep", 88); - ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 310, &_1); + ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 313, &_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(&width); zephir_array_fetch_long(&width, &tmp, 0, PH_NOISY, "phalcon/Filter/Validation/Validator/File/Resolution/Equal.zep", 89); diff --git a/ext/phalcon/filter/validation/validator/file/resolution/max.zep.c b/ext/phalcon/filter/validation/validator/file/resolution/max.zep.c index d344a114a16..efcf3e93ace 100644 --- a/ext/phalcon/filter/validation/validator/file/resolution/max.zep.c +++ b/ext/phalcon/filter/validation/validator/file/resolution/max.zep.c @@ -180,7 +180,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File_Resolution_Max, validate) ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); zephir_array_fetch_string(&_1, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Filter/Validation/Validator/File/Resolution/Max.zep", 94); - ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 310, &_1); + ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 313, &_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(&width); zephir_array_fetch_long(&width, &tmp, 0, PH_NOISY, "phalcon/Filter/Validation/Validator/File/Resolution/Max.zep", 95); diff --git a/ext/phalcon/filter/validation/validator/file/resolution/min.zep.c b/ext/phalcon/filter/validation/validator/file/resolution/min.zep.c index 2fa7a808777..d36a42fa20a 100644 --- a/ext/phalcon/filter/validation/validator/file/resolution/min.zep.c +++ b/ext/phalcon/filter/validation/validator/file/resolution/min.zep.c @@ -180,7 +180,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_File_Resolution_Min, validate) ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); zephir_array_fetch_string(&_1, &value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Filter/Validation/Validator/File/Resolution/Min.zep", 94); - ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 310, &_1); + ZEPHIR_CALL_FUNCTION(&tmp, "getimagesize", NULL, 313, &_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(&width); zephir_array_fetch_long(&width, &tmp, 0, PH_NOISY, "phalcon/Filter/Validation/Validator/File/Resolution/Min.zep", 95); diff --git a/ext/phalcon/filter/validation/validator/inclusionin.zep.c b/ext/phalcon/filter/validation/validator/inclusionin.zep.c index d9affc22cf3..720ec48d3ee 100644 --- a/ext/phalcon/filter/validation/validator/inclusionin.zep.c +++ b/ext/phalcon/filter/validation/validator/inclusionin.zep.c @@ -201,7 +201,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_InclusionIn, validate) return; } } - ZEPHIR_CALL_FUNCTION(&_5, "in_array", NULL, 296, &value, &domain, &strict); + ZEPHIR_CALL_FUNCTION(&_5, "in_array", NULL, 299, &value, &domain, &strict); zephir_check_call_status(); if (!(zephir_is_true(&_5))) { ZEPHIR_INIT_VAR(&replacePairs); diff --git a/ext/phalcon/filter/validation/validator/ip.zep.c b/ext/phalcon/filter/validation/validator/ip.zep.c index ad3bb49fc9d..9c2d962d814 100644 --- a/ext/phalcon/filter/validation/validator/ip.zep.c +++ b/ext/phalcon/filter/validation/validator/ip.zep.c @@ -240,7 +240,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Ip, validate) zephir_bitwise_or_function(&_10, &_9, &allowReserved); zephir_array_update_string(&options, SL("flags"), &_10, PH_COPY | PH_SEPARATE); ZVAL_LONG(&_2, 275); - ZEPHIR_CALL_FUNCTION(&_11, "filter_var", NULL, 279, &value, &_2, &options); + ZEPHIR_CALL_FUNCTION(&_11, "filter_var", NULL, 282, &value, &_2, &options); zephir_check_call_status(); if (!(zephir_is_true(&_11))) { ZEPHIR_CALL_METHOD(&_12$$7, this_ptr, "messagefactory", NULL, 0, validation, field); diff --git a/ext/phalcon/filter/validation/validator/stringlength.zep.c b/ext/phalcon/filter/validation/validator/stringlength.zep.c index 423ec383a71..e43cdc11c40 100644 --- a/ext/phalcon/filter/validation/validator/stringlength.zep.c +++ b/ext/phalcon/filter/validation/validator/stringlength.zep.c @@ -177,11 +177,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) ZVAL_COPY(&value, _0); ZEPHIR_INIT_NVAR(&_4$$3); ZVAL_STRING(&_4$$3, "min"); - ZEPHIR_CALL_FUNCTION(&_5$$3, "strcasecmp", &_6, 35, &key, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "strcasecmp", &_6, 38, &key, &_4$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_4$$3); ZVAL_STRING(&_4$$3, "max"); - ZEPHIR_CALL_FUNCTION(&_7$$3, "strcasecmp", &_6, 35, &key, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "strcasecmp", &_6, 38, &key, &_4$$3); zephir_check_call_status(); if (ZEPHIR_IS_LONG_IDENTICAL(&_5$$3, 0)) { if (zephir_array_isset_string(&options, SL("message"))) { @@ -205,7 +205,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) zephir_array_update_string(&_8$$4, SL("min"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_8$$4, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_8$$4, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_9, 311, &_8$$4); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_9, 314, &_8$$4); zephir_check_call_status(); zephir_array_unset_string(&options, SL("min"), PH_SEPARATE); zephir_array_unset_string(&options, SL("message"), PH_SEPARATE); @@ -234,7 +234,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) zephir_array_update_string(&_10$$9, SL("max"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$9, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_10$$9, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 312, &_10$$9); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 315, &_10$$9); zephir_check_call_status(); zephir_array_unset_string(&options, SL("max"), PH_SEPARATE); zephir_array_unset_string(&options, SL("message"), PH_SEPARATE); @@ -261,11 +261,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_12$$15); ZVAL_STRING(&_12$$15, "min"); - ZEPHIR_CALL_FUNCTION(&_13$$15, "strcasecmp", &_6, 35, &key, &_12$$15); + ZEPHIR_CALL_FUNCTION(&_13$$15, "strcasecmp", &_6, 38, &key, &_12$$15); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_12$$15); ZVAL_STRING(&_12$$15, "max"); - ZEPHIR_CALL_FUNCTION(&_14$$15, "strcasecmp", &_6, 35, &key, &_12$$15); + ZEPHIR_CALL_FUNCTION(&_14$$15, "strcasecmp", &_6, 38, &key, &_12$$15); zephir_check_call_status(); if (ZEPHIR_IS_LONG_IDENTICAL(&_13$$15, 0)) { if (zephir_array_isset_string(&options, SL("message"))) { @@ -289,7 +289,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) zephir_array_update_string(&_15$$16, SL("min"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$16, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_15$$16, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 312, &_15$$16); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 315, &_15$$16); zephir_check_call_status(); zephir_array_unset_string(&options, SL("min"), PH_SEPARATE); zephir_array_unset_string(&options, SL("message"), PH_SEPARATE); @@ -318,7 +318,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength, __construct) zephir_array_update_string(&_16$$21, SL("max"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_16$$21, SL("message"), &message, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_16$$21, SL("included"), &included, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 312, &_16$$21); + ZEPHIR_CALL_METHOD(NULL, &validator, "__construct", &_11, 315, &_16$$21); zephir_check_call_status(); zephir_array_unset_string(&options, SL("max"), PH_SEPARATE); zephir_array_unset_string(&options, SL("message"), PH_SEPARATE); diff --git a/ext/phalcon/filter/validation/validator/stringlength/max.zep.c b/ext/phalcon/filter/validation/validator/stringlength/max.zep.c index d565fe356bb..bba70f675ad 100644 --- a/ext/phalcon/filter/validation/validator/stringlength/max.zep.c +++ b/ext/phalcon/filter/validation/validator/stringlength/max.zep.c @@ -178,7 +178,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength_Max, validate) } if ((zephir_function_exists_ex(ZEND_STRL("mb_strlen")) == SUCCESS)) { zephir_cast_to_string(&_1$$4, &value); - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &_1$$4); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &_1$$4); zephir_check_call_status(); } else { zephir_cast_to_string(&_2$$5, &value); diff --git a/ext/phalcon/filter/validation/validator/stringlength/min.zep.c b/ext/phalcon/filter/validation/validator/stringlength/min.zep.c index 92a945c4e3d..4cead638917 100644 --- a/ext/phalcon/filter/validation/validator/stringlength/min.zep.c +++ b/ext/phalcon/filter/validation/validator/stringlength/min.zep.c @@ -178,7 +178,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_StringLength_Min, validate) } if ((zephir_function_exists_ex(ZEND_STRL("mb_strlen")) == SUCCESS)) { zephir_cast_to_string(&_1$$4, &value); - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &_1$$4); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &_1$$4); zephir_check_call_status(); } else { zephir_cast_to_string(&_2$$5, &value); diff --git a/ext/phalcon/filter/validation/validator/uniqueness.zep.c b/ext/phalcon/filter/validation/validator/uniqueness.zep.c index bf6299a1859..7fde90fb274 100644 --- a/ext/phalcon/filter/validation/validator/uniqueness.zep.c +++ b/ext/phalcon/filter/validation/validator/uniqueness.zep.c @@ -648,7 +648,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Uniqueness, isUniquenessModel) zephir_array_keys(&_10$$6, &except); ZVAL_LONG(&_11$$6, 0); ZVAL_LONG(&_12$$6, (zephir_fast_count_int(&except) - 1)); - ZEPHIR_CALL_FUNCTION(&_13$$6, "range", &_14, 313, &_11$$6, &_12$$6); + ZEPHIR_CALL_FUNCTION(&_13$$6, "range", &_14, 316, &_11$$6, &_12$$6); zephir_check_call_status(); _9$$6 = !ZEPHIR_IS_IDENTICAL(&_10$$6, &_13$$6); } @@ -1052,7 +1052,7 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Uniqueness, isUniquenessModel) zephir_array_keys(&_88$$37, &except); ZVAL_LONG(&_89$$37, 0); ZVAL_LONG(&_90$$37, (zephir_fast_count_int(&except) - 1)); - ZEPHIR_CALL_FUNCTION(&_91$$37, "range", &_14, 313, &_89$$37, &_90$$37); + ZEPHIR_CALL_FUNCTION(&_91$$37, "range", &_14, 316, &_89$$37, &_90$$37); zephir_check_call_status(); _87$$37 = !ZEPHIR_IS_IDENTICAL(&_88$$37, &_91$$37); } diff --git a/ext/phalcon/filter/validation/validator/url.zep.c b/ext/phalcon/filter/validation/validator/url.zep.c index 8ea3908957c..ff52d20db8c 100644 --- a/ext/phalcon/filter/validation/validator/url.zep.c +++ b/ext/phalcon/filter/validation/validator/url.zep.c @@ -159,11 +159,11 @@ PHP_METHOD(Phalcon_Filter_Validation_Validator_Url, validate) zephir_read_property(&_1, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset_string_fetch(&options, &_1, SL("options"), 0)) { ZVAL_LONG(&_2$$4, 273); - ZEPHIR_CALL_FUNCTION(&result, "filter_var", NULL, 279, &value, &_2$$4, &options); + ZEPHIR_CALL_FUNCTION(&result, "filter_var", NULL, 282, &value, &_2$$4, &options); zephir_check_call_status(); } else { ZVAL_LONG(&_3$$5, 273); - ZEPHIR_CALL_FUNCTION(&result, "filter_var", NULL, 279, &value, &_3$$5); + ZEPHIR_CALL_FUNCTION(&result, "filter_var", NULL, 282, &value, &_3$$5); zephir_check_call_status(); } if (!(zephir_is_true(&result))) { diff --git a/ext/phalcon/flash/abstractflash.zep.c b/ext/phalcon/flash/abstractflash.zep.c index 76cb89225f5..edf30c5c59a 100644 --- a/ext/phalcon/flash/abstractflash.zep.c +++ b/ext/phalcon/flash/abstractflash.zep.c @@ -705,9 +705,9 @@ PHP_METHOD(Phalcon_Flash_AbstractFlash, outputMessage) { ZEPHIR_INIT_NVAR(&item); ZVAL_COPY(&item, _2); - ZEPHIR_CALL_METHOD(&prepared, this_ptr, "prepareescapedmessage", &_4, 78, &item); + ZEPHIR_CALL_METHOD(&prepared, this_ptr, "prepareescapedmessage", &_4, 81, &item); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&html, this_ptr, "preparehtmlmessage", &_5, 79, &type, &prepared); + ZEPHIR_CALL_METHOD(&html, this_ptr, "preparehtmlmessage", &_5, 82, &type, &prepared); zephir_check_call_status(); zephir_read_property(&_6$$5, this_ptr, ZEND_STRL("implicitFlush"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_6$$5)) { @@ -728,9 +728,9 @@ PHP_METHOD(Phalcon_Flash_AbstractFlash, outputMessage) } ZEPHIR_CALL_METHOD(&item, message, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prepared, this_ptr, "prepareescapedmessage", &_4, 78, &item); + ZEPHIR_CALL_METHOD(&prepared, this_ptr, "prepareescapedmessage", &_4, 81, &item); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&html, this_ptr, "preparehtmlmessage", &_5, 79, &type, &prepared); + ZEPHIR_CALL_METHOD(&html, this_ptr, "preparehtmlmessage", &_5, 82, &type, &prepared); zephir_check_call_status(); zephir_read_property(&_7$$8, this_ptr, ZEND_STRL("implicitFlush"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_TRUE_IDENTICAL(&_7$$8)) { @@ -952,13 +952,13 @@ PHP_METHOD(Phalcon_Flash_AbstractFlash, prepareHtmlMessage) RETURN_CTOR(&message); } zephir_read_property(&_1, this_ptr, ZEND_STRL("cssClasses"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&cssClasses, this_ptr, "checkclasses", NULL, 80, &_1, &type); + ZEPHIR_CALL_METHOD(&cssClasses, this_ptr, "checkclasses", NULL, 83, &_1, &type); zephir_check_call_status(); zephir_read_property(&_2, this_ptr, ZEND_STRL("cssIconClasses"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&cssIconClasses, this_ptr, "checkclasses", NULL, 80, &_2, &type); + ZEPHIR_CALL_METHOD(&cssIconClasses, this_ptr, "checkclasses", NULL, 83, &_2, &type); zephir_check_call_status(); zephir_read_property(&_3, this_ptr, ZEND_STRL("interpolator"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettemplate", NULL, 81, &cssClasses, &cssIconClasses); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettemplate", NULL, 84, &cssClasses, &cssIconClasses); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_5); zephir_create_array(&_5, 3, 0); diff --git a/ext/phalcon/forms/form.zep.c b/ext/phalcon/forms/form.zep.c index 1738c3d6c95..cd44b0f3dc6 100644 --- a/ext/phalcon/forms/form.zep.c +++ b/ext/phalcon/forms/form.zep.c @@ -734,7 +734,7 @@ PHP_METHOD(Phalcon_Forms_Form, get) object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 343); ZEPHIR_MM_RESTORE(); @@ -919,7 +919,7 @@ PHP_METHOD(Phalcon_Forms_Form, getLabel) object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 418); ZEPHIR_MM_RESTORE(); @@ -1430,7 +1430,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) if (_7) { ZEPHIR_INIT_NVAR(&validation); object_init_ex(&validation, phalcon_filter_validation_ce); - ZEPHIR_CALL_METHOD(NULL, &validation, "__construct", NULL, 314); + ZEPHIR_CALL_METHOD(NULL, &validation, "__construct", NULL, 317); zephir_check_call_status(); } zephir_read_property(&_8, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); @@ -1453,7 +1453,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) { ZEPHIR_INIT_NVAR(&validator); ZVAL_COPY(&validator, _11$$10); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 315, &name, &validator); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 318, &name, &validator); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); } else { @@ -1467,7 +1467,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) } ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 315, &name, &validator); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 318, &name, &validator); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); zephir_check_call_status(); @@ -1477,7 +1477,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&filters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 316, &name, &filters); + ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 319, &name, &filters); zephir_check_call_status(); } } ZEND_HASH_FOREACH_END(); @@ -1505,7 +1505,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) { ZEPHIR_INIT_NVAR(&validator); ZVAL_COPY(&validator, _15$$15); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 315, &name, &validator); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 318, &name, &validator); zephir_check_call_status(); } ZEND_HASH_FOREACH_END(); } else { @@ -1519,7 +1519,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) } ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 315, &name, &validator); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 318, &name, &validator); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); zephir_check_call_status(); @@ -1529,7 +1529,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&filters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 316, &name, &filters); + ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 319, &name, &filters); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, &_8, "next", NULL, 0); @@ -1537,7 +1537,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid) } } ZEPHIR_INIT_NVAR(&element); - ZEPHIR_CALL_METHOD(&messages, &validation, "validate", NULL, 317, data, entity); + ZEPHIR_CALL_METHOD(&messages, &validation, "validate", NULL, 320, data, entity); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_17, &messages, "count", NULL, 0); zephir_check_call_status(); @@ -1636,7 +1636,7 @@ PHP_METHOD(Phalcon_Forms_Form, label) object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 764); ZEPHIR_MM_RESTORE(); @@ -1713,7 +1713,7 @@ PHP_METHOD(Phalcon_Forms_Form, render) object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 788); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/forms/manager.zep.c b/ext/phalcon/forms/manager.zep.c index 7eb311748c5..9e528f213f0 100644 --- a/ext/phalcon/forms/manager.zep.c +++ b/ext/phalcon/forms/manager.zep.c @@ -83,7 +83,7 @@ PHP_METHOD(Phalcon_Forms_Manager, create) ZEPHIR_INIT_VAR(&form); object_init_ex(&form, phalcon_forms_form_ce); - ZEPHIR_CALL_METHOD(NULL, &form, "__construct", NULL, 318, entity); + ZEPHIR_CALL_METHOD(NULL, &form, "__construct", NULL, 321, entity); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("forms"), &name, &form); RETURN_CCTOR(&form); @@ -125,7 +125,7 @@ PHP_METHOD(Phalcon_Forms_Manager, get) object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "There is no form with name='", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Manager.zep", 46); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/html/attributes.zep.c b/ext/phalcon/html/attributes.zep.c index 04c12c18b49..28f2c512b2b 100644 --- a/ext/phalcon/html/attributes.zep.c +++ b/ext/phalcon/html/attributes.zep.c @@ -164,7 +164,7 @@ PHP_METHOD(Phalcon_Html_Attributes, renderAttributes) ZVAL_LONG(&_5$$4, 3); ZEPHIR_INIT_NVAR(&_6$$4); ZVAL_STRING(&_6$$4, "utf-8"); - ZEPHIR_CALL_FUNCTION(&_7$$4, "htmlspecialchars", &_8, 282, &value, &_5$$4, &_6$$4, &__$true); + ZEPHIR_CALL_FUNCTION(&_7$$4, "htmlspecialchars", &_8, 285, &value, &_5$$4, &_6$$4, &__$true); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_9$$4); ZEPHIR_CONCAT_VSVS(&_9$$4, &key, "=\"", &_7$$4, "\" "); @@ -192,7 +192,7 @@ PHP_METHOD(Phalcon_Html_Attributes, renderAttributes) ZVAL_LONG(&_11$$6, 3); ZEPHIR_INIT_NVAR(&_12$$6); ZVAL_STRING(&_12$$6, "utf-8"); - ZEPHIR_CALL_FUNCTION(&_13$$6, "htmlspecialchars", &_8, 282, &value, &_11$$6, &_12$$6, &__$true); + ZEPHIR_CALL_FUNCTION(&_13$$6, "htmlspecialchars", &_8, 285, &value, &_11$$6, &_12$$6, &__$true); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$6); ZEPHIR_CONCAT_VSVS(&_14$$6, &key, "=\"", &_13$$6, "\" "); diff --git a/ext/phalcon/html/breadcrumbs.zep.c b/ext/phalcon/html/breadcrumbs.zep.c index 7de994f339b..3413576bc38 100644 --- a/ext/phalcon/html/breadcrumbs.zep.c +++ b/ext/phalcon/html/breadcrumbs.zep.c @@ -241,7 +241,7 @@ PHP_METHOD(Phalcon_Html_Breadcrumbs, render) ZEPHIR_INIT_VAR(&urls); zephir_array_keys(&urls, &elements); ZEPHIR_MAKE_REF(&urls); - ZEPHIR_CALL_FUNCTION(&lastUrl, "end", NULL, 319, &urls); + ZEPHIR_CALL_FUNCTION(&lastUrl, "end", NULL, 322, &urls); ZEPHIR_UNREF(&urls); zephir_check_call_status(); ZEPHIR_OBS_VAR(&lastLabel); diff --git a/ext/phalcon/html/escaper.zep.c b/ext/phalcon/html/escaper.zep.c index fee9465f84c..95520cb0947 100644 --- a/ext/phalcon/html/escaper.zep.c +++ b/ext/phalcon/html/escaper.zep.c @@ -257,9 +257,9 @@ PHP_METHOD(Phalcon_Html_Escaper, css) zephir_get_strval(&input, input_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 320, &input); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 323, &input); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapecss", NULL, 321, &_0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapecss", NULL, 324, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -332,7 +332,7 @@ PHP_METHOD(Phalcon_Html_Escaper, detectEncoding) { ZEPHIR_INIT_NVAR(&charset); ZVAL_COPY(&charset, _2); - ZEPHIR_CALL_FUNCTION(&_4$$5, "mb_detect_encoding", &_5, 322, &input, &charset, &__$true); + ZEPHIR_CALL_FUNCTION(&_4$$5, "mb_detect_encoding", &_5, 325, &input, &charset, &__$true); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_4$$5)) { RETURN_CCTOR(&charset); @@ -349,7 +349,7 @@ PHP_METHOD(Phalcon_Html_Escaper, detectEncoding) } ZEPHIR_CALL_METHOD(&charset, &_0, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_6$$7, "mb_detect_encoding", &_5, 322, &input, &charset, &__$true); + ZEPHIR_CALL_FUNCTION(&_6$$7, "mb_detect_encoding", &_5, 325, &input, &charset, &__$true); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_6$$7)) { RETURN_CCTOR(&charset); @@ -359,7 +359,7 @@ PHP_METHOD(Phalcon_Html_Escaper, detectEncoding) } } ZEPHIR_INIT_NVAR(&charset); - ZEPHIR_RETURN_CALL_FUNCTION("mb_detect_encoding", &_5, 322, &input); + ZEPHIR_RETURN_CALL_FUNCTION("mb_detect_encoding", &_5, 325, &input); zephir_check_call_status(); RETURN_MM(); } @@ -622,7 +622,7 @@ PHP_METHOD(Phalcon_Html_Escaper, html) zephir_read_property(&_0, this_ptr, ZEND_STRL("flags"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("encoding"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_2, this_ptr, ZEND_STRL("doubleEncode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 282, &input, &_0, &_1, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 285, &input, &_0, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -658,9 +658,9 @@ PHP_METHOD(Phalcon_Html_Escaper, js) zephir_get_strval(&input, input_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 320, &input); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 323, &input); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapejs", NULL, 323, &_0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapejs", NULL, 326, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -696,11 +696,11 @@ PHP_METHOD(Phalcon_Html_Escaper, normalizeEncoding) zephir_get_strval(&input, input_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "detectencoding", NULL, 324, &input); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "detectencoding", NULL, 327, &input); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "UTF-32"); - ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 325, &input, &_1, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 328, &input, &_1, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -876,7 +876,7 @@ PHP_METHOD(Phalcon_Html_Escaper, url) zephir_get_strval(&input, input_param); - ZEPHIR_RETURN_CALL_FUNCTION("rawurlencode", NULL, 326, &input); + ZEPHIR_RETURN_CALL_FUNCTION("rawurlencode", NULL, 329, &input); zephir_check_call_status(); RETURN_MM(); } @@ -916,7 +916,7 @@ PHP_METHOD(Phalcon_Html_Escaper, phpHtmlSpecialChars) zephir_read_property(&_0, this_ptr, ZEND_STRL("flags"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("encoding"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_2, this_ptr, ZEND_STRL("doubleEncode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 282, &input, &_0, &_1, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 285, &input, &_0, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/html/helper/input/checkbox.zep.c b/ext/phalcon/html/helper/input/checkbox.zep.c index 53ac8f5fa29..a4e35e43ab4 100644 --- a/ext/phalcon/html/helper/input/checkbox.zep.c +++ b/ext/phalcon/html/helper/input/checkbox.zep.c @@ -115,9 +115,9 @@ PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, __toString) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processchecked", NULL, 91); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processchecked", NULL, 94); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&unchecked, this_ptr, "processunchecked", NULL, 92); + ZEPHIR_CALL_METHOD(&unchecked, this_ptr, "processunchecked", NULL, 95); zephir_check_call_status(); ZEPHIR_CALL_PARENT(&element, phalcon_html_helper_input_checkbox_ce, getThis(), "__tostring", &_0, 0); zephir_check_call_status(); diff --git a/ext/phalcon/html/helper/input/select.zep.c b/ext/phalcon/html/helper/input/select.zep.c index 522e5c5b666..32324d7f118 100644 --- a/ext/phalcon/html/helper/input/select.zep.c +++ b/ext/phalcon/html/helper/input/select.zep.c @@ -115,7 +115,7 @@ PHP_METHOD(Phalcon_Html_Helper_Input_Select, add) } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "processvalue", NULL, 327, &attributes, &value); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "processvalue", NULL, 330, &attributes, &value); zephir_check_call_status(); ZEPHIR_CPY_WRT(&attributes, &_0); ZEPHIR_INIT_VAR(&_1); diff --git a/ext/phalcon/html/helper/meta.zep.c b/ext/phalcon/html/helper/meta.zep.c index fca49590d32..b4cb2692251 100644 --- a/ext/phalcon/html/helper/meta.zep.c +++ b/ext/phalcon/html/helper/meta.zep.c @@ -130,7 +130,7 @@ PHP_METHOD(Phalcon_Html_Helper_Meta, addHttp) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "http-equiv"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addelement", NULL, 328, &_0, &httpEquiv, &content); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addelement", NULL, 331, &_0, &httpEquiv, &content); zephir_check_call_status(); RETURN_MM(); } @@ -170,7 +170,7 @@ PHP_METHOD(Phalcon_Html_Helper_Meta, addName) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "name"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 328, &_0, &name, &content); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 331, &_0, &name, &content); zephir_check_call_status(); RETURN_THIS(); } @@ -210,7 +210,7 @@ PHP_METHOD(Phalcon_Html_Helper_Meta, addProperty) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "property"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 328, &_0, &name, &content); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 331, &_0, &name, &content); zephir_check_call_status(); RETURN_THIS(); } diff --git a/ext/phalcon/html/helper/title.zep.c b/ext/phalcon/html/helper/title.zep.c index 8048a279cb2..9577f2f2ad4 100644 --- a/ext/phalcon/html/helper/title.zep.c +++ b/ext/phalcon/html/helper/title.zep.c @@ -158,7 +158,7 @@ PHP_METHOD(Phalcon_Html_Helper_Title, __toString) zephir_read_property(&_2, this_ptr, ZEND_STRL("title"), PH_NOISY_CC); zephir_array_fast_append(&_1, &_2); zephir_read_property(&_3, this_ptr, ZEND_STRL("append"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&items, "array_merge", NULL, 329, &_0, &_1, &_3); + ZEPHIR_CALL_FUNCTION(&items, "array_merge", NULL, 332, &_0, &_1, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); array_init(&_4); @@ -412,7 +412,7 @@ PHP_METHOD(Phalcon_Html_Helper_Title, prepend) zephir_read_property(&_2, this_ptr, ZEND_STRL("prepend"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&prepend, &_2); ZEPHIR_MAKE_REF(&prepend); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 266, &prepend, &text); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 269, &prepend, &text); ZEPHIR_UNREF(&prepend); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("prepend"), &prepend); diff --git a/ext/phalcon/html/link/abstractlink.zep.c b/ext/phalcon/html/link/abstractlink.zep.c index 2e0f93ee298..85d35618fcd 100644 --- a/ext/phalcon/html/link/abstractlink.zep.c +++ b/ext/phalcon/html/link/abstractlink.zep.c @@ -263,13 +263,13 @@ PHP_METHOD(Phalcon_Html_Link_AbstractLink, hrefIsTemplated) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "{"); - ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 82, &href, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 85, &href, &_0); zephir_check_call_status(); _2 = !ZEPHIR_IS_FALSE_IDENTICAL(&_1); if (_2) { ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "}"); - ZEPHIR_CALL_FUNCTION(&_3, "mb_strpos", NULL, 82, &href, &_0); + ZEPHIR_CALL_FUNCTION(&_3, "mb_strpos", NULL, 85, &href, &_0); zephir_check_call_status(); _2 = !ZEPHIR_IS_FALSE_IDENTICAL(&_3); } diff --git a/ext/phalcon/html/link/abstractlinkprovider.zep.c b/ext/phalcon/html/link/abstractlinkprovider.zep.c index 2cd33e63e03..0b9ce9038ef 100644 --- a/ext/phalcon/html/link/abstractlinkprovider.zep.c +++ b/ext/phalcon/html/link/abstractlinkprovider.zep.c @@ -96,13 +96,13 @@ PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, __construct) ZVAL_COPY(&link, _0); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "Phalcon\\Html\\Link\\Interfaces\\LinkInterface"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "is_a", &_4, 83, &link, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "is_a", &_4, 86, &link, &_2$$3); zephir_check_call_status(); _5$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_3$$3); if (!(_5$$3)) { ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "Psr\\Link\\LinkInterface"); - ZEPHIR_CALL_FUNCTION(&_6$$3, "is_a", &_4, 83, &link, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_6$$3, "is_a", &_4, 86, &link, &_2$$3); zephir_check_call_status(); _5$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_6$$3); } @@ -125,13 +125,13 @@ PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, __construct) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_9$$5); ZVAL_STRING(&_9$$5, "Phalcon\\Html\\Link\\Interfaces\\LinkInterface"); - ZEPHIR_CALL_FUNCTION(&_10$$5, "is_a", &_4, 83, &link, &_9$$5); + ZEPHIR_CALL_FUNCTION(&_10$$5, "is_a", &_4, 86, &link, &_9$$5); zephir_check_call_status(); _11$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_10$$5); if (!(_11$$5)) { ZEPHIR_INIT_NVAR(&_9$$5); ZVAL_STRING(&_9$$5, "Psr\\Link\\LinkInterface"); - ZEPHIR_CALL_FUNCTION(&_12$$5, "is_a", &_4, 83, &link, &_9$$5); + ZEPHIR_CALL_FUNCTION(&_12$$5, "is_a", &_4, 86, &link, &_9$$5); zephir_check_call_status(); _11$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_12$$5); } @@ -359,7 +359,7 @@ PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, getKey) zephir_fetch_params(1, 1, 0, &link); - ZEPHIR_RETURN_CALL_FUNCTION("spl_object_hash", NULL, 77, link); + ZEPHIR_RETURN_CALL_FUNCTION("spl_object_hash", NULL, 80, link); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/http/cookie.zep.c b/ext/phalcon/http/cookie.zep.c index 5155df3123c..09909fc956d 100644 --- a/ext/phalcon/http/cookie.zep.c +++ b/ext/phalcon/http/cookie.zep.c @@ -311,32 +311,32 @@ PHP_METHOD(Phalcon_Http_Cookie, delete) ZEPHIR_INIT_VAR(&_8); ZVAL_STRING(&_8, "expires"); ZVAL_LONG(&_0, (zephir_get_numberval(&_3) - 691200)); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "getarrval", NULL, 330, &options, &_8, &_0); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "getarrval", NULL, 333, &options, &_8, &_0); zephir_check_call_status(); zephir_array_update_string(&options, SL("expires"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, "domain"); - ZEPHIR_CALL_METHOD(&_9, this_ptr, "getarrval", NULL, 330, &options, &_8, &domain); + ZEPHIR_CALL_METHOD(&_9, this_ptr, "getarrval", NULL, 333, &options, &_8, &domain); zephir_check_call_status(); zephir_array_update_string(&options, SL("domain"), &_9, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, "path"); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "getarrval", NULL, 330, &options, &_8, &path); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "getarrval", NULL, 333, &options, &_8, &path); zephir_check_call_status(); zephir_array_update_string(&options, SL("path"), &_10, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, "secure"); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "getarrval", NULL, 330, &options, &_8, &secure); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "getarrval", NULL, 333, &options, &_8, &secure); zephir_check_call_status(); zephir_array_update_string(&options, SL("secure"), &_11, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, "httponly"); - ZEPHIR_CALL_METHOD(&_12, this_ptr, "getarrval", NULL, 330, &options, &_8, &httpOnly); + ZEPHIR_CALL_METHOD(&_12, this_ptr, "getarrval", NULL, 333, &options, &_8, &httpOnly); zephir_check_call_status(); zephir_array_update_string(&options, SL("httponly"), &_12, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, ""); - ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 331, &name, &_8, &options); + ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 334, &name, &_8, &options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -857,30 +857,30 @@ PHP_METHOD(Phalcon_Http_Cookie, send) } ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "expires"); - ZEPHIR_CALL_METHOD(&_13, this_ptr, "getarrval", NULL, 330, &options, &_3, &expire); + ZEPHIR_CALL_METHOD(&_13, this_ptr, "getarrval", NULL, 333, &options, &_3, &expire); zephir_check_call_status(); zephir_array_update_string(&options, SL("expires"), &_13, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "domain"); - ZEPHIR_CALL_METHOD(&_14, this_ptr, "getarrval", NULL, 330, &options, &_3, &domain); + ZEPHIR_CALL_METHOD(&_14, this_ptr, "getarrval", NULL, 333, &options, &_3, &domain); zephir_check_call_status(); zephir_array_update_string(&options, SL("domain"), &_14, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "path"); - ZEPHIR_CALL_METHOD(&_15, this_ptr, "getarrval", NULL, 330, &options, &_3, &path); + ZEPHIR_CALL_METHOD(&_15, this_ptr, "getarrval", NULL, 333, &options, &_3, &path); zephir_check_call_status(); zephir_array_update_string(&options, SL("path"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "secure"); - ZEPHIR_CALL_METHOD(&_16, this_ptr, "getarrval", NULL, 330, &options, &_3, &secure); + ZEPHIR_CALL_METHOD(&_16, this_ptr, "getarrval", NULL, 333, &options, &_3, &secure); zephir_check_call_status(); zephir_array_update_string(&options, SL("secure"), &_16, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "httponly"); - ZEPHIR_CALL_METHOD(&_17, this_ptr, "getarrval", NULL, 330, &options, &_3, &httpOnly); + ZEPHIR_CALL_METHOD(&_17, this_ptr, "getarrval", NULL, 333, &options, &_3, &httpOnly); zephir_check_call_status(); zephir_array_update_string(&options, SL("httponly"), &_17, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 331, &name, &encryptValue, &options); + ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 334, &name, &encryptValue, &options); zephir_check_call_status(); RETURN_THIS(); } @@ -1264,16 +1264,16 @@ PHP_METHOD(Phalcon_Http_Cookie, assertSignKeyIsLongEnough) } - ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 230, &signKey); + ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 233, &signKey); zephir_check_call_status(); if (UNEXPECTED(ZEPHIR_LT_LONG(&length, 32))) { ZEPHIR_INIT_VAR(&_0$$3); object_init_ex(&_0$$3, phalcon_http_cookie_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "The cookie's key should be at least 32 characters long. Current length is %d."); - ZEPHIR_CALL_FUNCTION(&_2$$3, "sprintf", NULL, 113, &_1$$3, &length); + ZEPHIR_CALL_FUNCTION(&_2$$3, "sprintf", NULL, 116, &_1$$3, &length); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Http/Cookie.zep", 649); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/http/request.zep.c b/ext/phalcon/http/request.zep.c index 6a01653d318..411260b0afd 100644 --- a/ext/phalcon/http/request.zep.c +++ b/ext/phalcon/http/request.zep.c @@ -184,7 +184,7 @@ PHP_METHOD(Phalcon_Http_Request, get) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 332, &_REQUEST, &name, filters, defaultValue, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 335, &_REQUEST, &name, filters, defaultValue, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -210,7 +210,7 @@ PHP_METHOD(Phalcon_Http_Request, getAcceptableContent) ZVAL_STRING(&_0, "HTTP_ACCEPT"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "accept"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 333, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 336, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -237,13 +237,13 @@ PHP_METHOD(Phalcon_Http_Request, getBasicAuth) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "PHP_AUTH_USER"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 334, &_1); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 337, &_1); zephir_check_call_status(); _2 = !zephir_is_true(&_0); if (!(_2)) { ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "PHP_AUTH_PW"); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "hasserver", NULL, 334, &_1); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "hasserver", NULL, 337, &_1); zephir_check_call_status(); _2 = !zephir_is_true(&_3); } @@ -285,7 +285,7 @@ PHP_METHOD(Phalcon_Http_Request, getBestAccept) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "accept"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 335, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 338, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -311,7 +311,7 @@ PHP_METHOD(Phalcon_Http_Request, getBestCharset) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "charset"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 335, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 338, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -337,7 +337,7 @@ PHP_METHOD(Phalcon_Http_Request, getBestLanguage) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "language"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 335, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbestquality", NULL, 338, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -440,7 +440,7 @@ PHP_METHOD(Phalcon_Http_Request, getClientAddress) ZEPHIR_INIT_VAR(&address); ZVAL_NULL(&address); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); if (trustForwardedHeader) { ZEPHIR_OBS_NVAR(&address); @@ -487,7 +487,7 @@ PHP_METHOD(Phalcon_Http_Request, getClientCharsets) ZVAL_STRING(&_0, "HTTP_ACCEPT_CHARSET"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "charset"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 333, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 336, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -508,7 +508,7 @@ PHP_METHOD(Phalcon_Http_Request, getContentType) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); if (!(zephir_array_isset_string_fetch(&contentType, &server, SL("CONTENT_TYPE"), 1))) { RETURN_MM_NULL(); @@ -547,7 +547,7 @@ PHP_METHOD(Phalcon_Http_Request, getDigestAuth) ZEPHIR_INIT_VAR(&auth); array_init(&auth); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); ZEPHIR_OBS_VAR(&digest); if (zephir_array_isset_string_fetch(&digest, &server, SL("PHP_AUTH_DIGEST"), 0)) { @@ -939,7 +939,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeader) zephir_check_call_status(); ZEPHIR_INIT_VAR(&name); zephir_fast_strtoupper(&name, &_2); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); ZEPHIR_OBS_VAR(&value); if (zephir_array_isset_fetch(&value, &server, &name, 0)) { @@ -1033,7 +1033,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeaders) zephir_array_update_string(&contentHeaders, SL("CONTENT_TYPE"), &__$true, PH_COPY | PH_SEPARATE); zephir_array_update_string(&contentHeaders, SL("CONTENT_LENGTH"), &__$true, PH_COPY | PH_SEPARATE); zephir_array_update_string(&contentHeaders, SL("CONTENT_MD5"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); zephir_is_iterable(&server, 0, "phalcon/Http/Request.zep", 461); if (Z_TYPE_P(&server) == IS_ARRAY) { @@ -1059,7 +1059,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeaders) ZVAL_STRING(&_9$$4, " "); zephir_fast_str_replace(&_5$$4, &_8$$4, &_9$$4, &_7$$4); zephir_fast_strtolower(&_4$$4, &_5$$4); - ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 284, &_4$$4); + ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 287, &_4$$4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_11$$4); ZEPHIR_INIT_NVAR(&_12$$4); @@ -1083,7 +1083,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeaders) ZVAL_STRING(&_18$$5, " "); zephir_fast_str_replace(&_16$$5, &_17$$5, &_18$$5, &name); zephir_fast_strtolower(&_15$$5, &_16$$5); - ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 284, &_15$$5); + ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 287, &_15$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_19$$5); ZEPHIR_INIT_NVAR(&_20$$5); @@ -1120,7 +1120,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeaders) ZVAL_STRING(&_27$$7, " "); zephir_fast_str_replace(&_23$$7, &_26$$7, &_27$$7, &_25$$7); zephir_fast_strtolower(&_22$$7, &_23$$7); - ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 284, &_22$$7); + ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 287, &_22$$7); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_28$$7); ZEPHIR_INIT_NVAR(&_29$$7); @@ -1144,7 +1144,7 @@ PHP_METHOD(Phalcon_Http_Request, getHeaders) ZVAL_STRING(&_35$$8, " "); zephir_fast_str_replace(&_33$$8, &_34$$8, &_35$$8, &name); zephir_fast_strtolower(&_32$$8, &_33$$8); - ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 284, &_32$$8); + ZEPHIR_CALL_FUNCTION(&name, "ucwords", &_10, 287, &_32$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_36$$8); ZEPHIR_INIT_NVAR(&_37$$8); @@ -1265,7 +1265,7 @@ PHP_METHOD(Phalcon_Http_Request, getHttpHost) ZVAL_STRING(&_5$$6, "/:[[:digit:]]+$/"); ZEPHIR_INIT_VAR(&_6$$6); ZVAL_STRING(&_6$$6, ""); - ZEPHIR_CALL_FUNCTION(&_7$$6, "preg_replace", NULL, 37, &_5$$6, &_6$$6, &cleanHost); + ZEPHIR_CALL_FUNCTION(&_7$$6, "preg_replace", NULL, 40, &_5$$6, &_6$$6, &cleanHost); zephir_check_call_status(); ZEPHIR_CPY_WRT(&cleanHost, &_7$$6); } @@ -1273,7 +1273,7 @@ PHP_METHOD(Phalcon_Http_Request, getHttpHost) ZVAL_STRING(&_8$$5, "/[a-z0-9-]+\\.?/"); ZEPHIR_INIT_VAR(&_9$$5); ZVAL_STRING(&_9$$5, ""); - ZEPHIR_CALL_FUNCTION(&_10$$5, "preg_replace", NULL, 37, &_8$$5, &_9$$5, &cleanHost); + ZEPHIR_CALL_FUNCTION(&_10$$5, "preg_replace", NULL, 40, &_8$$5, &_9$$5, &cleanHost); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_11$$5); ZVAL_STRING(&_11$$5, ""); @@ -1282,7 +1282,7 @@ PHP_METHOD(Phalcon_Http_Request, getHttpHost) object_init_ex(&_12$$7, spl_ce_UnexpectedValueException); ZEPHIR_INIT_VAR(&_13$$7); ZEPHIR_CONCAT_SV(&_13$$7, "Invalid host ", &host); - ZEPHIR_CALL_METHOD(NULL, &_12$$7, "__construct", NULL, 337, &_13$$7); + ZEPHIR_CALL_METHOD(NULL, &_12$$7, "__construct", NULL, 340, &_13$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_12$$7, "phalcon/Http/Request.zep", 545); ZEPHIR_MM_RESTORE(); @@ -1311,7 +1311,7 @@ PHP_METHOD(Phalcon_Http_Request, getHTTPReferer) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); if (!(zephir_array_isset_string_fetch(&httpReferer, &server, SL("HTTP_REFERER"), 1))) { RETURN_MM_STRING(""); @@ -1372,7 +1372,7 @@ PHP_METHOD(Phalcon_Http_Request, getJsonRawBody) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(&_0, "__invoke", NULL, 192, &rawBody, &_1); + ZEPHIR_RETURN_CALL_METHOD(&_0, "__invoke", NULL, 195, &rawBody, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1398,7 +1398,7 @@ PHP_METHOD(Phalcon_Http_Request, getLanguages) ZVAL_STRING(&_0, "HTTP_ACCEPT_LANGUAGE"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "language"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 333, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getqualityheader", NULL, 336, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1438,7 +1438,7 @@ PHP_METHOD(Phalcon_Http_Request, getMethod) zephir_get_global(&_REQUEST, SL("_REQUEST")); ZEPHIR_INIT_VAR(&returnMethod); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); ZEPHIR_OBS_VAR(&requestMethod); if (EXPECTED(zephir_array_isset_string_fetch(&requestMethod, &server, SL("REQUEST_METHOD"), 0))) { @@ -1452,7 +1452,7 @@ PHP_METHOD(Phalcon_Http_Request, getMethod) if (ZEPHIR_IS_IDENTICAL(&_0, &returnMethod)) { ZEPHIR_INIT_VAR(&_1$$5); ZVAL_STRING(&_1$$5, "X-HTTP-METHOD-OVERRIDE"); - ZEPHIR_CALL_METHOD(&overridedMethod, this_ptr, "getheader", NULL, 338, &_1$$5); + ZEPHIR_CALL_METHOD(&overridedMethod, this_ptr, "getheader", NULL, 341, &_1$$5); zephir_check_call_status(); zephir_read_property(&_2$$5, this_ptr, ZEND_STRL("httpMethodParameterOverride"), PH_NOISY_CC | PH_READONLY); if (!(ZEPHIR_IS_EMPTY(&overridedMethod))) { @@ -1561,7 +1561,7 @@ PHP_METHOD(Phalcon_Http_Request, getPatch) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getpatchput", NULL, 339, &_0, &name, filters, defaultValue, &_1, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getpatchput", NULL, 342, &_0, &name, filters, defaultValue, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -1604,7 +1604,7 @@ PHP_METHOD(Phalcon_Http_Request, getPort) if (zephir_memnstr_str(&host, SL(":"), "phalcon/Http/Request.zep", 686)) { ZEPHIR_INIT_VAR(&_3$$4); ZVAL_STRING(&_3$$4, ":"); - ZEPHIR_CALL_FUNCTION(&pos, "strrpos", NULL, 238, &host, &_3$$4); + ZEPHIR_CALL_FUNCTION(&pos, "strrpos", NULL, 241, &host, &_3$$4); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&pos)) { ZVAL_LONG(&_4$$5, (zephir_get_numberval(&pos) + 1)); @@ -1713,7 +1713,7 @@ PHP_METHOD(Phalcon_Http_Request, getPost) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 332, &_POST, &name, filters, defaultValue, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 335, &_POST, &name, filters, defaultValue, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1805,7 +1805,7 @@ PHP_METHOD(Phalcon_Http_Request, getPut) } else { ZVAL_BOOL(&_2, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getpatchput", NULL, 339, &_0, &name, filters, defaultValue, &_1, &_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getpatchput", NULL, 342, &_0, &name, filters, defaultValue, &_1, &_2); zephir_check_call_status(); RETURN_MM(); } @@ -1900,7 +1900,7 @@ PHP_METHOD(Phalcon_Http_Request, getQuery) } else { ZVAL_BOOL(&_1, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 332, &_GET, &name, filters, defaultValue, &_0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 335, &_GET, &name, filters, defaultValue, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -2001,7 +2001,7 @@ PHP_METHOD(Phalcon_Http_Request, getServer) } - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); if (!(zephir_array_isset_fetch(&serverValue, &server, &name, 1))) { RETURN_MM_NULL(); @@ -2033,7 +2033,7 @@ PHP_METHOD(Phalcon_Http_Request, getServerAddress) if (Z_TYPE_P(&serverAddr) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "localhost"); - ZEPHIR_RETURN_CALL_FUNCTION("gethostbyname", NULL, 340, &_1$$3); + ZEPHIR_RETURN_CALL_FUNCTION("gethostbyname", NULL, 343, &_1$$3); zephir_check_call_status(); RETURN_MM(); } @@ -2190,7 +2190,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) zephir_array_fetch_string(&_7$$5, &input, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 891); zephir_array_fetch_string(&_8$$5, &input, SL("size"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 892); zephir_array_fetch_string(&_9$$5, &input, SL("error"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 893); - ZEPHIR_CALL_METHOD(&smoothInput, this_ptr, "smoothfiles", &_10, 341, &_5$$5, &_6$$5, &_7$$5, &_8$$5, &_9$$5, &prefix); + ZEPHIR_CALL_METHOD(&smoothInput, this_ptr, "smoothfiles", &_10, 344, &_5$$5, &_6$$5, &_7$$5, &_8$$5, &_9$$5, &prefix); zephir_check_call_status(); zephir_is_iterable(&smoothInput, 0, "phalcon/Http/Request.zep", 920); if (Z_TYPE_P(&smoothInput) == IS_ARRAY) { @@ -2225,7 +2225,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_16$$8); object_init_ex(&_16$$8, phalcon_http_request_file_ce); zephir_array_fetch_string(&_17$$8, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 911); - ZEPHIR_CALL_METHOD(NULL, &_16$$8, "__construct", &_18, 342, &dataFile, &_17$$8); + ZEPHIR_CALL_METHOD(NULL, &_16$$8, "__construct", &_18, 345, &dataFile, &_17$$8); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&_19$$8); zephir_array_fetch_string(&_19$$8, &file, SL("key"), PH_NOISY, "phalcon/Http/Request.zep", 908); @@ -2234,7 +2234,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_20$$9); object_init_ex(&_20$$9, phalcon_http_request_file_ce); zephir_array_fetch_string(&_21$$9, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 916); - ZEPHIR_CALL_METHOD(NULL, &_20$$9, "__construct", &_18, 342, &dataFile, &_21$$9); + ZEPHIR_CALL_METHOD(NULL, &_20$$9, "__construct", &_18, 345, &dataFile, &_21$$9); zephir_check_call_status(); zephir_array_append(&files, &_20$$9, PH_SEPARATE, "phalcon/Http/Request.zep", 916); } @@ -2279,7 +2279,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_26$$12); object_init_ex(&_26$$12, phalcon_http_request_file_ce); zephir_array_fetch_string(&_27$$12, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 911); - ZEPHIR_CALL_METHOD(NULL, &_26$$12, "__construct", &_18, 342, &dataFile, &_27$$12); + ZEPHIR_CALL_METHOD(NULL, &_26$$12, "__construct", &_18, 345, &dataFile, &_27$$12); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&_28$$12); zephir_array_fetch_string(&_28$$12, &file, SL("key"), PH_NOISY, "phalcon/Http/Request.zep", 908); @@ -2288,7 +2288,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_29$$13); object_init_ex(&_29$$13, phalcon_http_request_file_ce); zephir_array_fetch_string(&_30$$13, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 916); - ZEPHIR_CALL_METHOD(NULL, &_29$$13, "__construct", &_18, 342, &dataFile, &_30$$13); + ZEPHIR_CALL_METHOD(NULL, &_29$$13, "__construct", &_18, 345, &dataFile, &_30$$13); zephir_check_call_status(); zephir_array_append(&files, &_29$$13, PH_SEPARATE, "phalcon/Http/Request.zep", 916); } @@ -2308,13 +2308,13 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) if (namedKeys == 1) { ZEPHIR_INIT_NVAR(&_33$$16); object_init_ex(&_33$$16, phalcon_http_request_file_ce); - ZEPHIR_CALL_METHOD(NULL, &_33$$16, "__construct", &_18, 342, &input, &prefix); + ZEPHIR_CALL_METHOD(NULL, &_33$$16, "__construct", &_18, 345, &input, &prefix); zephir_check_call_status(); zephir_array_update_zval(&files, &prefix, &_33$$16, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(&_34$$17); object_init_ex(&_34$$17, phalcon_http_request_file_ce); - ZEPHIR_CALL_METHOD(NULL, &_34$$17, "__construct", &_18, 342, &input, &prefix); + ZEPHIR_CALL_METHOD(NULL, &_34$$17, "__construct", &_18, 345, &input, &prefix); zephir_check_call_status(); zephir_array_append(&files, &_34$$17, PH_SEPARATE, "phalcon/Http/Request.zep", 925); } @@ -2342,7 +2342,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) zephir_array_fetch_string(&_38$$19, &input, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 891); zephir_array_fetch_string(&_39$$19, &input, SL("size"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 892); zephir_array_fetch_string(&_40$$19, &input, SL("error"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 893); - ZEPHIR_CALL_METHOD(&smoothInput, this_ptr, "smoothfiles", &_10, 341, &_36$$19, &_37$$19, &_38$$19, &_39$$19, &_40$$19, &prefix); + ZEPHIR_CALL_METHOD(&smoothInput, this_ptr, "smoothfiles", &_10, 344, &_36$$19, &_37$$19, &_38$$19, &_39$$19, &_40$$19, &prefix); zephir_check_call_status(); zephir_is_iterable(&smoothInput, 0, "phalcon/Http/Request.zep", 920); if (Z_TYPE_P(&smoothInput) == IS_ARRAY) { @@ -2378,7 +2378,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_47$$22); object_init_ex(&_47$$22, phalcon_http_request_file_ce); zephir_array_fetch_string(&_48$$22, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 911); - ZEPHIR_CALL_METHOD(NULL, &_47$$22, "__construct", &_18, 342, &dataFile, &_48$$22); + ZEPHIR_CALL_METHOD(NULL, &_47$$22, "__construct", &_18, 345, &dataFile, &_48$$22); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&_49$$22); zephir_array_fetch_string(&_49$$22, &file, SL("key"), PH_NOISY, "phalcon/Http/Request.zep", 908); @@ -2387,7 +2387,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_50$$23); object_init_ex(&_50$$23, phalcon_http_request_file_ce); zephir_array_fetch_string(&_51$$23, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 916); - ZEPHIR_CALL_METHOD(NULL, &_50$$23, "__construct", &_18, 342, &dataFile, &_51$$23); + ZEPHIR_CALL_METHOD(NULL, &_50$$23, "__construct", &_18, 345, &dataFile, &_51$$23); zephir_check_call_status(); zephir_array_append(&files, &_50$$23, PH_SEPARATE, "phalcon/Http/Request.zep", 916); } @@ -2432,7 +2432,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_56$$26); object_init_ex(&_56$$26, phalcon_http_request_file_ce); zephir_array_fetch_string(&_57$$26, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 911); - ZEPHIR_CALL_METHOD(NULL, &_56$$26, "__construct", &_18, 342, &dataFile, &_57$$26); + ZEPHIR_CALL_METHOD(NULL, &_56$$26, "__construct", &_18, 345, &dataFile, &_57$$26); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&_58$$26); zephir_array_fetch_string(&_58$$26, &file, SL("key"), PH_NOISY, "phalcon/Http/Request.zep", 908); @@ -2441,7 +2441,7 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) ZEPHIR_INIT_NVAR(&_59$$27); object_init_ex(&_59$$27, phalcon_http_request_file_ce); zephir_array_fetch_string(&_60$$27, &file, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 916); - ZEPHIR_CALL_METHOD(NULL, &_59$$27, "__construct", &_18, 342, &dataFile, &_60$$27); + ZEPHIR_CALL_METHOD(NULL, &_59$$27, "__construct", &_18, 345, &dataFile, &_60$$27); zephir_check_call_status(); zephir_array_append(&files, &_59$$27, PH_SEPARATE, "phalcon/Http/Request.zep", 916); } @@ -2461,13 +2461,13 @@ PHP_METHOD(Phalcon_Http_Request, getUploadedFiles) if (namedKeys == 1) { ZEPHIR_INIT_NVAR(&_63$$30); object_init_ex(&_63$$30, phalcon_http_request_file_ce); - ZEPHIR_CALL_METHOD(NULL, &_63$$30, "__construct", &_18, 342, &input, &prefix); + ZEPHIR_CALL_METHOD(NULL, &_63$$30, "__construct", &_18, 345, &input, &prefix); zephir_check_call_status(); zephir_array_update_zval(&files, &prefix, &_63$$30, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(&_64$$31); object_init_ex(&_64$$31, phalcon_http_request_file_ce); - ZEPHIR_CALL_METHOD(NULL, &_64$$31, "__construct", &_18, 342, &input, &prefix); + ZEPHIR_CALL_METHOD(NULL, &_64$$31, "__construct", &_18, 345, &input, &prefix); zephir_check_call_status(); zephir_array_append(&files, &_64$$31, PH_SEPARATE, "phalcon/Http/Request.zep", 925); } @@ -2680,13 +2680,13 @@ PHP_METHOD(Phalcon_Http_Request, hasHeader) zephir_check_call_status(); ZEPHIR_INIT_VAR(&name); zephir_fast_strtoupper(&name, &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "hasserver", NULL, 334, &name); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "hasserver", NULL, 337, &name); zephir_check_call_status(); _4 = zephir_is_true(&_3); if (!(_4)) { ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SV(&_6, "HTTP_", &name); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "hasserver", NULL, 334, &_6); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "hasserver", NULL, 337, &_6); zephir_check_call_status(); _4 = zephir_is_true(&_5); } @@ -2879,7 +2879,7 @@ PHP_METHOD(Phalcon_Http_Request, hasServer) } - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); RETURN_MM_BOOL(zephir_array_isset(&server, &name)); } @@ -2904,7 +2904,7 @@ PHP_METHOD(Phalcon_Http_Request, isAjax) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "HTTP_X_REQUESTED_WITH"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 334, &_1); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 337, &_1); zephir_check_call_status(); _2 = zephir_is_true(&_0); if (_2) { @@ -2933,7 +2933,7 @@ PHP_METHOD(Phalcon_Http_Request, isConnect) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "CONNECT")); } @@ -2954,7 +2954,7 @@ PHP_METHOD(Phalcon_Http_Request, isDelete) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "DELETE")); } @@ -2975,7 +2975,7 @@ PHP_METHOD(Phalcon_Http_Request, isGet) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "GET")); } @@ -2996,7 +2996,7 @@ PHP_METHOD(Phalcon_Http_Request, isHead) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "HEAD")); } @@ -3044,7 +3044,7 @@ PHP_METHOD(Phalcon_Http_Request, isMethod) } - ZEPHIR_CALL_METHOD(&httpMethod, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&httpMethod, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); if (Z_TYPE_P(methods) == IS_STRING) { _0$$3 = strict; @@ -3058,7 +3058,7 @@ PHP_METHOD(Phalcon_Http_Request, isMethod) object_init_ex(&_2$$4, phalcon_http_request_exception_ce); ZEPHIR_INIT_VAR(&_3$$4); ZEPHIR_CONCAT_SV(&_3$$4, "Invalid HTTP method: ", methods); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 29, &_3$$4); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 32, &_3$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$4, "phalcon/Http/Request.zep", 1117); ZEPHIR_MM_RESTORE(); @@ -3078,7 +3078,7 @@ PHP_METHOD(Phalcon_Http_Request, isMethod) } else { ZVAL_BOOL(&_7$$6, 0); } - ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "ismethod", &_8, 344, &method, &_7$$6); + ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "ismethod", &_8, 347, &method, &_7$$6); zephir_check_call_status(); if (zephir_is_true(&_6$$6)) { RETURN_MM_BOOL(1); @@ -3100,7 +3100,7 @@ PHP_METHOD(Phalcon_Http_Request, isMethod) } else { ZVAL_BOOL(&_10$$8, 0); } - ZEPHIR_CALL_METHOD(&_9$$8, this_ptr, "ismethod", &_8, 344, &method, &_10$$8); + ZEPHIR_CALL_METHOD(&_9$$8, this_ptr, "ismethod", &_8, 347, &method, &_10$$8); zephir_check_call_status(); if (zephir_is_true(&_9$$8)) { RETURN_MM_BOOL(1); @@ -3135,7 +3135,7 @@ PHP_METHOD(Phalcon_Http_Request, isOptions) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "OPTIONS")); } @@ -3156,7 +3156,7 @@ PHP_METHOD(Phalcon_Http_Request, isPatch) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "PATCH")); } @@ -3177,7 +3177,7 @@ PHP_METHOD(Phalcon_Http_Request, isPost) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "POST")); } @@ -3198,7 +3198,7 @@ PHP_METHOD(Phalcon_Http_Request, isPut) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "PUT")); } @@ -3219,7 +3219,7 @@ PHP_METHOD(Phalcon_Http_Request, isPurge) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "PURGE")); } @@ -3276,7 +3276,7 @@ PHP_METHOD(Phalcon_Http_Request, isSoap) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "HTTP_SOAPACTION"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 334, &_1); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 337, &_1); zephir_check_call_status(); if (zephir_is_true(&_0)) { RETURN_MM_BOOL(1); @@ -3305,7 +3305,7 @@ PHP_METHOD(Phalcon_Http_Request, isTrace) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 343); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL, 346); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_STRING_IDENTICAL(&_0, "TRACE")); } @@ -3414,7 +3414,7 @@ PHP_METHOD(Phalcon_Http_Request, numFiles) } else { ZVAL_BOOL(&_4$$8, 0); } - ZEPHIR_CALL_METHOD(&_3$$8, this_ptr, "hasfilehelper", &_5, 345, &error, &_4$$8); + ZEPHIR_CALL_METHOD(&_3$$8, this_ptr, "hasfilehelper", &_5, 348, &error, &_4$$8); zephir_check_call_status(); numberFiles += zephir_get_numberval(&_3$$8); } @@ -3448,7 +3448,7 @@ PHP_METHOD(Phalcon_Http_Request, numFiles) } else { ZVAL_BOOL(&_8$$13, 0); } - ZEPHIR_CALL_METHOD(&_7$$13, this_ptr, "hasfilehelper", &_5, 345, &error, &_8$$13); + ZEPHIR_CALL_METHOD(&_7$$13, this_ptr, "hasfilehelper", &_5, 348, &error, &_8$$13); zephir_check_call_status(); numberFiles += zephir_get_numberval(&_7$$13); } @@ -3571,13 +3571,13 @@ PHP_METHOD(Phalcon_Http_Request, setParameterFilters) object_init_ex(&_0$$3, phalcon_http_request_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZEPHIR_CONCAT_SVS(&_1$$3, "Filters have not been defined for '", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_1$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Http/Request.zep", 1315); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&filterService, this_ptr, "getfilterservice", NULL, 346); + ZEPHIR_CALL_METHOD(&filterService, this_ptr, "getfilterservice", NULL, 349); zephir_check_call_status(); zephir_is_iterable(&filters, 0, "phalcon/Http/Request.zep", 1328); if (Z_TYPE_P(&filters) == IS_ARRAY) { @@ -3592,7 +3592,7 @@ PHP_METHOD(Phalcon_Http_Request, setParameterFilters) object_init_ex(&_6$$5, phalcon_http_request_exception_ce); ZEPHIR_INIT_NVAR(&_7$$5); ZEPHIR_CONCAT_SVS(&_7$$5, "Sanitizer '", &sanitizer, "' does not exist in the filter locator"); - ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", NULL, 29, &_7$$5); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", NULL, 32, &_7$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$5, "phalcon/Http/Request.zep", 1324); ZEPHIR_MM_RESTORE(); @@ -3617,7 +3617,7 @@ PHP_METHOD(Phalcon_Http_Request, setParameterFilters) object_init_ex(&_10$$7, phalcon_http_request_exception_ce); ZEPHIR_INIT_NVAR(&_11$$7); ZEPHIR_CONCAT_SVS(&_11$$7, "Sanitizer '", &sanitizer, "' does not exist in the filter locator"); - ZEPHIR_CALL_METHOD(NULL, &_10$$7, "__construct", NULL, 29, &_11$$7); + ZEPHIR_CALL_METHOD(NULL, &_10$$7, "__construct", NULL, 32, &_11$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$7, "phalcon/Http/Request.zep", 1324); ZEPHIR_MM_RESTORE(); @@ -3918,7 +3918,7 @@ PHP_METHOD(Phalcon_Http_Request, getHelper) RETURN_MM(); } if (Z_TYPE_P(filters) != IS_NULL) { - ZEPHIR_CALL_METHOD(&filterService, this_ptr, "getfilterservice", NULL, 346); + ZEPHIR_CALL_METHOD(&filterService, this_ptr, "getfilterservice", NULL, 349); zephir_check_call_status(); if (noRecursive) { ZVAL_BOOL(&_3$$6, 1); @@ -3994,7 +3994,7 @@ PHP_METHOD(Phalcon_Http_Request, hasFileHelper) } else { ZVAL_BOOL(&_4$$7, 0); } - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "hasfilehelper", &_5, 345, &value, &_4$$7); + ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "hasfilehelper", &_5, 348, &value, &_4$$7); zephir_check_call_status(); numberFiles += zephir_get_numberval(&_3$$7); } @@ -4025,7 +4025,7 @@ PHP_METHOD(Phalcon_Http_Request, hasFileHelper) } else { ZVAL_BOOL(&_8$$11, 0); } - ZEPHIR_CALL_METHOD(&_7$$11, this_ptr, "hasfilehelper", &_5, 345, &value, &_8$$11); + ZEPHIR_CALL_METHOD(&_7$$11, this_ptr, "hasfilehelper", &_5, 348, &value, &_8$$11); zephir_check_call_status(); numberFiles += zephir_get_numberval(&_7$$11); } @@ -4152,7 +4152,7 @@ PHP_METHOD(Phalcon_Http_Request, getQualityHeader) ZVAL_STRING(&_1, "/,\\s*/"); ZVAL_LONG(&_2, -1); ZVAL_LONG(&_3, 1); - ZEPHIR_CALL_FUNCTION(&parts, "preg_split", NULL, 67, &_1, &serverValue, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&parts, "preg_split", NULL, 70, &_1, &serverValue, &_2, &_3); zephir_check_call_status(); zephir_is_iterable(&parts, 0, "phalcon/Http/Request.zep", 1499); if (Z_TYPE_P(&parts) == IS_ARRAY) { @@ -4168,7 +4168,7 @@ PHP_METHOD(Phalcon_Http_Request, getQualityHeader) ZVAL_STRING(&_7$$3, "/\\s*;\\s*/"); ZVAL_LONG(&_8$$3, -1); ZVAL_LONG(&_9$$3, 1); - ZEPHIR_CALL_FUNCTION(&headerSplit, "preg_split", NULL, 67, &_7$$3, &_6$$3, &_8$$3, &_9$$3); + ZEPHIR_CALL_FUNCTION(&headerSplit, "preg_split", NULL, 70, &_7$$3, &_6$$3, &_8$$3, &_9$$3); zephir_check_call_status(); zephir_is_iterable(&headerSplit, 0, "phalcon/Http/Request.zep", 1496); if (Z_TYPE_P(&headerSplit) == IS_ARRAY) { @@ -4266,7 +4266,7 @@ PHP_METHOD(Phalcon_Http_Request, getQualityHeader) ZVAL_STRING(&_29$$14, "/\\s*;\\s*/"); ZVAL_LONG(&_30$$14, -1); ZVAL_LONG(&_31$$14, 1); - ZEPHIR_CALL_FUNCTION(&headerSplit, "preg_split", NULL, 67, &_29$$14, &_28$$14, &_30$$14, &_31$$14); + ZEPHIR_CALL_FUNCTION(&headerSplit, "preg_split", NULL, 70, &_29$$14, &_28$$14, &_30$$14, &_31$$14); zephir_check_call_status(); zephir_is_iterable(&headerSplit, 0, "phalcon/Http/Request.zep", 1496); if (Z_TYPE_P(&headerSplit) == IS_ARRAY) { @@ -4419,7 +4419,7 @@ PHP_METHOD(Phalcon_Http_Request, resolveAuthorizationHeaders) ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdi", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&container, &_0); - ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 336); + ZEPHIR_CALL_METHOD(&server, this_ptr, "getserverarray", NULL, 339); zephir_check_call_status(); if (Z_TYPE_P(&container) != IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); @@ -4454,13 +4454,13 @@ PHP_METHOD(Phalcon_Http_Request, resolveAuthorizationHeaders) } ZEPHIR_INIT_VAR(&_8); ZVAL_STRING(&_8, "PHP_AUTH_USER"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 334, &_8); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hasserver", NULL, 337, &_8); zephir_check_call_status(); _9 = zephir_is_true(&_0); if (_9) { ZEPHIR_INIT_NVAR(&_8); ZVAL_STRING(&_8, "PHP_AUTH_PW"); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "hasserver", NULL, 334, &_8); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "hasserver", NULL, 337, &_8); zephir_check_call_status(); _9 = zephir_is_true(&_10); } @@ -4478,11 +4478,11 @@ PHP_METHOD(Phalcon_Http_Request, resolveAuthorizationHeaders) } else { ZEPHIR_INIT_VAR(&_15$$8); ZVAL_STRING(&_15$$8, "HTTP_AUTHORIZATION"); - ZEPHIR_CALL_METHOD(&_14$$8, this_ptr, "hasserver", NULL, 334, &_15$$8); + ZEPHIR_CALL_METHOD(&_14$$8, this_ptr, "hasserver", NULL, 337, &_15$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_15$$8); ZVAL_STRING(&_15$$8, "REDIRECT_HTTP_AUTHORIZATION"); - ZEPHIR_CALL_METHOD(&_16$$8, this_ptr, "hasserver", NULL, 334, &_15$$8); + ZEPHIR_CALL_METHOD(&_16$$8, this_ptr, "hasserver", NULL, 337, &_15$$8); zephir_check_call_status(); if (zephir_is_true(&_14$$8)) { ZEPHIR_INIT_VAR(&_17$$9); @@ -4498,29 +4498,29 @@ PHP_METHOD(Phalcon_Http_Request, resolveAuthorizationHeaders) if (zephir_is_true(&authHeader)) { ZEPHIR_INIT_VAR(&_19$$11); ZVAL_STRING(&_19$$11, "basic "); - ZEPHIR_CALL_FUNCTION(&_20$$11, "stripos", NULL, 347, &authHeader, &_19$$11); + ZEPHIR_CALL_FUNCTION(&_20$$11, "stripos", NULL, 350, &authHeader, &_19$$11); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_19$$11); ZVAL_STRING(&_19$$11, "digest "); - ZEPHIR_CALL_FUNCTION(&_21$$11, "stripos", NULL, 347, &authHeader, &_19$$11); + ZEPHIR_CALL_FUNCTION(&_21$$11, "stripos", NULL, 350, &authHeader, &_19$$11); zephir_check_call_status(); _22$$11 = ZEPHIR_IS_LONG_IDENTICAL(&_21$$11, 0); if (_22$$11) { ZEPHIR_INIT_NVAR(&_19$$11); ZVAL_STRING(&_19$$11, "PHP_AUTH_DIGEST"); - ZEPHIR_CALL_METHOD(&_23$$11, this_ptr, "hasserver", NULL, 334, &_19$$11); + ZEPHIR_CALL_METHOD(&_23$$11, this_ptr, "hasserver", NULL, 337, &_19$$11); zephir_check_call_status(); _22$$11 = !zephir_is_true(&_23$$11); } ZEPHIR_INIT_NVAR(&_19$$11); ZVAL_STRING(&_19$$11, "bearer "); - ZEPHIR_CALL_FUNCTION(&_24$$11, "stripos", NULL, 347, &authHeader, &_19$$11); + ZEPHIR_CALL_FUNCTION(&_24$$11, "stripos", NULL, 350, &authHeader, &_19$$11); zephir_check_call_status(); if (ZEPHIR_IS_LONG_IDENTICAL(&_20$$11, 0)) { ZVAL_LONG(&_25$$12, 6); ZEPHIR_INIT_VAR(&_26$$12); zephir_substr(&_26$$12, &authHeader, 6 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_FUNCTION(&_27$$12, "base64_decode", NULL, 226, &_26$$12); + ZEPHIR_CALL_FUNCTION(&_27$$12, "base64_decode", NULL, 229, &_26$$12); zephir_check_call_status(); ZEPHIR_INIT_VAR(&exploded); zephir_fast_explode_str(&exploded, SL(":"), &_27$$12, 2 ); @@ -4544,7 +4544,7 @@ PHP_METHOD(Phalcon_Http_Request, resolveAuthorizationHeaders) zephir_array_fetch_string(&_31$$17, &headers, SL("Php-Auth-Pw"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1571); ZEPHIR_INIT_VAR(&_32$$17); ZEPHIR_CONCAT_VSV(&_32$$17, &_30$$17, ":", &_31$$17); - ZEPHIR_CALL_FUNCTION(&_33$$17, "base64_encode", NULL, 227, &_32$$17); + ZEPHIR_CALL_FUNCTION(&_33$$17, "base64_encode", NULL, 230, &_32$$17); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_34$$17); ZEPHIR_CONCAT_SV(&_34$$17, "Basic ", &_33$$17); @@ -4683,7 +4683,7 @@ PHP_METHOD(Phalcon_Http_Request, smoothFiles) zephir_array_fetch(&_8$$5, &tmp_names, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1623); zephir_array_fetch(&_9$$5, &sizes, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1624); zephir_array_fetch(&_10$$5, &errors, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1625); - ZEPHIR_CALL_METHOD(&parentFiles, this_ptr, "smoothfiles", &_11, 341, &_6$$5, &_7$$5, &_8$$5, &_9$$5, &_10$$5, &p); + ZEPHIR_CALL_METHOD(&parentFiles, this_ptr, "smoothfiles", &_11, 344, &_6$$5, &_7$$5, &_8$$5, &_9$$5, &_10$$5, &p); zephir_check_call_status(); zephir_is_iterable(&parentFiles, 0, "phalcon/Http/Request.zep", 1632); if (Z_TYPE_P(&parentFiles) == IS_ARRAY) { @@ -4752,7 +4752,7 @@ PHP_METHOD(Phalcon_Http_Request, smoothFiles) zephir_array_fetch(&_18$$10, &tmp_names, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1623); zephir_array_fetch(&_19$$10, &sizes, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1624); zephir_array_fetch(&_20$$10, &errors, &idx, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1625); - ZEPHIR_CALL_METHOD(&parentFiles, this_ptr, "smoothfiles", &_11, 341, &_16$$10, &_17$$10, &_18$$10, &_19$$10, &_20$$10, &p); + ZEPHIR_CALL_METHOD(&parentFiles, this_ptr, "smoothfiles", &_11, 344, &_16$$10, &_17$$10, &_18$$10, &_19$$10, &_20$$10, &p); zephir_check_call_status(); zephir_is_iterable(&parentFiles, 0, "phalcon/Http/Request.zep", 1632); if (Z_TYPE_P(&parentFiles) == IS_ARRAY) { @@ -4944,8 +4944,8 @@ PHP_METHOD(Phalcon_Http_Request, getPatchPut) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool notAllowEmpty, noRecursive, _0$$3; - zval *collection_param = NULL, *name_param = NULL, *filters = NULL, filters_sub, *defaultValue = NULL, defaultValue_sub, *notAllowEmpty_param = NULL, *noRecursive_param = NULL, __$null, cached, contentType, _5, _6, _1$$3, _2$$3, _3$$4, _4$$6; + zend_bool notAllowEmpty, noRecursive; + zval *collection_param = NULL, *name_param = NULL, *filters = NULL, filters_sub, *defaultValue = NULL, defaultValue_sub, *notAllowEmpty_param = NULL, *noRecursive_param = NULL, __$null, cached, contentType, _5, _6, _0$$4, _1$$4, _3$$4, _2$$5, _4$$8; zval collection, name; zval *this_ptr = getThis(); @@ -4958,10 +4958,11 @@ PHP_METHOD(Phalcon_Http_Request, getPatchPut) ZVAL_UNDEF(&contentType); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$6); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_4$$8); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 6) @@ -5009,18 +5010,24 @@ PHP_METHOD(Phalcon_Http_Request, getPatchPut) if (Z_TYPE_P(&cached) == IS_NULL) { ZEPHIR_CALL_METHOD(&contentType, this_ptr, "getcontenttype", NULL, 0); zephir_check_call_status(); - _0$$3 = Z_TYPE_P(&contentType) == IS_STRING; - if (_0$$3) { - ZEPHIR_INIT_VAR(&_1$$3); - ZVAL_STRING(&_1$$3, "json"); - ZEPHIR_CALL_FUNCTION(&_2$$3, "stripos", NULL, 347, &contentType, &_1$$3); + if (Z_TYPE_P(&contentType) == IS_STRING) { + ZEPHIR_INIT_VAR(&_0$$4); + ZVAL_STRING(&_0$$4, "json"); + ZEPHIR_CALL_FUNCTION(&_1$$4, "stripos", NULL, 350, &contentType, &_0$$4); zephir_check_call_status(); - _0$$3 = !ZEPHIR_IS_FALSE(&_2$$3); - } - if (_0$$3) { - ZVAL_BOOL(&_3$$4, 1); - ZEPHIR_CALL_METHOD(&cached, this_ptr, "getjsonrawbody", NULL, 0, &_3$$4); + if (!ZEPHIR_IS_FALSE(&_1$$4)) { + ZVAL_BOOL(&_2$$5, 1); + ZEPHIR_CALL_METHOD(&cached, this_ptr, "getjsonrawbody", NULL, 0, &_2$$5); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(&_0$$4); + ZVAL_STRING(&_0$$4, "multipart/form-data"); + ZEPHIR_CALL_FUNCTION(&_3$$4, "stripos", NULL, 350, &contentType, &_0$$4); zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_3$$4)) { + ZEPHIR_CALL_METHOD(&cached, this_ptr, "getformdata", NULL, 351); + zephir_check_call_status(); + } if (Z_TYPE_P(&cached) != IS_ARRAY) { ZEPHIR_INIT_NVAR(&cached); array_init(&cached); @@ -5028,10 +5035,10 @@ PHP_METHOD(Phalcon_Http_Request, getPatchPut) } else { ZEPHIR_INIT_NVAR(&cached); array_init(&cached); - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getrawbody", NULL, 0); + ZEPHIR_CALL_METHOD(&_4$$8, this_ptr, "getrawbody", NULL, 0); zephir_check_call_status(); ZEPHIR_MAKE_REF(&cached); - ZEPHIR_CALL_FUNCTION(NULL, "parse_str", NULL, 348, &_4$$6, &cached); + ZEPHIR_CALL_FUNCTION(NULL, "parse_str", NULL, 352, &_4$$8, &cached); ZEPHIR_UNREF(&cached); zephir_check_call_status(); } @@ -5047,11 +5054,795 @@ PHP_METHOD(Phalcon_Http_Request, getPatchPut) } else { ZVAL_BOOL(&_6, 0); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 332, &cached, &name, filters, defaultValue, &_5, &_6); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethelper", NULL, 335, &cached, &name, filters, defaultValue, &_5, &_6); zephir_check_call_status(); RETURN_MM(); } +/** + * parse multipart/form-data from raw data + */ +PHP_METHOD(Phalcon_Http_Request, getFormData) +{ + zval dataset, headers$$3, headers$$25; + zval boundary, matches, _0, _1, _2, _3, bodyParts, _4, _5, _6, _7, bodyPart, *_8, _9, splited$$3, _10$$3, _11$$3, headerParts$$3, headerPart$$3, _12$$3, _13$$3, *_14$$3, _15$$3, _67$$3, _68$$3, _69$$3, _16$$5, _17$$5, exploded$$5, headerName$$5, headerValue$$5, _18$$5, _19$$5, _20$$5, _21$$5, _22$$5, explodedHeader$$7, part$$7, *_23$$7, _24$$7, _25$$8, _26$$8, _27$$8, explodedPart$$9, namePart$$9, valuePart$$9, _29$$9, _30$$9, _31$$9, _32$$9, _33$$9, _34$$11, _35$$11, _36$$11, explodedPart$$12, namePart$$12, valuePart$$12, _37$$12, _38$$12, _39$$12, _40$$12, _41$$12, _42$$15, _43$$15, exploded$$15, headerName$$15, headerValue$$15, _44$$15, _45$$15, _46$$15, _47$$15, _48$$15, explodedHeader$$17, part$$17, *_49$$17, _50$$17, _51$$18, _52$$18, _53$$18, explodedPart$$19, namePart$$19, valuePart$$19, _54$$19, _55$$19, _56$$19, _57$$19, _58$$19, _59$$21, _60$$21, _61$$21, explodedPart$$22, namePart$$22, valuePart$$22, _62$$22, _63$$22, _64$$22, _65$$22, _66$$22, splited$$25, _70$$25, _71$$25, headerParts$$25, headerPart$$25, _72$$25, _73$$25, *_74$$25, _75$$25, _126$$25, _127$$25, _128$$25, _76$$27, _77$$27, exploded$$27, headerName$$27, headerValue$$27, _78$$27, _79$$27, _80$$27, _81$$27, _82$$27, explodedHeader$$29, part$$29, *_83$$29, _84$$29, _85$$30, _86$$30, _87$$30, explodedPart$$31, namePart$$31, valuePart$$31, _88$$31, _89$$31, _90$$31, _91$$31, _92$$31, _93$$33, _94$$33, _95$$33, explodedPart$$34, namePart$$34, valuePart$$34, _96$$34, _97$$34, _98$$34, _99$$34, _100$$34, _101$$37, _102$$37, exploded$$37, headerName$$37, headerValue$$37, _103$$37, _104$$37, _105$$37, _106$$37, _107$$37, explodedHeader$$39, part$$39, *_108$$39, _109$$39, _110$$40, _111$$40, _112$$40, explodedPart$$41, namePart$$41, valuePart$$41, _113$$41, _114$$41, _115$$41, _116$$41, _117$$41, _118$$43, _119$$43, _120$$43, explodedPart$$44, namePart$$44, valuePart$$44, _121$$44, _122$$44, _123$$44, _124$$44, _125$$44; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_28 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&boundary); + ZVAL_UNDEF(&matches); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&bodyParts); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&bodyPart); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&splited$$3); + ZVAL_UNDEF(&_10$$3); + ZVAL_UNDEF(&_11$$3); + ZVAL_UNDEF(&headerParts$$3); + ZVAL_UNDEF(&headerPart$$3); + ZVAL_UNDEF(&_12$$3); + ZVAL_UNDEF(&_13$$3); + ZVAL_UNDEF(&_15$$3); + ZVAL_UNDEF(&_67$$3); + ZVAL_UNDEF(&_68$$3); + ZVAL_UNDEF(&_69$$3); + ZVAL_UNDEF(&_16$$5); + ZVAL_UNDEF(&_17$$5); + ZVAL_UNDEF(&exploded$$5); + ZVAL_UNDEF(&headerName$$5); + ZVAL_UNDEF(&headerValue$$5); + ZVAL_UNDEF(&_18$$5); + ZVAL_UNDEF(&_19$$5); + ZVAL_UNDEF(&_20$$5); + ZVAL_UNDEF(&_21$$5); + ZVAL_UNDEF(&_22$$5); + ZVAL_UNDEF(&explodedHeader$$7); + ZVAL_UNDEF(&part$$7); + ZVAL_UNDEF(&_24$$7); + ZVAL_UNDEF(&_25$$8); + ZVAL_UNDEF(&_26$$8); + ZVAL_UNDEF(&_27$$8); + ZVAL_UNDEF(&explodedPart$$9); + ZVAL_UNDEF(&namePart$$9); + ZVAL_UNDEF(&valuePart$$9); + ZVAL_UNDEF(&_29$$9); + ZVAL_UNDEF(&_30$$9); + ZVAL_UNDEF(&_31$$9); + ZVAL_UNDEF(&_32$$9); + ZVAL_UNDEF(&_33$$9); + ZVAL_UNDEF(&_34$$11); + ZVAL_UNDEF(&_35$$11); + ZVAL_UNDEF(&_36$$11); + ZVAL_UNDEF(&explodedPart$$12); + ZVAL_UNDEF(&namePart$$12); + ZVAL_UNDEF(&valuePart$$12); + ZVAL_UNDEF(&_37$$12); + ZVAL_UNDEF(&_38$$12); + ZVAL_UNDEF(&_39$$12); + ZVAL_UNDEF(&_40$$12); + ZVAL_UNDEF(&_41$$12); + ZVAL_UNDEF(&_42$$15); + ZVAL_UNDEF(&_43$$15); + ZVAL_UNDEF(&exploded$$15); + ZVAL_UNDEF(&headerName$$15); + ZVAL_UNDEF(&headerValue$$15); + ZVAL_UNDEF(&_44$$15); + ZVAL_UNDEF(&_45$$15); + ZVAL_UNDEF(&_46$$15); + ZVAL_UNDEF(&_47$$15); + ZVAL_UNDEF(&_48$$15); + ZVAL_UNDEF(&explodedHeader$$17); + ZVAL_UNDEF(&part$$17); + ZVAL_UNDEF(&_50$$17); + ZVAL_UNDEF(&_51$$18); + ZVAL_UNDEF(&_52$$18); + ZVAL_UNDEF(&_53$$18); + ZVAL_UNDEF(&explodedPart$$19); + ZVAL_UNDEF(&namePart$$19); + ZVAL_UNDEF(&valuePart$$19); + ZVAL_UNDEF(&_54$$19); + ZVAL_UNDEF(&_55$$19); + ZVAL_UNDEF(&_56$$19); + ZVAL_UNDEF(&_57$$19); + ZVAL_UNDEF(&_58$$19); + ZVAL_UNDEF(&_59$$21); + ZVAL_UNDEF(&_60$$21); + ZVAL_UNDEF(&_61$$21); + ZVAL_UNDEF(&explodedPart$$22); + ZVAL_UNDEF(&namePart$$22); + ZVAL_UNDEF(&valuePart$$22); + ZVAL_UNDEF(&_62$$22); + ZVAL_UNDEF(&_63$$22); + ZVAL_UNDEF(&_64$$22); + ZVAL_UNDEF(&_65$$22); + ZVAL_UNDEF(&_66$$22); + ZVAL_UNDEF(&splited$$25); + ZVAL_UNDEF(&_70$$25); + ZVAL_UNDEF(&_71$$25); + ZVAL_UNDEF(&headerParts$$25); + ZVAL_UNDEF(&headerPart$$25); + ZVAL_UNDEF(&_72$$25); + ZVAL_UNDEF(&_73$$25); + ZVAL_UNDEF(&_75$$25); + ZVAL_UNDEF(&_126$$25); + ZVAL_UNDEF(&_127$$25); + ZVAL_UNDEF(&_128$$25); + ZVAL_UNDEF(&_76$$27); + ZVAL_UNDEF(&_77$$27); + ZVAL_UNDEF(&exploded$$27); + ZVAL_UNDEF(&headerName$$27); + ZVAL_UNDEF(&headerValue$$27); + ZVAL_UNDEF(&_78$$27); + ZVAL_UNDEF(&_79$$27); + ZVAL_UNDEF(&_80$$27); + ZVAL_UNDEF(&_81$$27); + ZVAL_UNDEF(&_82$$27); + ZVAL_UNDEF(&explodedHeader$$29); + ZVAL_UNDEF(&part$$29); + ZVAL_UNDEF(&_84$$29); + ZVAL_UNDEF(&_85$$30); + ZVAL_UNDEF(&_86$$30); + ZVAL_UNDEF(&_87$$30); + ZVAL_UNDEF(&explodedPart$$31); + ZVAL_UNDEF(&namePart$$31); + ZVAL_UNDEF(&valuePart$$31); + ZVAL_UNDEF(&_88$$31); + ZVAL_UNDEF(&_89$$31); + ZVAL_UNDEF(&_90$$31); + ZVAL_UNDEF(&_91$$31); + ZVAL_UNDEF(&_92$$31); + ZVAL_UNDEF(&_93$$33); + ZVAL_UNDEF(&_94$$33); + ZVAL_UNDEF(&_95$$33); + ZVAL_UNDEF(&explodedPart$$34); + ZVAL_UNDEF(&namePart$$34); + ZVAL_UNDEF(&valuePart$$34); + ZVAL_UNDEF(&_96$$34); + ZVAL_UNDEF(&_97$$34); + ZVAL_UNDEF(&_98$$34); + ZVAL_UNDEF(&_99$$34); + ZVAL_UNDEF(&_100$$34); + ZVAL_UNDEF(&_101$$37); + ZVAL_UNDEF(&_102$$37); + ZVAL_UNDEF(&exploded$$37); + ZVAL_UNDEF(&headerName$$37); + ZVAL_UNDEF(&headerValue$$37); + ZVAL_UNDEF(&_103$$37); + ZVAL_UNDEF(&_104$$37); + ZVAL_UNDEF(&_105$$37); + ZVAL_UNDEF(&_106$$37); + ZVAL_UNDEF(&_107$$37); + ZVAL_UNDEF(&explodedHeader$$39); + ZVAL_UNDEF(&part$$39); + ZVAL_UNDEF(&_109$$39); + ZVAL_UNDEF(&_110$$40); + ZVAL_UNDEF(&_111$$40); + ZVAL_UNDEF(&_112$$40); + ZVAL_UNDEF(&explodedPart$$41); + ZVAL_UNDEF(&namePart$$41); + ZVAL_UNDEF(&valuePart$$41); + ZVAL_UNDEF(&_113$$41); + ZVAL_UNDEF(&_114$$41); + ZVAL_UNDEF(&_115$$41); + ZVAL_UNDEF(&_116$$41); + ZVAL_UNDEF(&_117$$41); + ZVAL_UNDEF(&_118$$43); + ZVAL_UNDEF(&_119$$43); + ZVAL_UNDEF(&_120$$43); + ZVAL_UNDEF(&explodedPart$$44); + ZVAL_UNDEF(&namePart$$44); + ZVAL_UNDEF(&valuePart$$44); + ZVAL_UNDEF(&_121$$44); + ZVAL_UNDEF(&_122$$44); + ZVAL_UNDEF(&_123$$44); + ZVAL_UNDEF(&_124$$44); + ZVAL_UNDEF(&_125$$44); + ZVAL_UNDEF(&dataset); + ZVAL_UNDEF(&headers$$3); + ZVAL_UNDEF(&headers$$25); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcontenttype", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "/boundary=(.*)$/is"); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "/boundary=(.*)$/is"); + zephir_preg_match(&_2, &_3, &_0, &matches, 0, 0 , 0 ); + ZEPHIR_OBS_VAR(&boundary); + zephir_array_fetch_long(&boundary, &matches, 1, PH_NOISY, "phalcon/Http/Request.zep", 1766); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "/"); + ZEPHIR_CALL_FUNCTION(&_5, "preg_quote", NULL, 353, &boundary, &_4); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_6); + ZEPHIR_CONCAT_SVS(&_6, "/\\R?-+", &_5, "/s"); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "getrawbody", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&bodyParts, "preg_split", NULL, 70, &_6, &_7); + zephir_check_call_status(); + ZEPHIR_MAKE_REF(&bodyParts); + ZEPHIR_CALL_FUNCTION(NULL, "array_pop", NULL, 354, &bodyParts); + ZEPHIR_UNREF(&bodyParts); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&dataset); + array_init(&dataset); + zephir_is_iterable(&bodyParts, 0, "phalcon/Http/Request.zep", 1827); + if (Z_TYPE_P(&bodyParts) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&bodyParts), _8) + { + ZEPHIR_INIT_NVAR(&bodyPart); + ZVAL_COPY(&bodyPart, _8); + if (ZEPHIR_IS_EMPTY(&bodyPart)) { + continue; + } + ZEPHIR_INIT_NVAR(&_10$$3); + ZVAL_STRING(&_10$$3, "/\\R\\R/"); + ZVAL_LONG(&_11$$3, 2); + ZEPHIR_CALL_FUNCTION(&splited$$3, "preg_split", NULL, 70, &_10$$3, &bodyPart, &_11$$3); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&headers$$3); + array_init(&headers$$3); + zephir_array_fetch_long(&_12$$3, &splited$$3, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1788); + ZEPHIR_INIT_NVAR(&_10$$3); + ZVAL_STRING(&_10$$3, "/\\R/s"); + ZVAL_LONG(&_11$$3, -1); + ZVAL_LONG(&_13$$3, 1); + ZEPHIR_CALL_FUNCTION(&headerParts$$3, "preg_split", NULL, 70, &_10$$3, &_12$$3, &_11$$3, &_13$$3); + zephir_check_call_status(); + zephir_is_iterable(&headerParts$$3, 0, "phalcon/Http/Request.zep", 1824); + if (Z_TYPE_P(&headerParts$$3) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&headerParts$$3), _14$$3) + { + ZEPHIR_INIT_NVAR(&headerPart$$3); + ZVAL_COPY(&headerPart$$3, _14$$3); + ZEPHIR_INIT_NVAR(&_16$$5); + ZVAL_STRING(&_16$$5, ":"); + ZEPHIR_INIT_NVAR(&_17$$5); + zephir_fast_strpos(&_17$$5, &headerPart$$3, &_16$$5, 0 ); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_17$$5)) { + continue; + } + ZEPHIR_INIT_NVAR(&exploded$$5); + zephir_fast_explode_str(&exploded$$5, SL(":"), &headerPart$$3, 2 ); + ZEPHIR_INIT_NVAR(&_18$$5); + zephir_array_fetch_long(&_19$$5, &exploded$$5, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1798); + zephir_fast_trim(&_18$$5, &_19$$5, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&headerName$$5); + zephir_fast_strtolower(&headerName$$5, &_18$$5); + zephir_array_fetch_long(&_20$$5, &exploded$$5, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1799); + ZEPHIR_INIT_NVAR(&headerValue$$5); + zephir_fast_trim(&headerValue$$5, &_20$$5, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_21$$5); + ZVAL_STRING(&_21$$5, ";"); + ZEPHIR_INIT_NVAR(&_22$$5); + zephir_fast_strpos(&_22$$5, &headerValue$$5, &_21$$5, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_22$$5)) { + ZEPHIR_INIT_NVAR(&explodedHeader$$7); + zephir_fast_explode_str(&explodedHeader$$7, SL(";"), &headerValue$$5, LONG_MAX); + zephir_is_iterable(&explodedHeader$$7, 0, "phalcon/Http/Request.zep", 1819); + if (Z_TYPE_P(&explodedHeader$$7) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&explodedHeader$$7), _23$$7) + { + ZEPHIR_INIT_NVAR(&part$$7); + ZVAL_COPY(&part$$7, _23$$7); + ZEPHIR_INIT_NVAR(&_25$$8); + zephir_fast_trim(&_25$$8, &part$$7, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_26$$8); + ZVAL_STRING(&_26$$8, "/\"/"); + ZEPHIR_INIT_NVAR(&_27$$8); + ZVAL_STRING(&_27$$8, ""); + ZEPHIR_CALL_FUNCTION(&part$$7, "preg_replace", &_28, 40, &_26$$8, &_27$$8, &_25$$8); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_26$$8); + ZVAL_STRING(&_26$$8, "="); + ZEPHIR_INIT_NVAR(&_27$$8); + zephir_fast_strpos(&_27$$8, &part$$7, &_26$$8, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_27$$8)) { + ZEPHIR_INIT_NVAR(&explodedPart$$9); + zephir_fast_explode_str(&explodedPart$$9, SL("="), &part$$7, 2 ); + ZEPHIR_INIT_NVAR(&_29$$9); + zephir_array_fetch_long(&_30$$9, &explodedPart$$9, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_29$$9, &_30$$9, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$9); + zephir_fast_strtolower(&namePart$$9, &_29$$9); + ZEPHIR_INIT_NVAR(&_31$$9); + zephir_array_fetch_long(&_32$$9, &explodedPart$$9, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_31$$9, &_32$$9, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_33$$9); + ZVAL_STRING(&_33$$9, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$9); + zephir_fast_trim(&valuePart$$9, &_31$$9, &_33$$9, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$3, &valuePart$$9, SL("zz"), 2, &headerName$$5, &namePart$$9); + } else { + zephir_array_update_multi(&headers$$3, &part$$7, SL("za"), 2, &headerName$$5); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$7, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_24$$7, &explodedHeader$$7, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_24$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&part$$7, &explodedHeader$$7, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_34$$11); + zephir_fast_trim(&_34$$11, &part$$7, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_35$$11); + ZVAL_STRING(&_35$$11, "/\"/"); + ZEPHIR_INIT_NVAR(&_36$$11); + ZVAL_STRING(&_36$$11, ""); + ZEPHIR_CALL_FUNCTION(&part$$7, "preg_replace", &_28, 40, &_35$$11, &_36$$11, &_34$$11); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_35$$11); + ZVAL_STRING(&_35$$11, "="); + ZEPHIR_INIT_NVAR(&_36$$11); + zephir_fast_strpos(&_36$$11, &part$$7, &_35$$11, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_36$$11)) { + ZEPHIR_INIT_NVAR(&explodedPart$$12); + zephir_fast_explode_str(&explodedPart$$12, SL("="), &part$$7, 2 ); + ZEPHIR_INIT_NVAR(&_37$$12); + zephir_array_fetch_long(&_38$$12, &explodedPart$$12, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_37$$12, &_38$$12, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$12); + zephir_fast_strtolower(&namePart$$12, &_37$$12); + ZEPHIR_INIT_NVAR(&_39$$12); + zephir_array_fetch_long(&_40$$12, &explodedPart$$12, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_39$$12, &_40$$12, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_41$$12); + ZVAL_STRING(&_41$$12, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$12); + zephir_fast_trim(&valuePart$$12, &_39$$12, &_41$$12, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$3, &valuePart$$12, SL("zz"), 2, &headerName$$5, &namePart$$12); + } else { + zephir_array_update_multi(&headers$$3, &part$$7, SL("za"), 2, &headerName$$5); + } + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$7, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&part$$7); + } else { + zephir_array_update_zval(&headers$$3, &headerName$$5, &headerValue$$5, PH_COPY | PH_SEPARATE); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &headerParts$$3, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_15$$3, &headerParts$$3, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_15$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&headerPart$$3, &headerParts$$3, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_42$$15); + ZVAL_STRING(&_42$$15, ":"); + ZEPHIR_INIT_NVAR(&_43$$15); + zephir_fast_strpos(&_43$$15, &headerPart$$3, &_42$$15, 0 ); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_43$$15)) { + continue; + } + ZEPHIR_INIT_NVAR(&exploded$$15); + zephir_fast_explode_str(&exploded$$15, SL(":"), &headerPart$$3, 2 ); + ZEPHIR_INIT_NVAR(&_44$$15); + zephir_array_fetch_long(&_45$$15, &exploded$$15, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1798); + zephir_fast_trim(&_44$$15, &_45$$15, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&headerName$$15); + zephir_fast_strtolower(&headerName$$15, &_44$$15); + zephir_array_fetch_long(&_46$$15, &exploded$$15, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1799); + ZEPHIR_INIT_NVAR(&headerValue$$15); + zephir_fast_trim(&headerValue$$15, &_46$$15, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_47$$15); + ZVAL_STRING(&_47$$15, ";"); + ZEPHIR_INIT_NVAR(&_48$$15); + zephir_fast_strpos(&_48$$15, &headerValue$$15, &_47$$15, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_48$$15)) { + ZEPHIR_INIT_NVAR(&explodedHeader$$17); + zephir_fast_explode_str(&explodedHeader$$17, SL(";"), &headerValue$$15, LONG_MAX); + zephir_is_iterable(&explodedHeader$$17, 0, "phalcon/Http/Request.zep", 1819); + if (Z_TYPE_P(&explodedHeader$$17) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&explodedHeader$$17), _49$$17) + { + ZEPHIR_INIT_NVAR(&part$$17); + ZVAL_COPY(&part$$17, _49$$17); + ZEPHIR_INIT_NVAR(&_51$$18); + zephir_fast_trim(&_51$$18, &part$$17, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_52$$18); + ZVAL_STRING(&_52$$18, "/\"/"); + ZEPHIR_INIT_NVAR(&_53$$18); + ZVAL_STRING(&_53$$18, ""); + ZEPHIR_CALL_FUNCTION(&part$$17, "preg_replace", &_28, 40, &_52$$18, &_53$$18, &_51$$18); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_52$$18); + ZVAL_STRING(&_52$$18, "="); + ZEPHIR_INIT_NVAR(&_53$$18); + zephir_fast_strpos(&_53$$18, &part$$17, &_52$$18, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_53$$18)) { + ZEPHIR_INIT_NVAR(&explodedPart$$19); + zephir_fast_explode_str(&explodedPart$$19, SL("="), &part$$17, 2 ); + ZEPHIR_INIT_NVAR(&_54$$19); + zephir_array_fetch_long(&_55$$19, &explodedPart$$19, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_54$$19, &_55$$19, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$19); + zephir_fast_strtolower(&namePart$$19, &_54$$19); + ZEPHIR_INIT_NVAR(&_56$$19); + zephir_array_fetch_long(&_57$$19, &explodedPart$$19, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_56$$19, &_57$$19, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_58$$19); + ZVAL_STRING(&_58$$19, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$19); + zephir_fast_trim(&valuePart$$19, &_56$$19, &_58$$19, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$3, &valuePart$$19, SL("zz"), 2, &headerName$$15, &namePart$$19); + } else { + zephir_array_update_multi(&headers$$3, &part$$17, SL("za"), 2, &headerName$$15); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$17, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_50$$17, &explodedHeader$$17, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_50$$17)) { + break; + } + ZEPHIR_CALL_METHOD(&part$$17, &explodedHeader$$17, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_59$$21); + zephir_fast_trim(&_59$$21, &part$$17, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_60$$21); + ZVAL_STRING(&_60$$21, "/\"/"); + ZEPHIR_INIT_NVAR(&_61$$21); + ZVAL_STRING(&_61$$21, ""); + ZEPHIR_CALL_FUNCTION(&part$$17, "preg_replace", &_28, 40, &_60$$21, &_61$$21, &_59$$21); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_60$$21); + ZVAL_STRING(&_60$$21, "="); + ZEPHIR_INIT_NVAR(&_61$$21); + zephir_fast_strpos(&_61$$21, &part$$17, &_60$$21, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_61$$21)) { + ZEPHIR_INIT_NVAR(&explodedPart$$22); + zephir_fast_explode_str(&explodedPart$$22, SL("="), &part$$17, 2 ); + ZEPHIR_INIT_NVAR(&_62$$22); + zephir_array_fetch_long(&_63$$22, &explodedPart$$22, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_62$$22, &_63$$22, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$22); + zephir_fast_strtolower(&namePart$$22, &_62$$22); + ZEPHIR_INIT_NVAR(&_64$$22); + zephir_array_fetch_long(&_65$$22, &explodedPart$$22, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_64$$22, &_65$$22, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_66$$22); + ZVAL_STRING(&_66$$22, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$22); + zephir_fast_trim(&valuePart$$22, &_64$$22, &_66$$22, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$3, &valuePart$$22, SL("zz"), 2, &headerName$$15, &namePart$$22); + } else { + zephir_array_update_multi(&headers$$3, &part$$17, SL("za"), 2, &headerName$$15); + } + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$17, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&part$$17); + } else { + zephir_array_update_zval(&headers$$3, &headerName$$15, &headerValue$$15, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &headerParts$$3, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&headerPart$$3); + zephir_array_fetch_long(&_67$$3, &splited$$3, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1824); + zephir_array_fetch_string(&_68$$3, &headers$$3, SL("content-disposition"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1824); + ZEPHIR_OBS_NVAR(&_69$$3); + zephir_array_fetch_string(&_69$$3, &_68$$3, SL("name"), PH_NOISY, "phalcon/Http/Request.zep", 1824); + zephir_array_update_zval(&dataset, &_69$$3, &_67$$3, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &bodyParts, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_9, &bodyParts, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_9)) { + break; + } + ZEPHIR_CALL_METHOD(&bodyPart, &bodyParts, "current", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EMPTY(&bodyPart)) { + continue; + } + ZEPHIR_INIT_NVAR(&_70$$25); + ZVAL_STRING(&_70$$25, "/\\R\\R/"); + ZVAL_LONG(&_71$$25, 2); + ZEPHIR_CALL_FUNCTION(&splited$$25, "preg_split", NULL, 70, &_70$$25, &bodyPart, &_71$$25); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&headers$$25); + array_init(&headers$$25); + zephir_array_fetch_long(&_72$$25, &splited$$25, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1788); + ZEPHIR_INIT_NVAR(&_70$$25); + ZVAL_STRING(&_70$$25, "/\\R/s"); + ZVAL_LONG(&_71$$25, -1); + ZVAL_LONG(&_73$$25, 1); + ZEPHIR_CALL_FUNCTION(&headerParts$$25, "preg_split", NULL, 70, &_70$$25, &_72$$25, &_71$$25, &_73$$25); + zephir_check_call_status(); + zephir_is_iterable(&headerParts$$25, 0, "phalcon/Http/Request.zep", 1824); + if (Z_TYPE_P(&headerParts$$25) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&headerParts$$25), _74$$25) + { + ZEPHIR_INIT_NVAR(&headerPart$$25); + ZVAL_COPY(&headerPart$$25, _74$$25); + ZEPHIR_INIT_NVAR(&_76$$27); + ZVAL_STRING(&_76$$27, ":"); + ZEPHIR_INIT_NVAR(&_77$$27); + zephir_fast_strpos(&_77$$27, &headerPart$$25, &_76$$27, 0 ); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_77$$27)) { + continue; + } + ZEPHIR_INIT_NVAR(&exploded$$27); + zephir_fast_explode_str(&exploded$$27, SL(":"), &headerPart$$25, 2 ); + ZEPHIR_INIT_NVAR(&_78$$27); + zephir_array_fetch_long(&_79$$27, &exploded$$27, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1798); + zephir_fast_trim(&_78$$27, &_79$$27, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&headerName$$27); + zephir_fast_strtolower(&headerName$$27, &_78$$27); + zephir_array_fetch_long(&_80$$27, &exploded$$27, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1799); + ZEPHIR_INIT_NVAR(&headerValue$$27); + zephir_fast_trim(&headerValue$$27, &_80$$27, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_81$$27); + ZVAL_STRING(&_81$$27, ";"); + ZEPHIR_INIT_NVAR(&_82$$27); + zephir_fast_strpos(&_82$$27, &headerValue$$27, &_81$$27, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_82$$27)) { + ZEPHIR_INIT_NVAR(&explodedHeader$$29); + zephir_fast_explode_str(&explodedHeader$$29, SL(";"), &headerValue$$27, LONG_MAX); + zephir_is_iterable(&explodedHeader$$29, 0, "phalcon/Http/Request.zep", 1819); + if (Z_TYPE_P(&explodedHeader$$29) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&explodedHeader$$29), _83$$29) + { + ZEPHIR_INIT_NVAR(&part$$29); + ZVAL_COPY(&part$$29, _83$$29); + ZEPHIR_INIT_NVAR(&_85$$30); + zephir_fast_trim(&_85$$30, &part$$29, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_86$$30); + ZVAL_STRING(&_86$$30, "/\"/"); + ZEPHIR_INIT_NVAR(&_87$$30); + ZVAL_STRING(&_87$$30, ""); + ZEPHIR_CALL_FUNCTION(&part$$29, "preg_replace", &_28, 40, &_86$$30, &_87$$30, &_85$$30); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_86$$30); + ZVAL_STRING(&_86$$30, "="); + ZEPHIR_INIT_NVAR(&_87$$30); + zephir_fast_strpos(&_87$$30, &part$$29, &_86$$30, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_87$$30)) { + ZEPHIR_INIT_NVAR(&explodedPart$$31); + zephir_fast_explode_str(&explodedPart$$31, SL("="), &part$$29, 2 ); + ZEPHIR_INIT_NVAR(&_88$$31); + zephir_array_fetch_long(&_89$$31, &explodedPart$$31, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_88$$31, &_89$$31, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$31); + zephir_fast_strtolower(&namePart$$31, &_88$$31); + ZEPHIR_INIT_NVAR(&_90$$31); + zephir_array_fetch_long(&_91$$31, &explodedPart$$31, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_90$$31, &_91$$31, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_92$$31); + ZVAL_STRING(&_92$$31, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$31); + zephir_fast_trim(&valuePart$$31, &_90$$31, &_92$$31, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$25, &valuePart$$31, SL("zz"), 2, &headerName$$27, &namePart$$31); + } else { + zephir_array_update_multi(&headers$$25, &part$$29, SL("za"), 2, &headerName$$27); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$29, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_84$$29, &explodedHeader$$29, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_84$$29)) { + break; + } + ZEPHIR_CALL_METHOD(&part$$29, &explodedHeader$$29, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_93$$33); + zephir_fast_trim(&_93$$33, &part$$29, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_94$$33); + ZVAL_STRING(&_94$$33, "/\"/"); + ZEPHIR_INIT_NVAR(&_95$$33); + ZVAL_STRING(&_95$$33, ""); + ZEPHIR_CALL_FUNCTION(&part$$29, "preg_replace", &_28, 40, &_94$$33, &_95$$33, &_93$$33); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_94$$33); + ZVAL_STRING(&_94$$33, "="); + ZEPHIR_INIT_NVAR(&_95$$33); + zephir_fast_strpos(&_95$$33, &part$$29, &_94$$33, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_95$$33)) { + ZEPHIR_INIT_NVAR(&explodedPart$$34); + zephir_fast_explode_str(&explodedPart$$34, SL("="), &part$$29, 2 ); + ZEPHIR_INIT_NVAR(&_96$$34); + zephir_array_fetch_long(&_97$$34, &explodedPart$$34, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_96$$34, &_97$$34, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$34); + zephir_fast_strtolower(&namePart$$34, &_96$$34); + ZEPHIR_INIT_NVAR(&_98$$34); + zephir_array_fetch_long(&_99$$34, &explodedPart$$34, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_98$$34, &_99$$34, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_100$$34); + ZVAL_STRING(&_100$$34, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$34); + zephir_fast_trim(&valuePart$$34, &_98$$34, &_100$$34, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$25, &valuePart$$34, SL("zz"), 2, &headerName$$27, &namePart$$34); + } else { + zephir_array_update_multi(&headers$$25, &part$$29, SL("za"), 2, &headerName$$27); + } + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$29, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&part$$29); + } else { + zephir_array_update_zval(&headers$$25, &headerName$$27, &headerValue$$27, PH_COPY | PH_SEPARATE); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &headerParts$$25, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_75$$25, &headerParts$$25, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_75$$25)) { + break; + } + ZEPHIR_CALL_METHOD(&headerPart$$25, &headerParts$$25, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_101$$37); + ZVAL_STRING(&_101$$37, ":"); + ZEPHIR_INIT_NVAR(&_102$$37); + zephir_fast_strpos(&_102$$37, &headerPart$$25, &_101$$37, 0 ); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_102$$37)) { + continue; + } + ZEPHIR_INIT_NVAR(&exploded$$37); + zephir_fast_explode_str(&exploded$$37, SL(":"), &headerPart$$25, 2 ); + ZEPHIR_INIT_NVAR(&_103$$37); + zephir_array_fetch_long(&_104$$37, &exploded$$37, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1798); + zephir_fast_trim(&_103$$37, &_104$$37, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&headerName$$37); + zephir_fast_strtolower(&headerName$$37, &_103$$37); + zephir_array_fetch_long(&_105$$37, &exploded$$37, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1799); + ZEPHIR_INIT_NVAR(&headerValue$$37); + zephir_fast_trim(&headerValue$$37, &_105$$37, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_106$$37); + ZVAL_STRING(&_106$$37, ";"); + ZEPHIR_INIT_NVAR(&_107$$37); + zephir_fast_strpos(&_107$$37, &headerValue$$37, &_106$$37, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_107$$37)) { + ZEPHIR_INIT_NVAR(&explodedHeader$$39); + zephir_fast_explode_str(&explodedHeader$$39, SL(";"), &headerValue$$37, LONG_MAX); + zephir_is_iterable(&explodedHeader$$39, 0, "phalcon/Http/Request.zep", 1819); + if (Z_TYPE_P(&explodedHeader$$39) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&explodedHeader$$39), _108$$39) + { + ZEPHIR_INIT_NVAR(&part$$39); + ZVAL_COPY(&part$$39, _108$$39); + ZEPHIR_INIT_NVAR(&_110$$40); + zephir_fast_trim(&_110$$40, &part$$39, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_111$$40); + ZVAL_STRING(&_111$$40, "/\"/"); + ZEPHIR_INIT_NVAR(&_112$$40); + ZVAL_STRING(&_112$$40, ""); + ZEPHIR_CALL_FUNCTION(&part$$39, "preg_replace", &_28, 40, &_111$$40, &_112$$40, &_110$$40); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_111$$40); + ZVAL_STRING(&_111$$40, "="); + ZEPHIR_INIT_NVAR(&_112$$40); + zephir_fast_strpos(&_112$$40, &part$$39, &_111$$40, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_112$$40)) { + ZEPHIR_INIT_NVAR(&explodedPart$$41); + zephir_fast_explode_str(&explodedPart$$41, SL("="), &part$$39, 2 ); + ZEPHIR_INIT_NVAR(&_113$$41); + zephir_array_fetch_long(&_114$$41, &explodedPart$$41, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_113$$41, &_114$$41, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$41); + zephir_fast_strtolower(&namePart$$41, &_113$$41); + ZEPHIR_INIT_NVAR(&_115$$41); + zephir_array_fetch_long(&_116$$41, &explodedPart$$41, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_115$$41, &_116$$41, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_117$$41); + ZVAL_STRING(&_117$$41, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$41); + zephir_fast_trim(&valuePart$$41, &_115$$41, &_117$$41, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$25, &valuePart$$41, SL("zz"), 2, &headerName$$37, &namePart$$41); + } else { + zephir_array_update_multi(&headers$$25, &part$$39, SL("za"), 2, &headerName$$37); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$39, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_109$$39, &explodedHeader$$39, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_109$$39)) { + break; + } + ZEPHIR_CALL_METHOD(&part$$39, &explodedHeader$$39, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_118$$43); + zephir_fast_trim(&_118$$43, &part$$39, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_119$$43); + ZVAL_STRING(&_119$$43, "/\"/"); + ZEPHIR_INIT_NVAR(&_120$$43); + ZVAL_STRING(&_120$$43, ""); + ZEPHIR_CALL_FUNCTION(&part$$39, "preg_replace", &_28, 40, &_119$$43, &_120$$43, &_118$$43); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_119$$43); + ZVAL_STRING(&_119$$43, "="); + ZEPHIR_INIT_NVAR(&_120$$43); + zephir_fast_strpos(&_120$$43, &part$$39, &_119$$43, 0 ); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_120$$43)) { + ZEPHIR_INIT_NVAR(&explodedPart$$44); + zephir_fast_explode_str(&explodedPart$$44, SL("="), &part$$39, 2 ); + ZEPHIR_INIT_NVAR(&_121$$44); + zephir_array_fetch_long(&_122$$44, &explodedPart$$44, 0, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1811); + zephir_fast_trim(&_121$$44, &_122$$44, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&namePart$$44); + zephir_fast_strtolower(&namePart$$44, &_121$$44); + ZEPHIR_INIT_NVAR(&_123$$44); + zephir_array_fetch_long(&_124$$44, &explodedPart$$44, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1812); + zephir_fast_trim(&_123$$44, &_124$$44, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_125$$44); + ZVAL_STRING(&_125$$44, "\""); + ZEPHIR_INIT_NVAR(&valuePart$$44); + zephir_fast_trim(&valuePart$$44, &_123$$44, &_125$$44, ZEPHIR_TRIM_BOTH); + zephir_array_update_multi(&headers$$25, &valuePart$$44, SL("zz"), 2, &headerName$$37, &namePart$$44); + } else { + zephir_array_update_multi(&headers$$25, &part$$39, SL("za"), 2, &headerName$$37); + } + ZEPHIR_CALL_METHOD(NULL, &explodedHeader$$39, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&part$$39); + } else { + zephir_array_update_zval(&headers$$25, &headerName$$37, &headerValue$$37, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &headerParts$$25, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&headerPart$$25); + zephir_array_fetch_long(&_126$$25, &splited$$25, 1, PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1824); + zephir_array_fetch_string(&_127$$25, &headers$$25, SL("content-disposition"), PH_NOISY | PH_READONLY, "phalcon/Http/Request.zep", 1824); + ZEPHIR_OBS_NVAR(&_128$$25); + zephir_array_fetch_string(&_128$$25, &_127$$25, SL("name"), PH_NOISY, "phalcon/Http/Request.zep", 1824); + zephir_array_update_zval(&dataset, &_128$$25, &_126$$25, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &bodyParts, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&bodyPart); + RETURN_CTOR(&dataset); +} + zend_object *zephir_init_properties_Phalcon_Http_Request(zend_class_entry *class_type) { zval _0, _1$$3; diff --git a/ext/phalcon/http/request.zep.h b/ext/phalcon/http/request.zep.h index fe0f986f095..638ddbd1454 100644 --- a/ext/phalcon/http/request.zep.h +++ b/ext/phalcon/http/request.zep.h @@ -77,6 +77,7 @@ PHP_METHOD(Phalcon_Http_Request, getFilterService); PHP_METHOD(Phalcon_Http_Request, getServerArray); PHP_METHOD(Phalcon_Http_Request, getFilteredData); PHP_METHOD(Phalcon_Http_Request, getPatchPut); +PHP_METHOD(Phalcon_Http_Request, getFormData); zend_object *zephir_init_properties_Phalcon_Http_Request(zend_class_entry *class_type); ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_request_get, 0, 0, 0) @@ -403,6 +404,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_request_getpatchput, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, noRecursive, _IS_BOOL, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_http_request_getformdata, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_request_zephir_init_properties_phalcon_http_request, 0, 0, 0) ZEND_END_ARG_INFO() @@ -481,5 +485,6 @@ ZEPHIR_INIT_FUNCS(phalcon_http_request_method_entry) { PHP_ME(Phalcon_Http_Request, getServerArray, arginfo_phalcon_http_request_getserverarray, ZEND_ACC_PRIVATE) PHP_ME(Phalcon_Http_Request, getFilteredData, arginfo_phalcon_http_request_getfiltereddata, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Http_Request, getPatchPut, arginfo_phalcon_http_request_getpatchput, ZEND_ACC_PRIVATE) + PHP_ME(Phalcon_Http_Request, getFormData, arginfo_phalcon_http_request_getformdata, ZEND_ACC_PRIVATE) PHP_FE_END }; diff --git a/ext/phalcon/http/request/file.zep.c b/ext/phalcon/http/request/file.zep.c index e076d1c3cf5..550bc30b79b 100644 --- a/ext/phalcon/http/request/file.zep.c +++ b/ext/phalcon/http/request/file.zep.c @@ -140,33 +140,33 @@ PHP_METHOD(Phalcon_Http_Request_File, __construct) zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); ZEPHIR_INIT_VAR(&_0$$3); ZVAL_STRING(&_0$$3, "PATHINFO_EXTENSION"); - ZEPHIR_CALL_FUNCTION(&_1$$3, "defined", NULL, 114, &_0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "defined", NULL, 117, &_0$$3); zephir_check_call_status(); if (zephir_is_true(&_1$$3)) { ZVAL_LONG(&_2$$4, 4); - ZEPHIR_CALL_FUNCTION(&_3$$4, "pathinfo", NULL, 85, &name, &_2$$4); + ZEPHIR_CALL_FUNCTION(&_3$$4, "pathinfo", NULL, 88, &name, &_2$$4); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("extension"), &_3$$4); } } ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, "tmp_name"); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getarrval", NULL, 349, &file, &_5); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "getarrval", NULL, 355, &file, &_5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("tmp"), &_4); ZEPHIR_INIT_NVAR(&_5); ZVAL_STRING(&_5, "size"); - ZEPHIR_CALL_METHOD(&_6, this_ptr, "getarrval", NULL, 349, &file, &_5); + ZEPHIR_CALL_METHOD(&_6, this_ptr, "getarrval", NULL, 355, &file, &_5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("size"), &_6); ZEPHIR_INIT_NVAR(&_5); ZVAL_STRING(&_5, "type"); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "getarrval", NULL, 349, &file, &_5); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "getarrval", NULL, 355, &file, &_5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_7); ZEPHIR_INIT_NVAR(&_5); ZVAL_STRING(&_5, "error"); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "getarrval", NULL, 349, &file, &_5); + ZEPHIR_CALL_METHOD(&_8, this_ptr, "getarrval", NULL, 355, &file, &_5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("error"), &_8); if (zephir_is_true(key)) { @@ -241,15 +241,15 @@ PHP_METHOD(Phalcon_Http_Request_File, getRealType) ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, 16); - ZEPHIR_CALL_FUNCTION(&finfo, "finfo_open", NULL, 307, &_0); + ZEPHIR_CALL_FUNCTION(&finfo, "finfo_open", NULL, 310, &_0); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&finfo)) { RETURN_MM_STRING(""); } zephir_read_property(&_0, this_ptr, ZEND_STRL("tmp"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 308, &finfo, &_0); + ZEPHIR_CALL_FUNCTION(&mime, "finfo_file", NULL, 311, &finfo, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 309, &finfo); + ZEPHIR_CALL_FUNCTION(NULL, "finfo_close", NULL, 312, &finfo); zephir_check_call_status(); RETURN_CCTOR(&mime); } @@ -354,7 +354,7 @@ PHP_METHOD(Phalcon_Http_Request_File, moveTo) zephir_read_property(&_0, this_ptr, ZEND_STRL("tmp"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("move_uploaded_file", NULL, 350, &_0, &destination); + ZEPHIR_RETURN_CALL_FUNCTION("move_uploaded_file", NULL, 356, &_0, &destination); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/http/response.zep.c b/ext/phalcon/http/response.zep.c index 54758f5ee10..e950b130108 100644 --- a/ext/phalcon/http/response.zep.c +++ b/ext/phalcon/http/response.zep.c @@ -515,7 +515,7 @@ PHP_METHOD(Phalcon_Http_Response, redirect) if (_0$$5) { ZEPHIR_INIT_VAR(&_1$$5); ZVAL_STRING(&_1$$5, "://"); - ZEPHIR_CALL_FUNCTION(&_2$$5, "strstr", NULL, 351, location, &_1$$5); + ZEPHIR_CALL_FUNCTION(&_2$$5, "strstr", NULL, 357, location, &_1$$5); zephir_check_call_status(); _0$$5 = zephir_is_true(&_2$$5); } @@ -680,7 +680,7 @@ PHP_METHOD(Phalcon_Http_Response, send) _3$$5 = ((zephir_fast_strlen_ev(&file)) ? 1 : 0); } if (_3$$5) { - ZEPHIR_CALL_FUNCTION(NULL, "readfile", NULL, 352, &file); + ZEPHIR_CALL_FUNCTION(NULL, "readfile", NULL, 358, &file); zephir_check_call_status(); } } @@ -1172,16 +1172,16 @@ PHP_METHOD(Phalcon_Http_Response, setFileToSend) ZEPHIR_INIT_VAR(&basePathEncoding); ZVAL_STRING(&basePathEncoding, "ASCII"); if (Z_TYPE_P(attachmentName) != IS_STRING) { - ZEPHIR_CALL_METHOD(&basePath, this_ptr, "getbasename", NULL, 353, &filePath); + ZEPHIR_CALL_METHOD(&basePath, this_ptr, "getbasename", NULL, 359, &filePath); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&basePath, attachmentName); } if (zephir_is_true(attachment)) { if ((zephir_function_exists_ex(ZEND_STRL("mb_detect_encoding")) == SUCCESS)) { - ZEPHIR_CALL_FUNCTION(&_0$$6, "mb_detect_order", NULL, 354); + ZEPHIR_CALL_FUNCTION(&_0$$6, "mb_detect_order", NULL, 360); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&basePathEncoding, "mb_detect_encoding", NULL, 322, &basePath, &_0$$6, &__$true); + ZEPHIR_CALL_FUNCTION(&basePathEncoding, "mb_detect_encoding", NULL, 325, &basePath, &_0$$6, &__$true); zephir_check_call_status(); } ZEPHIR_INIT_VAR(&_1$$5); @@ -1197,7 +1197,7 @@ PHP_METHOD(Phalcon_Http_Response, setFileToSend) ZEPHIR_CALL_METHOD(NULL, this_ptr, "setrawheader", NULL, 0, &_1$$5); zephir_check_call_status(); if (!ZEPHIR_IS_STRING(&basePathEncoding, "ASCII")) { - ZEPHIR_CALL_FUNCTION(&_2$$7, "rawurlencode", NULL, 326, &basePath); + ZEPHIR_CALL_FUNCTION(&_2$$7, "rawurlencode", NULL, 329, &basePath); zephir_check_call_status(); ZEPHIR_CPY_WRT(&basePath, &_2$$7); ZEPHIR_INIT_VAR(&_3$$7); @@ -1209,7 +1209,7 @@ PHP_METHOD(Phalcon_Http_Response, setFileToSend) } else { ZEPHIR_INIT_VAR(&_5$$8); ZVAL_STRING(&_5$$8, "\15\17\\\""); - ZEPHIR_CALL_FUNCTION(&_6$$8, "addcslashes", NULL, 211, &basePath, &_5$$8); + ZEPHIR_CALL_FUNCTION(&_6$$8, "addcslashes", NULL, 214, &basePath, &_5$$8); zephir_check_call_status(); ZEPHIR_CPY_WRT(&basePath, &_6$$8); ZEPHIR_INIT_VAR(&_7$$8); @@ -1561,7 +1561,7 @@ PHP_METHOD(Phalcon_Http_Response, setStatusCode) if (_6$$3) { ZEPHIR_INIT_NVAR(&_7$$3); ZVAL_STRING(&_7$$3, "HTTP/"); - ZEPHIR_CALL_FUNCTION(&_8$$3, "strstr", &_9, 351, &key, &_7$$3); + ZEPHIR_CALL_FUNCTION(&_8$$3, "strstr", &_9, 357, &key, &_7$$3); zephir_check_call_status(); _6$$3 = zephir_is_true(&_8$$3); } @@ -1588,7 +1588,7 @@ PHP_METHOD(Phalcon_Http_Response, setStatusCode) if (_11$$5) { ZEPHIR_INIT_NVAR(&_12$$5); ZVAL_STRING(&_12$$5, "HTTP/"); - ZEPHIR_CALL_FUNCTION(&_13$$5, "strstr", &_9, 351, &key, &_12$$5); + ZEPHIR_CALL_FUNCTION(&_13$$5, "strstr", &_9, 357, &key, &_12$$5); zephir_check_call_status(); _11$$5 = zephir_is_true(&_13$$5); } @@ -1819,7 +1819,7 @@ PHP_METHOD(Phalcon_Http_Response, getBasename) ZVAL_STRING(&_2, "/"); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "@"); - ZEPHIR_CALL_FUNCTION(&_4, "preg_quote", NULL, 355, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "preg_quote", NULL, 353, &_2, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_5); ZEPHIR_CONCAT_SVS(&_5, "@[^", &_4, "]+$@"); @@ -1835,13 +1835,13 @@ PHP_METHOD(Phalcon_Http_Response, getBasename) if (zephir_is_true(suffix)) { ZEPHIR_INIT_VAR(&_6$$3); ZVAL_STRING(&_6$$3, "@"); - ZEPHIR_CALL_FUNCTION(&_7$$3, "preg_quote", NULL, 355, suffix, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "preg_quote", NULL, 353, suffix, &_6$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_8$$3); ZEPHIR_CONCAT_SVS(&_8$$3, "@", &_7$$3, "$@"); ZEPHIR_INIT_NVAR(&_6$$3); ZVAL_STRING(&_6$$3, ""); - ZEPHIR_CALL_FUNCTION(&_9$$3, "preg_replace", NULL, 37, &_8$$3, &_6$$3, &filename); + ZEPHIR_CALL_FUNCTION(&_9$$3, "preg_replace", NULL, 40, &_8$$3, &_6$$3, &filename); zephir_check_call_status(); ZEPHIR_CPY_WRT(&filename, &_9$$3); } diff --git a/ext/phalcon/http/response/cookies.zep.c b/ext/phalcon/http/response/cookies.zep.c index fadb77843c1..3fbbfed32cc 100644 --- a/ext/phalcon/http/response/cookies.zep.c +++ b/ext/phalcon/http/response/cookies.zep.c @@ -403,7 +403,7 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, send) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 356); + ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 361); zephir_check_call_status(); _1 = ZEPHIR_IS_TRUE_IDENTICAL(&_0); if (!(_1)) { diff --git a/ext/phalcon/http/response/headers.zep.c b/ext/phalcon/http/response/headers.zep.c index d6a184ebc68..36ef5519db8 100644 --- a/ext/phalcon/http/response/headers.zep.c +++ b/ext/phalcon/http/response/headers.zep.c @@ -217,7 +217,7 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 356); + ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 361); zephir_check_call_status(); _1 = ZEPHIR_IS_TRUE_IDENTICAL(&_0); if (!(_1)) { @@ -243,7 +243,7 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send) if (Z_TYPE_P(&value) != IS_NULL) { ZEPHIR_INIT_NVAR(&_8$$5); ZEPHIR_CONCAT_VSV(&_8$$5, &header, ": ", &value); - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &_8$$5, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &_8$$5, &__$true); zephir_check_call_status(); } else { _10$$6 = zephir_memnstr_str(&header, SL(":"), "phalcon/Http/Response/Headers.zep", 99); @@ -255,12 +255,12 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send) _10$$6 = ZEPHIR_IS_STRING(&_13$$6, "HTTP/"); } if (_10$$6) { - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &header, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &header, &__$true); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&_14$$8); ZEPHIR_CONCAT_VS(&_14$$8, &header, ": "); - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &_14$$8, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &_14$$8, &__$true); zephir_check_call_status(); } } @@ -281,7 +281,7 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send) if (Z_TYPE_P(&value) != IS_NULL) { ZEPHIR_INIT_NVAR(&_15$$10); ZEPHIR_CONCAT_VSV(&_15$$10, &header, ": ", &value); - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &_15$$10, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &_15$$10, &__$true); zephir_check_call_status(); } else { _16$$11 = zephir_memnstr_str(&header, SL(":"), "phalcon/Http/Response/Headers.zep", 99); @@ -293,12 +293,12 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send) _16$$11 = ZEPHIR_IS_STRING(&_19$$11, "HTTP/"); } if (_16$$11) { - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &header, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &header, &__$true); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&_20$$13); ZEPHIR_CONCAT_VS(&_20$$13, &header, ": "); - ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 357, &_20$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "header", &_9, 362, &_20$$13, &__$true); zephir_check_call_status(); } } diff --git a/ext/phalcon/image/adapter/abstractadapter.zep.c b/ext/phalcon/image/adapter/abstractadapter.zep.c index d77288b7a1b..1f2defd5390 100644 --- a/ext/phalcon/image/adapter/abstractadapter.zep.c +++ b/ext/phalcon/image/adapter/abstractadapter.zep.c @@ -151,16 +151,16 @@ PHP_METHOD(Phalcon_Image_Adapter_AbstractAdapter, background) ZVAL_STRING(&_6$$4, "/./"); ZEPHIR_INIT_VAR(&_7$$4); ZVAL_STRING(&_7$$4, "$0$0"); - ZEPHIR_CALL_FUNCTION(&_8$$4, "preg_replace", NULL, 37, &_6$$4, &_7$$4, &color); + ZEPHIR_CALL_FUNCTION(&_8$$4, "preg_replace", NULL, 40, &_6$$4, &_7$$4, &color); zephir_check_call_status(); zephir_get_strval(&color, &_8$$4); } ZVAL_LONG(&_9, 2); - ZEPHIR_CALL_FUNCTION(&_10, "str_split", NULL, 84, &color, &_9); + ZEPHIR_CALL_FUNCTION(&_10, "str_split", NULL, 87, &color, &_9); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_11); ZVAL_STRING(&_11, "hexdec"); - ZEPHIR_CALL_FUNCTION(&colors, "array_map", NULL, 66, &_11, &_10); + ZEPHIR_CALL_FUNCTION(&colors, "array_map", NULL, 69, &_11, &_10); zephir_check_call_status(); zephir_array_fetch_long(&_12, &colors, 0, PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/AbstractAdapter.zep", 96); zephir_array_fetch_long(&_13, &colors, 1, PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/AbstractAdapter.zep", 96); @@ -652,7 +652,7 @@ PHP_METHOD(Phalcon_Image_Adapter_AbstractAdapter, render) if (Z_TYPE_P(&extension) == IS_NULL) { zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_1$$3, 4); - ZEPHIR_CALL_FUNCTION(&_2$$3, "pathinfo", NULL, 85, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_2$$3, "pathinfo", NULL, 88, &_0$$3, &_1$$3); zephir_check_call_status(); zephir_cast_to_string(&_3$$3, &_2$$3); ZEPHIR_CPY_WRT(&extension, &_3$$3); @@ -861,14 +861,14 @@ PHP_METHOD(Phalcon_Image_Adapter_AbstractAdapter, resize) ZVAL_LONG(&_21, width); zephir_round(&_20, &_21, NULL, NULL); ZVAL_LONG(&_22, 1); - ZEPHIR_CALL_FUNCTION(&_23, "max", NULL, 86, &_20, &_22); + ZEPHIR_CALL_FUNCTION(&_23, "max", NULL, 89, &_20, &_22); zephir_check_call_status(); width = zephir_get_intval(&_23); ZEPHIR_INIT_VAR(&_24); ZVAL_LONG(&_22, height); zephir_round(&_24, &_22, NULL, NULL); ZVAL_LONG(&_25, 1); - ZEPHIR_CALL_FUNCTION(&_26, "max", NULL, 86, &_24, &_25); + ZEPHIR_CALL_FUNCTION(&_26, "max", NULL, 89, &_24, &_25); zephir_check_call_status(); height = zephir_get_intval(&_26); ZVAL_LONG(&_25, width); @@ -1139,16 +1139,16 @@ PHP_METHOD(Phalcon_Image_Adapter_AbstractAdapter, text) ZVAL_STRING(&_7$$4, "/./"); ZEPHIR_INIT_VAR(&_8$$4); ZVAL_STRING(&_8$$4, "$0$0"); - ZEPHIR_CALL_FUNCTION(&_9$$4, "preg_replace", NULL, 37, &_7$$4, &_8$$4, &color); + ZEPHIR_CALL_FUNCTION(&_9$$4, "preg_replace", NULL, 40, &_7$$4, &_8$$4, &color); zephir_check_call_status(); zephir_get_strval(&color, &_9$$4); } ZVAL_LONG(&_10, 2); - ZEPHIR_CALL_FUNCTION(&_11, "str_split", NULL, 84, &color, &_10); + ZEPHIR_CALL_FUNCTION(&_11, "str_split", NULL, 87, &color, &_10); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_12); ZVAL_STRING(&_12, "hexdec"); - ZEPHIR_CALL_FUNCTION(&colors, "array_map", NULL, 66, &_12, &_11); + ZEPHIR_CALL_FUNCTION(&colors, "array_map", NULL, 69, &_12, &_11); zephir_check_call_status(); zephir_array_fetch_long(&_13, &colors, 0, PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/AbstractAdapter.zep", 495); zephir_array_fetch_long(&_14, &colors, 1, PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/AbstractAdapter.zep", 496); @@ -1289,10 +1289,10 @@ PHP_METHOD(Phalcon_Image_Adapter_AbstractAdapter, checkHighLow) ZVAL_LONG(&_0, value); ZVAL_LONG(&_1, min); - ZEPHIR_CALL_FUNCTION(&_2, "max", NULL, 86, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "max", NULL, 89, &_0, &_1); zephir_check_call_status(); ZVAL_LONG(&_0, max); - ZEPHIR_RETURN_CALL_FUNCTION("min", NULL, 87, &_0, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("min", NULL, 90, &_0, &_2); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/image/adapter/gd.zep.c b/ext/phalcon/image/adapter/gd.zep.c index a939a466260..e46b5cfe436 100644 --- a/ext/phalcon/image/adapter/gd.zep.c +++ b/ext/phalcon/image/adapter/gd.zep.c @@ -119,7 +119,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "check", NULL, 358); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "check", NULL, 363); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("file"), &file); ZEPHIR_INIT_ZVAL_NREF(_0); @@ -128,11 +128,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) zephir_read_property(&_0, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); if (1 == (zephir_file_exists(&_0) == SUCCESS)) { zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_2$$3, "realpath", NULL, 71, &_1$$3); + ZEPHIR_CALL_FUNCTION(&_2$$3, "realpath", NULL, 74, &_1$$3); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_2$$3); zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&imageInfo, "getimagesize", NULL, 310, &_3$$3); + ZEPHIR_CALL_FUNCTION(&imageInfo, "getimagesize", NULL, 313, &_3$$3); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&imageInfo)) { zephir_array_fetch_long(&_4$$4, &imageInfo, 0, PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/Gd.zep", 42); @@ -149,42 +149,42 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) do { if (ZEPHIR_IS_LONG(&_8$$3, 1)) { zephir_read_property(&_9$$5, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_10$$5, "imagecreatefromgif", NULL, 359, &_9$$5); + ZEPHIR_CALL_FUNCTION(&_10$$5, "imagecreatefromgif", NULL, 364, &_9$$5); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_10$$5); break; } if (ZEPHIR_IS_LONG(&_8$$3, 2) || ZEPHIR_IS_LONG(&_8$$3, 9)) { zephir_read_property(&_11$$6, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_12$$6, "imagecreatefromjpeg", NULL, 360, &_11$$6); + ZEPHIR_CALL_FUNCTION(&_12$$6, "imagecreatefromjpeg", NULL, 365, &_11$$6); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_12$$6); break; } if (ZEPHIR_IS_LONG(&_8$$3, 3)) { zephir_read_property(&_13$$7, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_14$$7, "imagecreatefrompng", NULL, 361, &_13$$7); + ZEPHIR_CALL_FUNCTION(&_14$$7, "imagecreatefrompng", NULL, 366, &_13$$7); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_14$$7); break; } if (ZEPHIR_IS_LONG(&_8$$3, 18)) { zephir_read_property(&_15$$8, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_16$$8, "imagecreatefromwebp", NULL, 362, &_15$$8); + ZEPHIR_CALL_FUNCTION(&_16$$8, "imagecreatefromwebp", NULL, 367, &_15$$8); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_16$$8); break; } if (ZEPHIR_IS_LONG(&_8$$3, 15)) { zephir_read_property(&_17$$9, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_18$$9, "imagecreatefromwbmp", NULL, 363, &_17$$9); + ZEPHIR_CALL_FUNCTION(&_18$$9, "imagecreatefromwbmp", NULL, 368, &_17$$9); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_18$$9); break; } if (ZEPHIR_IS_LONG(&_8$$3, 16)) { zephir_read_property(&_19$$10, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_20$$10, "imagecreatefromxbm", NULL, 364, &_19$$10); + ZEPHIR_CALL_FUNCTION(&_20$$10, "imagecreatefromxbm", NULL, 369, &_19$$10); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_20$$10); break; @@ -196,7 +196,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) zephir_read_property(&_23$$12, this_ptr, ZEND_STRL("mime"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_24$$12); ZEPHIR_CONCAT_SVS(&_24$$12, "Installed GD does not support ", &_23$$12, " images"); - ZEPHIR_CALL_METHOD(NULL, &_22$$12, "__construct", NULL, 29, &_24$$12); + ZEPHIR_CALL_METHOD(NULL, &_22$$12, "__construct", NULL, 32, &_24$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_22$$12, "phalcon/Image/Adapter/Gd.zep", 78); ZEPHIR_MM_RESTORE(); @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) } while(0); zephir_read_property(&_25$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &_25$$3, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &_25$$3, &__$true); zephir_check_call_status(); } else { _26$$13 = 0 == width; @@ -220,7 +220,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) zephir_read_property(&_28$$14, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_29$$14); ZEPHIR_CONCAT_SV(&_29$$14, "Failed to create image from file ", &_28$$14); - ZEPHIR_CALL_METHOD(NULL, &_27$$14, "__construct", NULL, 29, &_29$$14); + ZEPHIR_CALL_METHOD(NULL, &_27$$14, "__construct", NULL, 32, &_29$$14); zephir_check_call_status(); zephir_throw_exception_debug(&_27$$14, "phalcon/Image/Adapter/Gd.zep", 91); ZEPHIR_MM_RESTORE(); @@ -228,14 +228,14 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __construct) } ZVAL_LONG(&_30$$13, width); ZVAL_LONG(&_31$$13, height); - ZEPHIR_CALL_FUNCTION(&_32$$13, "imagecreatetruecolor", NULL, 366, &_30$$13, &_31$$13); + ZEPHIR_CALL_FUNCTION(&_32$$13, "imagecreatetruecolor", NULL, 371, &_30$$13, &_31$$13); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_32$$13); zephir_read_property(&_30$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 367, &_30$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 372, &_30$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_31$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &_31$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &_31$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_33$$13, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_33$$13); @@ -276,7 +276,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, __destruct) zephir_read_property(&_0, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&image, &_0); if (Z_TYPE_P(&image) != IS_NULL) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &image); zephir_check_call_status(); } zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &__$null); @@ -315,13 +315,13 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, getVersion) ZVAL_NULL(&version); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "GD_VERSION"); - ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 114, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 117, &_0); zephir_check_call_status(); if (zephir_is_true(&_1)) { ZEPHIR_INIT_NVAR(&version); ZEPHIR_GET_CONSTANT(&version, "GD_VERSION"); } else { - ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 369); + ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 374); zephir_check_call_status(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); @@ -391,7 +391,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processBackground) ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_1, ((zephir_safe_div_long_long((opacity * 127), 100)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 280, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 283, &_1); zephir_check_call_status(); zephir_round(&_0, &_2, NULL, NULL); opacity = zephir_get_intval(&_0); @@ -405,9 +405,9 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processBackground) ZVAL_LONG(&_5, green); ZVAL_LONG(&_6, blue); ZVAL_LONG(&_7, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &background, &_4, &_5, &_6, &_7); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &background, &_4, &_5, &_6, &_7); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 367, &background, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 372, &background, &__$true); zephir_check_call_status(); zephir_read_property(&_4, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_5, this_ptr, ZEND_STRL("height"), PH_NOISY_CC | PH_READONLY); @@ -415,10 +415,10 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processBackground) ZVAL_LONG(&_7, 0); ZVAL_LONG(&_8, 0); ZVAL_LONG(&_9, 0); - ZEPHIR_CALL_FUNCTION(©, "imagecopy", NULL, 371, &background, &image, &_6, &_7, &_8, &_9, &_4, &_5); + ZEPHIR_CALL_FUNCTION(©, "imagecopy", NULL, 376, &background, &image, &_6, &_7, &_8, &_9, &_4, &_5); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(©)) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &image); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &background); } @@ -460,7 +460,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processBlur) } zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_1$$3, 7); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_2, 372, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_2, 377, &_0$$3, &_1$$3); zephir_check_call_status(); counter++; } @@ -502,11 +502,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processCreate) ZVAL_LONG(&_0, width); ZVAL_LONG(&_1, height); - ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 366, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&image, "imagecreatetruecolor", NULL, 371, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 367, &image, &__$false); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 372, &image, &__$false); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &image, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &image, &__$true); zephir_check_call_status(); RETURN_CCTOR(&image); } @@ -568,16 +568,16 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processCrop) ZVAL_LONG(&_0, height); zephir_array_update_string(&rect, SL("height"), &_0, PH_COPY | PH_SEPARATE); zephir_read_property(&_1, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 373, &_1, &rect); + ZEPHIR_CALL_FUNCTION(&image, "imagecrop", NULL, 378, &_1, &rect); zephir_check_call_status(); zephir_read_property(&_2, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &_2); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &_2); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &image); - ZEPHIR_CALL_FUNCTION(&_3, "imagesx", NULL, 374, &image); + ZEPHIR_CALL_FUNCTION(&_3, "imagesx", NULL, 379, &image); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &_3); - ZEPHIR_CALL_FUNCTION(&_4, "imagesy", NULL, 375, &image); + ZEPHIR_CALL_FUNCTION(&_4, "imagesy", NULL, 380, &image); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("height"), &_4); ZEPHIR_MM_RESTORE(); @@ -615,12 +615,12 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processFlip) if (direction == 11) { zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_1$$3, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 376, &_0$$3, &_1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 381, &_0$$3, &_1$$3); zephir_check_call_status(); } else { zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_3$$4, 2); - ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 376, &_2$$4, &_3$$4); + ZEPHIR_CALL_FUNCTION(NULL, "imageflip", NULL, 381, &_2$$4, &_3$$4); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -690,32 +690,32 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) ZEPHIR_CALL_METHOD(&_0, mask, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 377, &_0); + ZEPHIR_CALL_FUNCTION(&maskImage, "imagecreatefromstring", NULL, 382, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 374, &maskImage); + ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 379, &maskImage); zephir_check_call_status(); maskWidth = zephir_get_intval(&_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 375, &maskImage); + ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 380, &maskImage); zephir_check_call_status(); maskHeight = zephir_get_intval(&_2); alpha = 127; - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &maskImage, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &maskImage, &__$true); zephir_check_call_status(); zephir_read_property(&_3, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_4, this_ptr, ZEND_STRL("height"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(&newImage, this_ptr, "processcreate", NULL, 0, &_3, &_4); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &newImage, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &newImage, &__$true); zephir_check_call_status(); ZVAL_LONG(&_5, 0); ZVAL_LONG(&_6, 0); ZVAL_LONG(&_7, 0); ZVAL_LONG(&_8, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &newImage, &_5, &_6, &_7, &_8); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &newImage, &_5, &_6, &_7, &_8); zephir_check_call_status(); ZVAL_LONG(&_5, 0); ZVAL_LONG(&_6, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 378, &newImage, &_5, &_6, &color); + ZEPHIR_CALL_FUNCTION(NULL, "imagefill", NULL, 383, &newImage, &_5, &_6, &color); zephir_check_call_status(); zephir_read_property(&_5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); _9 = !ZEPHIR_IS_LONG_IDENTICAL(&_5, maskWidth); @@ -726,7 +726,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) if (_9) { zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_11$$3, this_ptr, ZEND_STRL("height"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 366, &_10$$3, &_11$$3); + ZEPHIR_CALL_FUNCTION(&tempImage, "imagecreatetruecolor", NULL, 371, &_10$$3, &_11$$3); zephir_check_call_status(); zephir_read_property(&_12$$3, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$3, this_ptr, ZEND_STRL("height"), PH_NOISY_CC | PH_READONLY); @@ -736,9 +736,9 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) ZVAL_LONG(&_17$$3, 0); ZVAL_LONG(&_18$$3, maskWidth); ZVAL_LONG(&_19$$3, maskHeight); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 379, &tempImage, &maskImage, &_14$$3, &_15$$3, &_16$$3, &_17$$3, &_12$$3, &_13$$3, &_18$$3, &_19$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopyresampled", NULL, 384, &tempImage, &maskImage, &_14$$3, &_15$$3, &_16$$3, &_17$$3, &_12$$3, &_13$$3, &_18$$3, &_19$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &maskImage); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &maskImage); zephir_check_call_status(); ZEPHIR_CPY_WRT(&maskImage, &tempImage); } @@ -756,9 +756,9 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) } ZVAL_LONG(&_21$$5, x); ZVAL_LONG(&_22$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_23, 380, &maskImage, &_21$$5, &_22$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_23, 385, &maskImage, &_21$$5, &_22$$5); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_24, 381, &maskImage, &index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_24, 386, &maskImage, &index); zephir_check_call_status(); if (1 == zephir_array_isset_string(&color, SL("red"))) { zephir_array_fetch_string(&_25$$6, &color, SL("red"), PH_NOISY | PH_READONLY, "phalcon/Image/Adapter/Gd.zep", 348); @@ -768,10 +768,10 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) zephir_read_property(&_21$$5, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_22$$5, x); ZVAL_LONG(&_27$$5, y); - ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_23, 380, &_21$$5, &_22$$5, &_27$$5); + ZEPHIR_CALL_FUNCTION(&index, "imagecolorat", &_23, 385, &_21$$5, &_22$$5, &_27$$5); zephir_check_call_status(); zephir_read_property(&_22$$5, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_24, 381, &_22$$5, &index); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorsforindex", &_24, 386, &_22$$5, &index); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&red); zephir_array_fetch_string(&red, &color, SL("red"), PH_NOISY, "phalcon/Image/Adapter/Gd.zep", 353); @@ -780,20 +780,20 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processMask) ZEPHIR_OBS_NVAR(&blue); zephir_array_fetch_string(&blue, &color, SL("blue"), PH_NOISY, "phalcon/Image/Adapter/Gd.zep", 355); ZVAL_LONG(&_27$$5, alpha); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &newImage, &red, &green, &blue, &_27$$5); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &newImage, &red, &green, &blue, &_27$$5); zephir_check_call_status(); ZVAL_LONG(&_27$$5, x); ZVAL_LONG(&_28$$5, y); - ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", &_29, 382, &newImage, &_27$$5, &_28$$5, &color); + ZEPHIR_CALL_FUNCTION(NULL, "imagesetpixel", &_29, 387, &newImage, &_27$$5, &_28$$5, &color); zephir_check_call_status(); y++; } x++; } zephir_read_property(&_8, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &_8); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &_8); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &maskImage); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &maskImage); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &newImage); ZEPHIR_MM_RESTORE(); @@ -863,7 +863,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processPixelate) zephir_read_property(&_5$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6$$4, x1); ZVAL_LONG(&_7$$4, y1); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_8, 380, &_5$$4, &_6$$4, &_7$$4); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorat", &_8, 385, &_5$$4, &_6$$4, &_7$$4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&x2); ZVAL_LONG(&x2, (x + amount)); @@ -872,7 +872,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processPixelate) zephir_read_property(&_6$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_7$$4, x); ZVAL_LONG(&_9$$4, y); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", &_10, 383, &_6$$4, &_7$$4, &_9$$4, &x2, &y2, &color); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", &_10, 388, &_6$$4, &_7$$4, &_9$$4, &x2, &y2, &color); zephir_check_call_status(); y += amount; } @@ -946,7 +946,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processReflection) ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_1, ((zephir_safe_div_long_long((opacity * 127), 100)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 280, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 283, &_1); zephir_check_call_status(); zephir_round(&_0, &_2, NULL, NULL); opacity = zephir_get_intval(&_0); @@ -967,7 +967,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processReflection) ZVAL_LONG(&_8, 0); ZVAL_LONG(&_9, 0); ZVAL_LONG(&_10, 0); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 371, &reflection, &_4, &_7, &_8, &_9, &_10, &_5, &_6); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 376, &reflection, &_4, &_7, &_8, &_9, &_10, &_5, &_6); zephir_check_call_status(); offset = 0; while (1) { @@ -1000,14 +1000,14 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processReflection) ZVAL_LONG(&_22$$5, 0); ZVAL_LONG(&_23$$5, sourceY); ZVAL_LONG(&_24$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 371, &line, &_18$$5, &_20$$5, &_21$$5, &_22$$5, &_23$$5, &_19$$5, &_24$$5); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 376, &line, &_18$$5, &_20$$5, &_21$$5, &_22$$5, &_23$$5, &_19$$5, &_24$$5); zephir_check_call_status(); ZVAL_LONG(&_20$$5, 4); ZVAL_LONG(&_21$$5, 0); ZVAL_LONG(&_22$$5, 0); ZVAL_LONG(&_23$$5, 0); ZVAL_LONG(&_24$$5, destinationOpacity); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_25, 372, &line, &_20$$5, &_21$$5, &_22$$5, &_23$$5, &_24$$5); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilter", &_25, 377, &line, &_20$$5, &_21$$5, &_22$$5, &_23$$5, &_24$$5); zephir_check_call_status(); zephir_read_property(&_20$$5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_21$$5, 0); @@ -1015,18 +1015,18 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processReflection) ZVAL_LONG(&_23$$5, 0); ZVAL_LONG(&_24$$5, 0); ZVAL_LONG(&_26$$5, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 371, &reflection, &line, &_21$$5, &_22$$5, &_23$$5, &_24$$5, &_20$$5, &_26$$5); + ZEPHIR_CALL_FUNCTION(NULL, "imagecopy", NULL, 376, &reflection, &line, &_21$$5, &_22$$5, &_23$$5, &_24$$5, &_20$$5, &_26$$5); zephir_check_call_status(); offset++; } zephir_read_property(&_7, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &_7); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &_7); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &reflection); - ZEPHIR_CALL_FUNCTION(&_27, "imagesx", NULL, 374, &reflection); + ZEPHIR_CALL_FUNCTION(&_27, "imagesx", NULL, 379, &reflection); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &_27); - ZEPHIR_CALL_FUNCTION(&_28, "imagesy", NULL, 375, &reflection); + ZEPHIR_CALL_FUNCTION(&_28, "imagesy", NULL, 380, &reflection); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("height"), &_28); ZEPHIR_MM_RESTORE(); @@ -1077,43 +1077,43 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processRender) ZEPHIR_INIT_VAR(&_0); zephir_fast_strtolower(&_0, &extension); zephir_get_strval(&extension, &_0); - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 384); + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 389); zephir_check_call_status(); do { if (ZEPHIR_IS_STRING(&extension, "gif")) { zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 385, &_1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 390, &_1$$3); zephir_check_call_status(); break; } if (ZEPHIR_IS_STRING(&extension, "jpg") || ZEPHIR_IS_STRING(&extension, "jpeg")) { zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_3$$4, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 386, &_2$$4, &__$null, &_3$$4); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 391, &_2$$4, &__$null, &_3$$4); zephir_check_call_status(); break; } if (ZEPHIR_IS_STRING(&extension, "png")) { zephir_read_property(&_4$$5, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 387, &_4$$5); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 392, &_4$$5); zephir_check_call_status(); break; } if (ZEPHIR_IS_STRING(&extension, "wbmp")) { zephir_read_property(&_5$$6, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 388, &_5$$6); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 393, &_5$$6); zephir_check_call_status(); break; } if (ZEPHIR_IS_STRING(&extension, "webp")) { zephir_read_property(&_6$$7, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagewebp", NULL, 389, &_6$$7); + ZEPHIR_CALL_FUNCTION(NULL, "imagewebp", NULL, 394, &_6$$7); zephir_check_call_status(); break; } if (ZEPHIR_IS_STRING(&extension, "xbm")) { zephir_read_property(&_7$$8, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 390, &_7$$8, &__$null); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 395, &_7$$8, &__$null); zephir_check_call_status(); break; } @@ -1121,14 +1121,14 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processRender) object_init_ex(&_8$$9, phalcon_image_exception_ce); ZEPHIR_INIT_VAR(&_9$$9); ZEPHIR_CONCAT_SVS(&_9$$9, "Installed GD does not support '", &extension, "' images"); - ZEPHIR_CALL_METHOD(NULL, &_8$$9, "__construct", NULL, 29, &_9$$9); + ZEPHIR_CALL_METHOD(NULL, &_8$$9, "__construct", NULL, 32, &_9$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_8$$9, "phalcon/Image/Adapter/Gd.zep", 552); ZEPHIR_MM_RESTORE(); return; } while(0); - ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 391); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 396); zephir_check_call_status(); RETURN_MM(); } @@ -1170,16 +1170,16 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processResize) zephir_read_property(&_0, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_1, width); ZVAL_LONG(&_2, height); - ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 392, &_0, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&image, "imagescale", NULL, 397, &_0, &_1, &_2); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &_1); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &_1); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &image); - ZEPHIR_CALL_FUNCTION(&_3, "imagesx", NULL, 374, &image); + ZEPHIR_CALL_FUNCTION(&_3, "imagesx", NULL, 379, &image); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &_3); - ZEPHIR_CALL_FUNCTION(&_4, "imagesy", NULL, 375, &image); + ZEPHIR_CALL_FUNCTION(&_4, "imagesy", NULL, 380, &image); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("height"), &_4); ZEPHIR_MM_RESTORE(); @@ -1230,17 +1230,17 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processRotate) ZVAL_LONG(&_2, 0); ZVAL_LONG(&_3, 0); ZVAL_LONG(&_4, 127); - ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 370, &_0, &_1, &_2, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&transparent, "imagecolorallocatealpha", NULL, 375, &_0, &_1, &_2, &_3, &_4); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_2, (360 - degrees)); - ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 393, &_1, &_2, &transparent); + ZEPHIR_CALL_FUNCTION(&image, "imagerotate", NULL, 398, &_1, &_2, &transparent); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &image, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &image, &__$true); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 374, &image); + ZEPHIR_CALL_FUNCTION(&width, "imagesx", NULL, 379, &image); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 375, &image); + ZEPHIR_CALL_FUNCTION(&height, "imagesy", NULL, 380, &image); zephir_check_call_status(); zephir_read_property(&_2, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_3, 0); @@ -1248,11 +1248,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processRotate) ZVAL_LONG(&_5, 0); ZVAL_LONG(&_6, 0); ZVAL_LONG(&_7, 100); - ZEPHIR_CALL_FUNCTION(©, "imagecopymerge", NULL, 394, &_2, &image, &_3, &_4, &_5, &_6, &width, &height, &_7); + ZEPHIR_CALL_FUNCTION(©, "imagecopymerge", NULL, 399, &_2, &image, &_3, &_4, &_5, &_6, &width, &height, &_7); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(©)) { zephir_read_property(&_8$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &_8$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &_8$$3); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &image); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &width); @@ -1311,11 +1311,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_0, 4); - ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 85, &file, &_0); + ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 88, &file, &_0); zephir_check_call_status(); if (1 == ZEPHIR_IS_EMPTY(&extension)) { zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("type"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&extension, "image_type_to_extension", NULL, 395, &_1$$3, &__$false); + ZEPHIR_CALL_FUNCTION(&extension, "image_type_to_extension", NULL, 400, &_1$$3, &__$false); zephir_check_call_status(); } ZEPHIR_INIT_VAR(&_2); @@ -1327,7 +1327,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_3$$4, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_3$$4); zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 385, &_3$$4, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagegif", NULL, 390, &_3$$4, &file); zephir_check_call_status(); break; } @@ -1343,11 +1343,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) quality = zephir_get_numberval(&_5$$6); zephir_read_property(&_6$$6, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_7$$6, quality); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 386, &_6$$6, &file, &_7$$6); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 391, &_6$$6, &file, &_7$$6); zephir_check_call_status(); } else { zephir_read_property(&_8$$7, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 386, &_8$$7, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagejpeg", NULL, 391, &_8$$7, &file); zephir_check_call_status(); } break; @@ -1357,7 +1357,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_9$$8, 3); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_9$$8); zephir_read_property(&_9$$8, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 387, &_9$$8, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagepng", NULL, 392, &_9$$8, &file); zephir_check_call_status(); break; } @@ -1366,7 +1366,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_10$$9, 15); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_10$$9); zephir_read_property(&_10$$9, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 388, &_10$$9, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagewbmp", NULL, 393, &_10$$9, &file); zephir_check_call_status(); break; } @@ -1375,7 +1375,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_11$$10, 18); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_11$$10); zephir_read_property(&_11$$10, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagewebp", NULL, 389, &_11$$10, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagewebp", NULL, 394, &_11$$10, &file); zephir_check_call_status(); break; } @@ -1384,7 +1384,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) ZVAL_LONG(&_12$$11, 16); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_12$$11); zephir_read_property(&_12$$11, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 390, &_12$$11, &file); + ZEPHIR_CALL_FUNCTION(NULL, "imagexbm", NULL, 395, &_12$$11, &file); zephir_check_call_status(); break; } @@ -1392,7 +1392,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) object_init_ex(&_13$$12, phalcon_image_exception_ce); ZEPHIR_INIT_VAR(&_14$$12); ZEPHIR_CONCAT_SVS(&_14$$12, "Installed GD does not support '", &extension, "' images"); - ZEPHIR_CALL_METHOD(NULL, &_13$$12, "__construct", NULL, 29, &_14$$12); + ZEPHIR_CALL_METHOD(NULL, &_13$$12, "__construct", NULL, 32, &_14$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_13$$12, "phalcon/Image/Adapter/Gd.zep", 679); ZEPHIR_MM_RESTORE(); @@ -1400,7 +1400,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSave) } while(0); zephir_read_property(&_0, this_ptr, ZEND_STRL("type"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_15, "image_type_to_mime_type", NULL, 396, &_0); + ZEPHIR_CALL_FUNCTION(&_15, "image_type_to_mime_type", NULL, 401, &_0); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("mime"), &_15); RETURN_MM_BOOL(1); @@ -1448,7 +1448,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSharpen) ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_1, (-18 + ((amount * 0.08)))); - ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 280, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 283, &_1); zephir_check_call_status(); ZVAL_LONG(&_1, 2); zephir_round(&_0, &_2, &_1, NULL); @@ -1494,15 +1494,15 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processSharpen) zephir_read_property(&_5, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6, (amount - 8)); ZVAL_LONG(&_7, 0); - ZEPHIR_CALL_FUNCTION(&result, "imageconvolution", NULL, 397, &_5, &matrix, &_6, &_7); + ZEPHIR_CALL_FUNCTION(&result, "imageconvolution", NULL, 402, &_5, &matrix, &_6, &_7); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&result)) { zephir_read_property(&_8$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_9$$3, "imagesx", NULL, 374, &_8$$3); + ZEPHIR_CALL_FUNCTION(&_9$$3, "imagesx", NULL, 379, &_8$$3); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &_9$$3); zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_11$$3, "imagesy", NULL, 375, &_10$$3); + ZEPHIR_CALL_FUNCTION(&_11$$3, "imagesy", NULL, 380, &_10$$3); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("height"), &_11$$3); } @@ -1617,7 +1617,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processText) ZVAL_LONG(offsetY, _1); ZEPHIR_INIT_VAR(&_2); ZVAL_DOUBLE(&_3, ((zephir_safe_div_long_long((opacity * 127), 100)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_4, "abs", NULL, 280, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "abs", NULL, 283, &_3); zephir_check_call_status(); zephir_round(&_2, &_4, NULL, NULL); opacity = zephir_get_intval(&_2); @@ -1625,7 +1625,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processText) if (1 != ZEPHIR_IS_EMPTY(&fontFile)) { ZVAL_LONG(&_5$$3, size); ZVAL_LONG(&_6$$3, 0); - ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 398, &_5$$3, &_6$$3, &fontFile, &text); + ZEPHIR_CALL_FUNCTION(&space, "imagettfbbox", NULL, 403, &_5$$3, &_6$$3, &fontFile, &text); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&space)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "Call to imagettfbbox() failed", "phalcon/Image/Adapter/Gd.zep", 758); @@ -1646,11 +1646,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processText) topRightY = zephir_get_intval(&_10$$5); } ZVAL_LONG(&_5$$3, (topRightX - bottomLeftX)); - ZEPHIR_CALL_FUNCTION(&_11$$3, "abs", NULL, 280, &_5$$3); + ZEPHIR_CALL_FUNCTION(&_11$$3, "abs", NULL, 283, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&width, (zephir_get_numberval(&_11$$3) + 10)); ZVAL_LONG(&_5$$3, (topRightY - bottomLeftY)); - ZEPHIR_CALL_FUNCTION(&_12$$3, "abs", NULL, 280, &_5$$3); + ZEPHIR_CALL_FUNCTION(&_12$$3, "abs", NULL, 283, &_5$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&height); ZVAL_LONG(&height, (zephir_get_numberval(&_12$$3) + 10)); @@ -1675,21 +1675,21 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processText) ZVAL_LONG(&_19$$3, green); ZVAL_LONG(&_20$$3, blue); ZVAL_LONG(&_21$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &_5$$3, &_6$$3, &_19$$3, &_20$$3, &_21$$3); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &_5$$3, &_6$$3, &_19$$3, &_20$$3, &_21$$3); zephir_check_call_status(); angle = 0; zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_19$$3, size); ZVAL_LONG(&_20$$3, angle); - ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 399, &_6$$3, &_19$$3, &_20$$3, offsetX, offsetY, &color, &fontFile, &text); + ZEPHIR_CALL_FUNCTION(NULL, "imagettftext", NULL, 404, &_6$$3, &_19$$3, &_20$$3, offsetX, offsetY, &color, &fontFile, &text); zephir_check_call_status(); } else { ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&_23$$8, "imagefontwidth", NULL, 400, &_22$$8); + ZEPHIR_CALL_FUNCTION(&_23$$8, "imagefontwidth", NULL, 405, &_22$$8); zephir_check_call_status(); ZVAL_LONG(&width, (zephir_get_numberval(&_23$$8) * zephir_fast_strlen_ev(&text))); ZVAL_LONG(&_22$$8, size); - ZEPHIR_CALL_FUNCTION(&height, "imagefontheight", NULL, 401, &_22$$8); + ZEPHIR_CALL_FUNCTION(&height, "imagefontheight", NULL, 406, &_22$$8); zephir_check_call_status(); if (ZEPHIR_LT_LONG(offsetX, 0)) { zephir_read_property(&_24$$9, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); @@ -1712,11 +1712,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processText) ZVAL_LONG(&_31$$8, green); ZVAL_LONG(&_32$$8, blue); ZVAL_LONG(&_33$$8, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &_22$$8, &_30$$8, &_31$$8, &_32$$8, &_33$$8); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &_22$$8, &_30$$8, &_31$$8, &_32$$8, &_33$$8); zephir_check_call_status(); zephir_read_property(&_30$$8, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_31$$8, size); - ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 402, &_30$$8, &_31$$8, offsetX, offsetY, &text, &color); + ZEPHIR_CALL_FUNCTION(NULL, "imagestring", NULL, 407, &_30$$8, &_31$$8, offsetX, offsetY, &text, &color); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -1771,20 +1771,20 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processWatermark) ZEPHIR_CALL_METHOD(&_0, watermark, "render", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 377, &_0); + ZEPHIR_CALL_FUNCTION(&overlay, "imagecreatefromstring", NULL, 382, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 365, &overlay, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 370, &overlay, &__$true); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 374, &overlay); + ZEPHIR_CALL_FUNCTION(&_1, "imagesx", NULL, 379, &overlay); zephir_check_call_status(); width = zephir_get_intval(&_1); - ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 375, &overlay); + ZEPHIR_CALL_FUNCTION(&_2, "imagesy", NULL, 380, &overlay); zephir_check_call_status(); height = zephir_get_intval(&_2); if (opacity < 100) { ZEPHIR_INIT_VAR(&_3$$3); ZVAL_DOUBLE(&_4$$3, ((zephir_safe_div_long_long((opacity * 127), 100)) - (double) (127))); - ZEPHIR_CALL_FUNCTION(&_5$$3, "abs", NULL, 280, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "abs", NULL, 283, &_4$$3); zephir_check_call_status(); zephir_round(&_3$$3, &_5$$3, NULL, NULL); opacity = zephir_get_intval(&_3$$3); @@ -1792,20 +1792,20 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processWatermark) ZVAL_LONG(&_6$$3, 127); ZVAL_LONG(&_7$$3, 127); ZVAL_LONG(&_8$$3, opacity); - ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 370, &overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3); + ZEPHIR_CALL_FUNCTION(&color, "imagecolorallocatealpha", NULL, 375, &overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, 3); - ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 403, &overlay, &_4$$3); + ZEPHIR_CALL_FUNCTION(NULL, "imagelayereffect", NULL, 408, &overlay, &_4$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, 0); ZVAL_LONG(&_6$$3, 0); ZVAL_LONG(&_7$$3, width); ZVAL_LONG(&_8$$3, height); - ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 383, &overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3, &color); + ZEPHIR_CALL_FUNCTION(NULL, "imagefilledrectangle", NULL, 388, &overlay, &_4$$3, &_6$$3, &_7$$3, &_8$$3, &color); zephir_check_call_status(); } zephir_read_property(&_9, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 367, &_9, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 372, &_9, &__$true); zephir_check_call_status(); zephir_read_property(&_10, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_11, offsetX); @@ -1814,10 +1814,10 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, processWatermark) ZVAL_LONG(&_14, 0); ZVAL_LONG(&_15, width); ZVAL_LONG(&_16, height); - ZEPHIR_CALL_FUNCTION(©, "imagecopy", NULL, 371, &_10, &overlay, &_11, &_12, &_13, &_14, &_15, &_16); + ZEPHIR_CALL_FUNCTION(©, "imagecopy", NULL, 376, &_10, &overlay, &_11, &_12, &_13, &_14, &_15, &_16); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(©)) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 368, &overlay); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 373, &overlay); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -1852,14 +1852,14 @@ PHP_METHOD(Phalcon_Image_Adapter_Gd, check) ZVAL_STRING(&_0, "2.0.1"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, ">="); - ZEPHIR_CALL_FUNCTION(&_2, "version_compare", NULL, 130, &version, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "version_compare", NULL, 133, &version, &_0, &_1); zephir_check_call_status(); if (!ZEPHIR_IS_TRUE_IDENTICAL(&_2)) { ZEPHIR_INIT_VAR(&_3$$3); object_init_ex(&_3$$3, phalcon_image_exception_ce); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SSV(&_4$$3, "Phalcon\\Image\\Adapter\\GD requires GD ", "version '2.0.1' or greater, you have ", &version); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 29, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 32, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$3, "phalcon/Image/Adapter/Gd.zep", 898); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/image/adapter/imagick.zep.c b/ext/phalcon/image/adapter/imagick.zep.c index e71158bd6b5..b5dcb9df564 100644 --- a/ext/phalcon/image/adapter/imagick.zep.c +++ b/ext/phalcon/image/adapter/imagick.zep.c @@ -143,7 +143,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "check", NULL, 404); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "check", NULL, 409); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("file"), &file); ZEPHIR_INIT_VAR(&_0); @@ -154,7 +154,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) zephir_read_property(&_1, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); if (1 == (zephir_file_exists(&_1) == SUCCESS)) { zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_3$$3, "realpath", NULL, 71, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "realpath", NULL, 74, &_2$$3); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_3$$3); zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); @@ -167,7 +167,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) zephir_read_property(&_8$$4, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_9$$4); ZEPHIR_CONCAT_SVS(&_9$$4, "Imagick::readImage ", &_8$$4, " failed"); - ZEPHIR_CALL_METHOD(NULL, &_7$$4, "__construct", NULL, 29, &_9$$4); + ZEPHIR_CALL_METHOD(NULL, &_7$$4, "__construct", NULL, 32, &_9$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_7$$4, "phalcon/Image/Adapter/Imagick.zep", 72); ZEPHIR_MM_RESTORE(); @@ -180,7 +180,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) zephir_read_property(&_12$$5, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_13$$5); ZVAL_STRING(&_13$$5, "Imagick::ALPHACHANNEL_SET"); - ZEPHIR_CALL_FUNCTION(&_14$$5, "constant", NULL, 115, &_13$$5); + ZEPHIR_CALL_FUNCTION(&_14$$5, "constant", NULL, 118, &_13$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_12$$5, "setimagealphachannel", NULL, 0, &_14$$5); zephir_check_call_status(); @@ -215,7 +215,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, __construct) zephir_read_property(&_24$$8, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_25$$8); ZEPHIR_CONCAT_SV(&_25$$8, "Failed to create image from file ", &_24$$8); - ZEPHIR_CALL_METHOD(NULL, &_23$$8, "__construct", NULL, 29, &_25$$8); + ZEPHIR_CALL_METHOD(NULL, &_23$$8, "__construct", NULL, 32, &_25$$8); zephir_check_call_status(); zephir_throw_exception_debug(&_23$$8, "phalcon/Image/Adapter/Imagick.zep", 97); ZEPHIR_MM_RESTORE(); @@ -516,7 +516,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processBackground) ZVAL_LONG(&_1, red); ZVAL_LONG(&_2, green); ZVAL_LONG(&_3, blue); - ZEPHIR_CALL_FUNCTION(&color, "sprintf", NULL, 113, &_0, &_1, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&color, "sprintf", NULL, 116, &_0, &_1, &_2, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&pixel1); object_init_ex(&pixel1, zephir_get_internal_ce(SL("imagickpixel"))); @@ -549,7 +549,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processBackground) if (!ZEPHIR_IS_TRUE_IDENTICAL(&_7$$3)) { ZEPHIR_INIT_NVAR(&_9$$4); ZVAL_STRING(&_9$$4, "Imagick::ALPHACHANNEL_SET"); - ZEPHIR_CALL_FUNCTION(&_10$$4, "constant", &_11, 115, &_9$$4); + ZEPHIR_CALL_FUNCTION(&_10$$4, "constant", &_11, 118, &_9$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &background, "setimagealphachannel", &_12, 0, &_10$$4); zephir_check_call_status(); @@ -558,11 +558,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processBackground) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$3); ZVAL_STRING(&_14$$3, "Imagick::EVALUATE_MULTIPLY"); - ZEPHIR_CALL_FUNCTION(&_15$$3, "constant", &_11, 115, &_14$$3); + ZEPHIR_CALL_FUNCTION(&_15$$3, "constant", &_11, 118, &_14$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_14$$3); ZVAL_STRING(&_14$$3, "Imagick::CHANNEL_ALPHA"); - ZEPHIR_CALL_FUNCTION(&_16$$3, "constant", &_11, 115, &_14$$3); + ZEPHIR_CALL_FUNCTION(&_16$$3, "constant", &_11, 118, &_14$$3); zephir_check_call_status(); ZVAL_LONG(&_17$$3, opacity); ZEPHIR_CALL_METHOD(NULL, &background, "evaluateimage", &_18, 0, &_15$$3, &_17$$3, &_16$$3); @@ -575,7 +575,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processBackground) zephir_read_property(&_21$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_14$$3); ZVAL_STRING(&_14$$3, "Imagick::COMPOSITE_DISSOLVE"); - ZEPHIR_CALL_FUNCTION(&_22$$3, "constant", &_11, 115, &_14$$3); + ZEPHIR_CALL_FUNCTION(&_22$$3, "constant", &_11, 118, &_14$$3); zephir_check_call_status(); ZVAL_LONG(&_23$$3, 0); ZVAL_LONG(&_24$$3, 0); @@ -869,7 +869,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processMask) zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_5$$3); ZVAL_STRING(&_5$$3, "Imagick::COMPOSITE_DSTIN"); - ZEPHIR_CALL_FUNCTION(&_6$$3, "constant", &_7, 115, &_5$$3); + ZEPHIR_CALL_FUNCTION(&_6$$3, "constant", &_7, 118, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_8$$3, 0); ZVAL_LONG(&_9$$3, 0); @@ -1125,7 +1125,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processReflection) } ZEPHIR_INIT_NVAR(&_18$$7); ZVAL_STRING(&_18$$7, "Imagick::COMPOSITE_DSTOUT"); - ZEPHIR_CALL_FUNCTION(&_19$$7, "constant", &_20, 115, &_18$$7); + ZEPHIR_CALL_FUNCTION(&_19$$7, "constant", &_20, 118, &_18$$7); zephir_check_call_status(); ZVAL_LONG(&_21$$7, 0); ZVAL_LONG(&_22$$7, 0); @@ -1137,11 +1137,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processReflection) } ZEPHIR_INIT_NVAR(&_18$$7); ZVAL_STRING(&_18$$7, "Imagick::EVALUATE_MULTIPLY"); - ZEPHIR_CALL_FUNCTION(&_24$$7, "constant", &_20, 115, &_18$$7); + ZEPHIR_CALL_FUNCTION(&_24$$7, "constant", &_20, 118, &_18$$7); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_18$$7); ZVAL_STRING(&_18$$7, "Imagick::CHANNEL_ALPHA"); - ZEPHIR_CALL_FUNCTION(&_25$$7, "constant", &_20, 115, &_18$$7); + ZEPHIR_CALL_FUNCTION(&_25$$7, "constant", &_20, 118, &_18$$7); zephir_check_call_status(); ZVAL_LONG(&_21$$7, opacity); ZEPHIR_CALL_METHOD(NULL, &reflection, "evaluateimage", &_26, 0, &_24$$7, &_21$$7, &_25$$7); @@ -1181,7 +1181,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processReflection) zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_34$$10); ZVAL_STRING(&_34$$10, "Imagick::ALPHACHANNEL_SET"); - ZEPHIR_CALL_FUNCTION(&_35$$10, "constant", &_20, 115, &_34$$10); + ZEPHIR_CALL_FUNCTION(&_35$$10, "constant", &_20, 118, &_34$$10); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &image, "setimagealphachannel", &_36, 0, &_35$$10); zephir_check_call_status(); @@ -1198,7 +1198,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processReflection) zephir_read_property(&_42$$10, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_34$$10); ZVAL_STRING(&_34$$10, "Imagick::COMPOSITE_SRC"); - ZEPHIR_CALL_FUNCTION(&_43$$10, "constant", &_20, 115, &_34$$10); + ZEPHIR_CALL_FUNCTION(&_43$$10, "constant", &_20, 118, &_34$$10); zephir_check_call_status(); ZVAL_LONG(&_44$$10, 0); ZVAL_LONG(&_45$$10, 0); @@ -1227,7 +1227,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processReflection) } ZEPHIR_INIT_NVAR(&_48$$13); ZVAL_STRING(&_48$$13, "Imagick::COMPOSITE_OVER"); - ZEPHIR_CALL_FUNCTION(&_49$$13, "constant", &_20, 115, &_48$$13); + ZEPHIR_CALL_FUNCTION(&_49$$13, "constant", &_20, 118, &_48$$13); zephir_check_call_status(); zephir_read_property(&_50$$13, this_ptr, ZEND_STRL("height"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_51$$13, 0); @@ -1339,7 +1339,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processRender) if (ZEPHIR_IS_STRING(&extension, "jpg") || ZEPHIR_IS_STRING(&extension, "jpeg")) { ZEPHIR_INIT_VAR(&_5$$4); ZVAL_STRING(&_5$$4, "Imagick::COMPRESSION_JPEG"); - ZEPHIR_CALL_FUNCTION(&_6$$4, "constant", NULL, 115, &_5$$4); + ZEPHIR_CALL_FUNCTION(&_6$$4, "constant", NULL, 118, &_5$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &image, "setimagecompression", NULL, 0, &_6$$4); zephir_check_call_status(); @@ -1557,7 +1557,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processSave) ZVAL_LONG(&_0, 4); - ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 85, &file, &_0); + ZEPHIR_CALL_FUNCTION(&extension, "pathinfo", NULL, 88, &file, &_0); zephir_check_call_status(); zephir_read_property(&_0, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, &_0, "setformat", NULL, 0, &extension); @@ -1585,7 +1585,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processSave) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$3); ZVAL_STRING(&_9$$3, "w"); - ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 136, &file, &_9$$3); + ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 139, &file, &_9$$3); zephir_check_call_status(); zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, &_10$$3, "writeimagesfile", NULL, 0, &fp); @@ -1597,7 +1597,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processSave) zephir_read_property(&_11$$4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_12$$4); ZVAL_STRING(&_12$$4, "Imagick::COMPRESSION_JPEG"); - ZEPHIR_CALL_FUNCTION(&_13$$4, "constant", NULL, 115, &_12$$4); + ZEPHIR_CALL_FUNCTION(&_13$$4, "constant", NULL, 118, &_12$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &_11$$4, "setimagecompression", NULL, 0, &_13$$4); zephir_check_call_status(); @@ -1782,7 +1782,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) ZVAL_LONG(&_1, red); ZVAL_LONG(&_2, green); ZVAL_LONG(&_3, blue); - ZEPHIR_CALL_FUNCTION(&color, "sprintf", NULL, 113, &_0, &_1, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&color, "sprintf", NULL, 116, &_0, &_1, &_2, &_3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); object_init_ex(&_0, zephir_get_internal_ce(SL("imagickpixel"))); @@ -1814,7 +1814,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) ZVAL_LONG(offsetY, 0); ZEPHIR_INIT_VAR(&_6$$7); ZVAL_STRING(&_6$$7, "Imagick::GRAVITY_CENTER"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_6$$7); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_6$$7); zephir_check_call_status(); } else if (Z_TYPE_P(offsetY) == IS_LONG) { ZEPHIR_INIT_VAR(&y); @@ -1826,7 +1826,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_7$$8) { ZEPHIR_INIT_VAR(&_8$$8); ZVAL_STRING(&_8$$8, "Imagick::GRAVITY_SOUTHEAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_8$$8); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_8$$8); zephir_check_call_status(); } else { } @@ -1837,7 +1837,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_9$$8) { ZEPHIR_INIT_NVAR(&_8$$8); ZVAL_STRING(&_8$$8, "Imagick::GRAVITY_NORTHEAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_8$$8); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_8$$8); zephir_check_call_status(); } else { } @@ -1848,7 +1848,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_10$$8) { ZEPHIR_INIT_NVAR(&_8$$8); ZVAL_STRING(&_8$$8, "Imagick::GRAVITY_SOUTH"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_8$$8); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_8$$8); zephir_check_call_status(); } else { } @@ -1859,7 +1859,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_11$$8) { ZEPHIR_INIT_NVAR(&_8$$8); ZVAL_STRING(&_8$$8, "Imagick::GRAVITY_NORTH"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_8$$8); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_8$$8); zephir_check_call_status(); } else { } @@ -1883,7 +1883,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_12$$11) { ZEPHIR_INIT_VAR(&_13$$11); ZVAL_STRING(&_13$$11, "Imagick::GRAVITY_SOUTHEAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_13$$11); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_13$$11); zephir_check_call_status(); } else { } @@ -1894,7 +1894,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_14$$11) { ZEPHIR_INIT_NVAR(&_13$$11); ZVAL_STRING(&_13$$11, "Imagick::GRAVITY_SOUTH"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_13$$11); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_13$$11); zephir_check_call_status(); } else { } @@ -1905,7 +1905,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_15$$11) { ZEPHIR_INIT_NVAR(&_13$$11); ZVAL_STRING(&_13$$11, "Imagick::GRAVITY_EAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_13$$11); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_13$$11); zephir_check_call_status(); } else { } @@ -1916,7 +1916,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (_16$$11) { ZEPHIR_INIT_NVAR(&_13$$11); ZVAL_STRING(&_13$$11, "Imagick::GRAVITY_WEST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_13$$11); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_13$$11); zephir_check_call_status(); } else { } @@ -1945,14 +1945,14 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processText) if (ZEPHIR_LT_LONG(&y, 0)) { ZEPHIR_INIT_VAR(&_17$$12); ZVAL_STRING(&_17$$12, "Imagick::GRAVITY_SOUTHEAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_17$$12); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_17$$12); zephir_check_call_status(); } else { } if (ZEPHIR_GE_LONG(&y, 0)) { ZEPHIR_INIT_NVAR(&_17$$12); ZVAL_STRING(&_17$$12, "Imagick::GRAVITY_NORTHEAST"); - ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 115, &_17$$12); + ZEPHIR_CALL_FUNCTION(&gravity, "constant", NULL, 118, &_17$$12); zephir_check_call_status(); } else { } @@ -2050,11 +2050,11 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processWatermark) zephir_check_call_status(); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "Imagick::EVALUATE_MULTIPLY"); - ZEPHIR_CALL_FUNCTION(&_2, "constant", NULL, 115, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "constant", NULL, 118, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "Imagick::CHANNEL_ALPHA"); - ZEPHIR_CALL_FUNCTION(&_3, "constant", NULL, 115, &_1); + ZEPHIR_CALL_FUNCTION(&_3, "constant", NULL, 118, &_1); zephir_check_call_status(); ZVAL_LONG(&_4, opacity); ZEPHIR_CALL_METHOD(NULL, &watermark, "evaluateimage", NULL, 0, &_2, &_4, &_3); @@ -2070,7 +2070,7 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, processWatermark) zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_NVAR(&_7$$3); ZVAL_STRING(&_7$$3, "Imagick::COMPOSITE_OVER"); - ZEPHIR_CALL_FUNCTION(&_8$$3, "constant", NULL, 115, &_7$$3); + ZEPHIR_CALL_FUNCTION(&_8$$3, "constant", NULL, 118, &_7$$3); zephir_check_call_status(); ZVAL_LONG(&_9$$3, offsetX); ZVAL_LONG(&_10$$3, offsetY); @@ -2124,12 +2124,12 @@ PHP_METHOD(Phalcon_Image_Adapter_Imagick, check) } ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "Imagick::IMAGICK_EXTNUM"); - ZEPHIR_CALL_FUNCTION(&_2, "defined", NULL, 114, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "defined", NULL, 117, &_1); zephir_check_call_status(); if (zephir_is_true(&_2)) { ZEPHIR_INIT_VAR(&_3$$4); ZVAL_STRING(&_3$$4, "Imagick::IMAGICK_EXTNUM"); - ZEPHIR_CALL_FUNCTION(&_4$$4, "constant", NULL, 115, &_3$$4); + ZEPHIR_CALL_FUNCTION(&_4$$4, "constant", NULL, 118, &_3$$4); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("version"), &_4$$4); } diff --git a/ext/phalcon/image/imagefactory.zep.c b/ext/phalcon/image/imagefactory.zep.c index 77ba58abf9d..e0f4d9e411a 100644 --- a/ext/phalcon/image/imagefactory.zep.c +++ b/ext/phalcon/image/imagefactory.zep.c @@ -128,17 +128,17 @@ PHP_METHOD(Phalcon_Image_ImageFactory, load) zephir_array_unset_string(config, SL("adapter"), PH_SEPARATE); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "file"); - ZEPHIR_CALL_METHOD(&file, this_ptr, "getarrval", NULL, 405, config, &_1); + ZEPHIR_CALL_METHOD(&file, this_ptr, "getarrval", NULL, 410, config, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "height"); ZVAL_NULL(&_2); - ZEPHIR_CALL_METHOD(&height, this_ptr, "getarrval", NULL, 405, config, &_1, &_2); + ZEPHIR_CALL_METHOD(&height, this_ptr, "getarrval", NULL, 410, config, &_1, &_2); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "width"); ZVAL_NULL(&_2); - ZEPHIR_CALL_METHOD(&width, this_ptr, "getarrval", NULL, 405, config, &_1, &_2); + ZEPHIR_CALL_METHOD(&width, this_ptr, "getarrval", NULL, 410, config, &_1, &_2); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &file, &width, &height); zephir_check_call_status(); diff --git a/ext/phalcon/logger/abstractlogger.zep.c b/ext/phalcon/logger/abstractlogger.zep.c index 786da644fc9..075fa5ecc8d 100644 --- a/ext/phalcon/logger/abstractlogger.zep.c +++ b/ext/phalcon/logger/abstractlogger.zep.c @@ -149,7 +149,7 @@ PHP_METHOD(Phalcon_Logger_AbstractLogger, __construct) if (Z_TYPE_P(timezone) == IS_NULL) { - ZEPHIR_CALL_FUNCTION(&defaultTimezone, "date_default_timezone_get", NULL, 93); + ZEPHIR_CALL_FUNCTION(&defaultTimezone, "date_default_timezone_get", NULL, 96); zephir_check_call_status(); if (UNEXPECTED(1 == ZEPHIR_IS_EMPTY(&defaultTimezone))) { ZEPHIR_INIT_NVAR(&defaultTimezone); @@ -558,11 +558,11 @@ PHP_METHOD(Phalcon_Logger_AbstractLogger, addMessage) ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 0, &_4$$3, &_3$$3); zephir_check_call_status(); ZVAL_LONG(&_5$$3, level); - ZEPHIR_CALL_METHOD(NULL, &item, "__construct", NULL, 94, &message, &levelName, &_5$$3, &_2$$3, &context); + ZEPHIR_CALL_METHOD(NULL, &item, "__construct", NULL, 97, &message, &levelName, &_5$$3, &_2$$3, &context); zephir_check_call_status(); zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("excluded"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&collection, "array_diff_key", NULL, 95, &_5$$3, &_6$$3); + ZEPHIR_CALL_FUNCTION(&collection, "array_diff_key", NULL, 98, &_5$$3, &_6$$3); zephir_check_call_status(); zephir_is_iterable(&collection, 0, "phalcon/Logger/AbstractLogger.zep", 303); if (Z_TYPE_P(&collection) == IS_ARRAY) { @@ -650,7 +650,7 @@ PHP_METHOD(Phalcon_Logger_AbstractLogger, getLevelNumber) zephir_fast_strtoupper(&levelName, level); ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getlevels", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&levels, "array_flip", NULL, 96, &_0$$3); + ZEPHIR_CALL_FUNCTION(&levels, "array_flip", NULL, 99, &_0$$3); zephir_check_call_status(); if (zephir_array_isset(&levels, &levelName)) { zephir_array_fetch(&_1$$4, &levels, &levelName, PH_NOISY | PH_READONLY, "phalcon/Logger/AbstractLogger.zep", 328); diff --git a/ext/phalcon/logger/adapter/abstractadapter.zep.c b/ext/phalcon/logger/adapter/abstractadapter.zep.c index ee386b360f6..2059a8768b1 100644 --- a/ext/phalcon/logger/adapter/abstractadapter.zep.c +++ b/ext/phalcon/logger/adapter/abstractadapter.zep.c @@ -208,7 +208,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, commit) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 64); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 67); zephir_check_call_status(); zephir_read_property(&_0, this_ptr, ZEND_STRL("queue"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&queue, &_0); @@ -239,7 +239,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, commit) } } ZEPHIR_INIT_NVAR(&item); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 65); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 68); zephir_check_call_status(); RETURN_THIS(); } @@ -310,9 +310,9 @@ PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, rollback) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 64); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 67); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 65); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 68); zephir_check_call_status(); RETURN_THIS(); } diff --git a/ext/phalcon/logger/adapter/stream.zep.c b/ext/phalcon/logger/adapter/stream.zep.c index 6ac2a836cf8..638ee061e95 100644 --- a/ext/phalcon/logger/adapter/stream.zep.c +++ b/ext/phalcon/logger/adapter/stream.zep.c @@ -127,7 +127,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct) } ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "r"); - ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 82, &mode, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 85, &mode, &_0); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_1)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Adapter cannot be opened in read mode", "phalcon/Logger/Adapter/Stream.zep", 76); @@ -211,14 +211,14 @@ PHP_METHOD(Phalcon_Logger_Adapter_Stream, process) zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("mode"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_5$$3); ZEPHIR_CONCAT_SVSVS(&_5$$3, "The file '", &_3$$3, "' cannot be opened with mode '", &_4$$3, "'"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 406, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 411, &_5$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$3, "phalcon/Logger/Adapter/Stream.zep", 119); ZEPHIR_MM_RESTORE(); return; } ZVAL_LONG(&_6, 2); - ZEPHIR_CALL_FUNCTION(NULL, "flock", NULL, 128, &handler, &_6); + ZEPHIR_CALL_FUNCTION(NULL, "flock", NULL, 131, &handler, &_6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, this_ptr, "getformatteditem", NULL, 0, item); zephir_check_call_status(); @@ -259,7 +259,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Stream, phpFopen) zephir_get_strval(&mode, mode_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); + ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 139, &filename, &mode); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/logger/adapter/syslog.zep.c b/ext/phalcon/logger/adapter/syslog.zep.c index a70bf103321..53afcc98fb0 100644 --- a/ext/phalcon/logger/adapter/syslog.zep.c +++ b/ext/phalcon/logger/adapter/syslog.zep.c @@ -143,7 +143,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Syslog, close) if (!(zephir_is_true(&_0))) { RETURN_MM_BOOL(1); } - ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 407); + ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 412); zephir_check_call_status(); RETURN_MM(); } @@ -207,9 +207,9 @@ PHP_METHOD(Phalcon_Logger_Adapter_Syslog, process) zephir_cast_to_string(&_6$$3, &_5$$3); ZEPHIR_INIT_VAR(&_7$$3); ZVAL_STRING(&_7$$3, "Cannot open syslog for name [%s] and facility [%s]"); - ZEPHIR_CALL_FUNCTION(&_8$$3, "sprintf", NULL, 113, &_7$$3, &_4$$3, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_8$$3, "sprintf", NULL, 116, &_7$$3, &_4$$3, &_6$$3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 406, &_8$$3); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 411, &_8$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$3, "phalcon/Logger/Adapter/Syslog.zep", 106); ZEPHIR_MM_RESTORE(); @@ -222,9 +222,9 @@ PHP_METHOD(Phalcon_Logger_Adapter_Syslog, process) } ZEPHIR_CALL_METHOD(&_9, item, "getlevel", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&level, this_ptr, "logleveltosyslog", NULL, 408, &_9); + ZEPHIR_CALL_METHOD(&level, this_ptr, "logleveltosyslog", NULL, 413, &_9); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 409, &level, &message); + ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 414, &level, &message); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -270,7 +270,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Syslog, openlog) ZVAL_LONG(&_0, option); ZVAL_LONG(&_1, facility); - ZEPHIR_RETURN_CALL_FUNCTION("openlog", NULL, 410, &ident, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("openlog", NULL, 415, &ident, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/logger/loggerfactory.zep.c b/ext/phalcon/logger/loggerfactory.zep.c index 42b7ccdf10e..a251fe0c785 100644 --- a/ext/phalcon/logger/loggerfactory.zep.c +++ b/ext/phalcon/logger/loggerfactory.zep.c @@ -282,7 +282,7 @@ PHP_METHOD(Phalcon_Logger_LoggerFactory, newInstance) object_init_ex(return_value, phalcon_logger_logger_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 411, &name, &adapters, timezone); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 416, &name, &adapters, timezone); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/messages/messages.zep.c b/ext/phalcon/messages/messages.zep.c index 62dc9cfdf30..5f7ba5c3d8a 100644 --- a/ext/phalcon/messages/messages.zep.c +++ b/ext/phalcon/messages/messages.zep.c @@ -569,7 +569,7 @@ PHP_METHOD(Phalcon_Messages_Messages, offsetUnset) zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_2$$3, 1); ZEPHIR_MAKE_REF(&_1$$3); - ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 412, &_1$$3, index, &_2$$3); + ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 417, &_1$$3, index, &_2$$3); ZEPHIR_UNREF(&_1$$3); zephir_check_call_status(); } diff --git a/ext/phalcon/mvc/application.zep.c b/ext/phalcon/mvc/application.zep.c index d0e57595505..33a26c21fcf 100644 --- a/ext/phalcon/mvc/application.zep.c +++ b/ext/phalcon/mvc/application.zep.c @@ -295,7 +295,7 @@ PHP_METHOD(Phalcon_Mvc_Application, handle) object_init_ex(&_14$$18, phalcon_mvc_application_exception_ce); ZEPHIR_INIT_VAR(&_15$$18); ZEPHIR_CONCAT_SVS(&_15$$18, "Module definition path '", &path, "' doesn't exist"); - ZEPHIR_CALL_METHOD(NULL, &_14$$18, "__construct", NULL, 29, &_15$$18); + ZEPHIR_CALL_METHOD(NULL, &_14$$18, "__construct", NULL, 32, &_15$$18); zephir_check_call_status(); zephir_throw_exception_debug(&_14$$18, "phalcon/Mvc/Application.zep", 218); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/mvc/dispatcher.zep.c b/ext/phalcon/mvc/dispatcher.zep.c index 4e3563747b9..e9bf16c95ca 100644 --- a/ext/phalcon/mvc/dispatcher.zep.c +++ b/ext/phalcon/mvc/dispatcher.zep.c @@ -454,7 +454,7 @@ PHP_METHOD(Phalcon_Mvc_Dispatcher, throwDispatchException) ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "A dependency injection container is required to access the 'response' service"); ZVAL_LONG(&_3$$3, 0); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3, &_3$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Dispatcher.zep", 228); ZEPHIR_MM_RESTORE(); @@ -473,7 +473,7 @@ PHP_METHOD(Phalcon_Mvc_Dispatcher, throwDispatchException) ZEPHIR_INIT_VAR(&exception); object_init_ex(&exception, phalcon_mvc_dispatcher_exception_ce); ZVAL_LONG(&_0, exceptionCode); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 29, &message, &_0); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 32, &message, &_0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_4, this_ptr, "handleexception", NULL, 0, &exception); zephir_check_call_status(); diff --git a/ext/phalcon/mvc/micro.zep.c b/ext/phalcon/mvc/micro.zep.c index b428e980f89..63870303094 100644 --- a/ext/phalcon/mvc/micro.zep.c +++ b/ext/phalcon/mvc/micro.zep.c @@ -584,7 +584,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, getService) if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 413); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } @@ -636,7 +636,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, getSharedService) if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 413); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } @@ -841,7 +841,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_9$$8, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_VAR(&_10$$8); ZVAL_STRING(&_10$$8, "Matched route doesn't have an associated handler"); - ZEPHIR_CALL_METHOD(NULL, &_9$$8, "__construct", NULL, 29, &_10$$8); + ZEPHIR_CALL_METHOD(NULL, &_9$$8, "__construct", NULL, 32, &_10$$8); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_9$$8, "phalcon/Mvc/Micro.zep", 432); goto try_end_1; @@ -887,7 +887,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_19$$14, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_20$$14); ZVAL_STRING(&_20$$14, "'before' handler is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_19$$14, "__construct", NULL, 29, &_20$$14); + ZEPHIR_CALL_METHOD(NULL, &_19$$14, "__construct", NULL, 32, &_20$$14); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_19$$14, "phalcon/Mvc/Micro.zep", 467); goto try_end_1; @@ -926,7 +926,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_23$$19, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_24$$19); ZVAL_STRING(&_24$$19, "'before' handler is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_23$$19, "__construct", NULL, 29, &_24$$19); + ZEPHIR_CALL_METHOD(NULL, &_23$$19, "__construct", NULL, 32, &_24$$19); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_23$$19, "phalcon/Mvc/Micro.zep", 467); goto try_end_1; @@ -1049,7 +1049,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_45$$34, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_46$$34); ZVAL_STRING(&_46$$34, "'afterBinding' handler is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_45$$34, "__construct", NULL, 29, &_46$$34); + ZEPHIR_CALL_METHOD(NULL, &_45$$34, "__construct", NULL, 32, &_46$$34); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_45$$34, "phalcon/Mvc/Micro.zep", 578); goto try_end_1; @@ -1088,7 +1088,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_49$$39, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_50$$39); ZVAL_STRING(&_50$$39, "'afterBinding' handler is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_49$$39, "__construct", NULL, 29, &_50$$39); + ZEPHIR_CALL_METHOD(NULL, &_49$$39, "__construct", NULL, 32, &_50$$39); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_49$$39, "phalcon/Mvc/Micro.zep", 578); goto try_end_1; @@ -1142,7 +1142,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_58$$45, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_59$$45); ZVAL_STRING(&_59$$45, "One of the 'after' handlers is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_58$$45, "__construct", NULL, 29, &_59$$45); + ZEPHIR_CALL_METHOD(NULL, &_58$$45, "__construct", NULL, 32, &_59$$45); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_58$$45, "phalcon/Mvc/Micro.zep", 624); goto try_end_1; @@ -1181,7 +1181,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_62$$50, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_63$$50); ZVAL_STRING(&_63$$50, "One of the 'after' handlers is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_62$$50, "__construct", NULL, 29, &_63$$50); + ZEPHIR_CALL_METHOD(NULL, &_62$$50, "__construct", NULL, 32, &_63$$50); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_62$$50, "phalcon/Mvc/Micro.zep", 624); goto try_end_1; @@ -1219,7 +1219,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_70$$55, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_VAR(&_71$$55); ZVAL_STRING(&_71$$55, "Not-Found handler is not callable or is not defined"); - ZEPHIR_CALL_METHOD(NULL, &_70$$55, "__construct", NULL, 29, &_71$$55); + ZEPHIR_CALL_METHOD(NULL, &_70$$55, "__construct", NULL, 32, &_71$$55); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_70$$55, "phalcon/Mvc/Micro.zep", 655); goto try_end_1; @@ -1263,7 +1263,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_79$$60, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_80$$60); ZVAL_STRING(&_80$$60, "One of the 'finish' handlers is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_79$$60, "__construct", NULL, 29, &_80$$60); + ZEPHIR_CALL_METHOD(NULL, &_79$$60, "__construct", NULL, 32, &_80$$60); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_79$$60, "phalcon/Mvc/Micro.zep", 690); goto try_end_1; @@ -1305,7 +1305,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, handle) object_init_ex(&_84$$65, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_NVAR(&_85$$65); ZVAL_STRING(&_85$$65, "One of the 'finish' handlers is not callable"); - ZEPHIR_CALL_METHOD(NULL, &_84$$65, "__construct", NULL, 29, &_85$$65); + ZEPHIR_CALL_METHOD(NULL, &_84$$65, "__construct", NULL, 32, &_85$$65); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_84$$65, "phalcon/Mvc/Micro.zep", 690); goto try_end_1; @@ -1466,7 +1466,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, hasService) if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 413); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } @@ -1633,7 +1633,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, mount) if (zephir_is_true(&_0)) { ZEPHIR_INIT_VAR(&lazyHandler); object_init_ex(&lazyHandler, phalcon_mvc_micro_lazyloader_ce); - ZEPHIR_CALL_METHOD(NULL, &lazyHandler, "__construct", NULL, 414, &mainHandler); + ZEPHIR_CALL_METHOD(NULL, &lazyHandler, "__construct", NULL, 419, &mainHandler); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&lazyHandler, &mainHandler); @@ -1920,7 +1920,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, offsetUnset) if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 413); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } @@ -2160,15 +2160,10 @@ PHP_METHOD(Phalcon_Mvc_Micro, setActiveHandler) */ PHP_METHOD(Phalcon_Mvc_Micro, setDI) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *container, container_sub, _0, _1, _2$$3; + zval *container, container_sub; zval *this_ptr = getThis(); ZVAL_UNDEF(&container_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -2177,22 +2172,10 @@ PHP_METHOD(Phalcon_Mvc_Micro, setDI) #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &container); + zephir_fetch_params_without_memory_grow(1, 0, &container); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "application"); - ZEPHIR_CALL_METHOD(&_0, container, "has", NULL, 0, &_1); - zephir_check_call_status(); - if (!(zephir_is_true(&_0))) { - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "application"); - ZEPHIR_CALL_METHOD(NULL, container, "set", NULL, 0, &_2$$3, this_ptr); - zephir_check_call_status(); - } zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); - ZEPHIR_MM_RESTORE(); } /** @@ -2329,7 +2312,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, setService) if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 413); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } diff --git a/ext/phalcon/mvc/micro/lazyloader.zep.c b/ext/phalcon/mvc/micro/lazyloader.zep.c index ee68620acf9..5e201606cbb 100644 --- a/ext/phalcon/mvc/micro/lazyloader.zep.c +++ b/ext/phalcon/mvc/micro/lazyloader.zep.c @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, callMethod) object_init_ex(&_1$$4, phalcon_mvc_micro_exception_ce); ZEPHIR_INIT_VAR(&_2$$4); ZEPHIR_CONCAT_SVS(&_2$$4, "Handler '", &definition, "' doesn't exist"); - ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 29, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_2$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Micro/LazyLoader.zep", 55); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/mvc/model.zep.c b/ext/phalcon/mvc/model.zep.c index 5e7b350afad..3914fa28ca7 100644 --- a/ext/phalcon/mvc/model.zep.c +++ b/ext/phalcon/mvc/model.zep.c @@ -16,9 +16,9 @@ #include "kernel/operators.h" #include "kernel/fcall.h" #include "kernel/exception.h" -#include "kernel/object.h" #include "kernel/memory.h" #include "kernel/concat.h" +#include "kernel/object.h" #include "kernel/string.h" #include "kernel/array.h" #include "ext/spl/spl_exceptions.h" @@ -163,15 +163,21 @@ PHP_METHOD(Phalcon_Mvc_Model, __construct) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; - zval *data = NULL, data_sub, *container = NULL, container_sub, *modelsManager = NULL, modelsManager_sub, __$null, _1$$5, _2$$5; + zval *data = NULL, data_sub, *container = NULL, container_sub, *modelsManager = NULL, modelsManager_sub, __$null, _1$$4, _2$$4, _3$$4, _4$$5, _5$$5, _6$$6, _7$$6, _8$$6; zval *this_ptr = getThis(); ZVAL_UNDEF(&data_sub); ZVAL_UNDEF(&container_sub); ZVAL_UNDEF(&modelsManager_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 3) @@ -208,18 +214,36 @@ PHP_METHOD(Phalcon_Mvc_Model, __construct) zephir_check_call_status(); } if (Z_TYPE_P(container) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ODM", "phalcon/Mvc/Model.zep", 182); + ZEPHIR_INIT_VAR(&_1$$4); + object_init_ex(&_1$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$4); + zephir_get_class(&_2$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$4); + ZEPHIR_CONCAT_SVS(&_3$$4, "A dependency injection container is required to access the services related to the ODM in '", &_2$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_3$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Model.zep", 182); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); if (Z_TYPE_P(modelsManager) == IS_NULL) { - ZEPHIR_INIT_VAR(&_2$$5); - ZVAL_STRING(&_2$$5, "modelsManager"); - ZEPHIR_CALL_METHOD(&_1$$5, container, "getshared", NULL, 0, &_2$$5); + ZEPHIR_INIT_VAR(&_5$$5); + ZVAL_STRING(&_5$$5, "modelsManager"); + ZEPHIR_CALL_METHOD(&_4$$5, container, "getshared", NULL, 0, &_5$$5); zephir_check_call_status(); - ZEPHIR_CPY_WRT(modelsManager, &_1$$5); + ZEPHIR_CPY_WRT(modelsManager, &_4$$5); if (Z_TYPE_P(modelsManager) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/Mvc/Model.zep", 195); + ZEPHIR_INIT_VAR(&_6$$6); + object_init_ex(&_6$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$6); + zephir_get_class(&_7$$6, this_ptr, 0); + ZEPHIR_INIT_VAR(&_8$$6); + ZEPHIR_CONCAT_SVS(&_8$$6, "The injected service 'modelsManager' is not valid in '", &_7$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$6, "__construct", NULL, 32, &_8$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$6, "phalcon/Mvc/Model.zep", 195); + ZEPHIR_MM_RESTORE(); return; } } @@ -276,7 +300,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __call) zephir_get_arrval(&arguments, arguments_param); - ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 415, &method, &arguments); + ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 420, &method, &arguments); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&records)) { RETURN_CCTOR(&records); @@ -298,7 +322,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __call) object_init_ex(&_2, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_3); ZEPHIR_CONCAT_SVSVS(&_3, "The method '", &method, "' doesn't exist on model '", &modelName, "'"); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 29, &_3); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 32, &_3); zephir_check_call_status(); zephir_throw_exception_debug(&_2, "phalcon/Mvc/Model.zep", 264); ZEPHIR_MM_RESTORE(); @@ -342,7 +366,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __callStatic) zephir_get_arrval(&arguments, arguments_param); - ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 415, &method, &arguments); + ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 420, &method, &arguments); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&records)) { RETURN_CCTOR(&records); @@ -353,7 +377,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __callStatic) object_init_ex(&_1, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_SVSVS(&_2, "The method '", &method, "' doesn't exist on model '", &modelName, "'"); - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 29, &_2); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 32, &_2); zephir_check_call_status(); zephir_throw_exception_debug(&_1, "phalcon/Mvc/Model.zep", 290); ZEPHIR_MM_RESTORE(); @@ -573,12 +597,11 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) zval related; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *property_param = NULL, *value, value_sub, lowerProperty, modelName, manager, relation, referencedModel, item, dirtyState, _14, _15, _1$$3, _2$$4, _3$$4, _4$$6, _5$$7, _6$$8, _7$$9, _8$$9, *_9$$10, _10$$10, _11$$10, _12$$17, _13$$18, _16$$20, _17$$21; - zval property, _18$$21; + zval *property_param = NULL, *value, value_sub, lowerProperty, modelName, manager, relation, referencedModel, item, dirtyState, _14, _15, _1$$3, _2$$4, _3$$4, _4$$6, _5$$7, _6$$8, _7$$9, _8$$9, *_9$$10, _10$$10, _11$$10, _12$$17, _13$$18, _16$$20, _17$$21, _18$$21, _19$$21; + zval property; zval *this_ptr = getThis(); ZVAL_UNDEF(&property); - ZVAL_UNDEF(&_18$$21); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&lowerProperty); ZVAL_UNDEF(&modelName); @@ -603,6 +626,8 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) ZVAL_UNDEF(&_13$$18); ZVAL_UNDEF(&_16$$20); ZVAL_UNDEF(&_17$$21); + ZVAL_UNDEF(&_18$$21); + ZVAL_UNDEF(&_19$$21); ZVAL_UNDEF(&related); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -739,13 +764,13 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) } } - ZEPHIR_CALL_METHOD(&_14, this_ptr, "possiblesetter", NULL, 416, &property, value); + ZEPHIR_CALL_METHOD(&_14, this_ptr, "possiblesetter", NULL, 421, &property, value); zephir_check_call_status(); if (zephir_is_true(&_14)) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_15, "property_exists", NULL, 286, this_ptr, &property); + ZEPHIR_CALL_FUNCTION(&_15, "property_exists", NULL, 289, this_ptr, &property); zephir_check_call_status(); if (zephir_is_true(&_15)) { ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", NULL, 0); @@ -756,8 +781,10 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) ZEPHIR_INIT_VAR(&_17$$21); object_init_ex(&_17$$21, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_18$$21); - ZEPHIR_CONCAT_SVS(&_18$$21, "Cannot access property '", &property, "' (not public)."); - ZEPHIR_CALL_METHOD(NULL, &_17$$21, "__construct", NULL, 29, &_18$$21); + zephir_get_class(&_18$$21, this_ptr, 0); + ZEPHIR_INIT_VAR(&_19$$21); + ZEPHIR_CONCAT_SVSVS(&_19$$21, "Cannot access property '", &property, "' (not public) in '", &_18$$21, "'"); + ZEPHIR_CALL_METHOD(NULL, &_17$$21, "__construct", NULL, 32, &_19$$21); zephir_check_call_status(); zephir_throw_exception_debug(&_17$$21, "phalcon/Mvc/Model.zep", 522); ZEPHIR_MM_RESTORE(); @@ -774,12 +801,12 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) */ PHP_METHOD(Phalcon_Mvc_Model, __unserialize) { - zend_string *_7$$6; - zend_ulong _6$$6; + zend_string *_13$$6; + zend_ulong _12$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL; - zval *data_param = NULL, container, manager, key, value, snapshot, properties, dirtyState, _2, _3, _0$$3, *_4$$6, _5$$6; + zval *data_param = NULL, container, manager, key, value, snapshot, properties, dirtyState, _5, _6, _0$$3, _2$$4, _3$$4, _4$$4, _7$$5, _8$$5, _9$$5, *_10$$6, _11$$6; zval data; zval *this_ptr = getThis(); @@ -791,10 +818,16 @@ PHP_METHOD(Phalcon_Mvc_Model, __unserialize) ZVAL_UNDEF(&snapshot); ZVAL_UNDEF(&properties); ZVAL_UNDEF(&dirtyState); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_8$$5); + ZVAL_UNDEF(&_9$$5); + ZVAL_UNDEF(&_11$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -817,17 +850,35 @@ PHP_METHOD(Phalcon_Mvc_Model, __unserialize) ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_1, 0); zephir_check_call_status(); if (Z_TYPE_P(&container) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ODM", "phalcon/Mvc/Model.zep", 551); + ZEPHIR_INIT_VAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$4); + zephir_get_class(&_3$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_4$$4); + ZEPHIR_CONCAT_SVS(&_4$$4, "A dependency injection container is required to access the services related to the ODM in '", &_3$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 32, &_4$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$4, "phalcon/Mvc/Model.zep", 551); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &container); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "modelsManager"); - ZEPHIR_CALL_METHOD(&_2, &container, "getshared", NULL, 0, &_3); + ZEPHIR_INIT_VAR(&_6); + ZVAL_STRING(&_6, "modelsManager"); + ZEPHIR_CALL_METHOD(&_5, &container, "getshared", NULL, 0, &_6); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&manager, &_2); + ZEPHIR_CPY_WRT(&manager, &_5); if (Z_TYPE_P(&manager) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/Mvc/Model.zep", 566); + ZEPHIR_INIT_VAR(&_7$$5); + object_init_ex(&_7$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_8$$5); + zephir_get_class(&_8$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_9$$5); + ZEPHIR_CONCAT_SVS(&_9$$5, "The injected service 'modelsManager' is not valid in '", &_8$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", NULL, 32, &_9$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_7$$5, "phalcon/Mvc/Model.zep", 566); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("modelsManager"), &manager); @@ -837,25 +888,25 @@ PHP_METHOD(Phalcon_Mvc_Model, __unserialize) if (zephir_array_isset_string_fetch(&properties, &data, SL("attributes"), 0)) { zephir_is_iterable(&properties, 0, "phalcon/Mvc/Model.zep", 589); if (Z_TYPE_P(&properties) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _6$$6, _7$$6, _4$$6) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _12$$6, _13$$6, _10$$6) { ZEPHIR_INIT_NVAR(&key); - if (_7$$6 != NULL) { - ZVAL_STR_COPY(&key, _7$$6); + if (_13$$6 != NULL) { + ZVAL_STR_COPY(&key, _13$$6); } else { - ZVAL_LONG(&key, _6$$6); + ZVAL_LONG(&key, _12$$6); } ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _4$$6); + ZVAL_COPY(&value, _10$$6); zephir_update_property_zval_zval(this_ptr, &key, &value); } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_5$$6, &properties, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_11$$6, &properties, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_5$$6)) { + if (!zend_is_true(&_11$$6)) { break; } ZEPHIR_CALL_METHOD(&key, &properties, "key", NULL, 0); @@ -877,9 +928,9 @@ PHP_METHOD(Phalcon_Mvc_Model, __unserialize) if (zephir_array_isset_string_fetch(&dirtyState, &data, SL("dirtyState"), 0)) { zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &dirtyState); } - ZEPHIR_CALL_METHOD(&_2, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + ZEPHIR_CALL_METHOD(&_5, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); - if (zephir_is_true(&_2)) { + if (zephir_is_true(&_5)) { if (zephir_array_isset_string_fetch(&snapshot, &data, SL("snapshot"), 1)) { zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); } else { @@ -1047,13 +1098,13 @@ PHP_METHOD(Phalcon_Mvc_Model, appendMessage) */ PHP_METHOD(Phalcon_Mvc_Model, assign) { - zend_bool _7$$12, _13$$18, _16$$22, _20$$28; + zend_bool _7$$12, _14$$18, _17$$22, _22$$28; zend_string *_3$$3; zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_9 = NULL, *_12 = NULL, *_15 = NULL; + zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL, *_16 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *whiteList = NULL, whiteList_sub, *dataColumnMap = NULL, dataColumnMap_sub, __$null, key, keyMapped, value, attribute, attributeField, metaData, columnMap, disableAssignSetters, _4, *_5, _6, *_0$$3, _1$$3, _8$$13, _10$$16, _11$$16, _14$$18, _17$$23, _18$$26, _19$$26, _21$$28; + zval *data_param = NULL, *whiteList = NULL, whiteList_sub, *dataColumnMap = NULL, dataColumnMap_sub, __$null, key, keyMapped, value, attribute, attributeField, metaData, columnMap, disableAssignSetters, _4, *_5, _6, *_0$$3, _1$$3, _8$$13, _10$$16, _11$$16, _12$$16, _15$$18, _18$$23, _19$$26, _20$$26, _21$$26, _23$$28; zval data, dataMapped; zval *this_ptr = getThis(); @@ -1076,11 +1127,13 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) ZVAL_UNDEF(&_8$$13); ZVAL_UNDEF(&_10$$16); ZVAL_UNDEF(&_11$$16); - ZVAL_UNDEF(&_14$$18); - ZVAL_UNDEF(&_17$$23); - ZVAL_UNDEF(&_18$$26); + ZVAL_UNDEF(&_12$$16); + ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&_18$$23); ZVAL_UNDEF(&_19$$26); - ZVAL_UNDEF(&_21$$28); + ZVAL_UNDEF(&_20$$26); + ZVAL_UNDEF(&_21$$26); + ZVAL_UNDEF(&_23$$28); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) @@ -1178,7 +1231,7 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) _7$$12 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } if (_7$$12) { - ZEPHIR_CALL_SELF(&_8$$13, "caseinsensitivecolumnmap", &_9, 417, &columnMap, &attribute); + ZEPHIR_CALL_SELF(&_8$$13, "caseinsensitivecolumnmap", &_9, 422, &columnMap, &attribute); zephir_check_call_status(); ZEPHIR_CPY_WRT(&attribute, &_8$$13); } @@ -1189,8 +1242,10 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) ZEPHIR_INIT_NVAR(&_10$$16); object_init_ex(&_10$$16, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_11$$16); - ZEPHIR_CONCAT_SVS(&_11$$16, "Column '", &attribute, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_10$$16, "__construct", &_12, 29, &_11$$16); + zephir_get_class(&_11$$16, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_12$$16); + ZEPHIR_CONCAT_SVSVS(&_12$$16, "Column '", &attribute, "' doesn't make part of the column map in '", &_11$$16, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$16, "__construct", &_13, 32, &_12$$16); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$16, "phalcon/Mvc/Model.zep", 780); ZEPHIR_MM_RESTORE(); @@ -1208,13 +1263,13 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) continue; } } - _13$$18 = zephir_is_true(&disableAssignSetters); - if (!(_13$$18)) { - ZEPHIR_CALL_METHOD(&_14$$18, this_ptr, "possiblesetter", &_15, 416, &attributeField, &value); + _14$$18 = zephir_is_true(&disableAssignSetters); + if (!(_14$$18)) { + ZEPHIR_CALL_METHOD(&_15$$18, this_ptr, "possiblesetter", &_16, 421, &attributeField, &value); zephir_check_call_status(); - _13$$18 = !zephir_is_true(&_14$$18); + _14$$18 = !zephir_is_true(&_15$$18); } - if (_13$$18) { + if (_14$$18) { zephir_update_property_zval_zval(this_ptr, &attributeField, &value); } } @@ -1230,26 +1285,28 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) } ZEPHIR_CALL_METHOD(&attribute, &_4, "current", NULL, 0); zephir_check_call_status(); - _16$$22 = !(zephir_array_isset(&columnMap, &attribute)); - if (_16$$22) { - _16$$22 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + _17$$22 = !(zephir_array_isset(&columnMap, &attribute)); + if (_17$$22) { + _17$$22 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } - if (_16$$22) { - ZEPHIR_CALL_SELF(&_17$$23, "caseinsensitivecolumnmap", &_9, 417, &columnMap, &attribute); + if (_17$$22) { + ZEPHIR_CALL_SELF(&_18$$23, "caseinsensitivecolumnmap", &_9, 422, &columnMap, &attribute); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&attribute, &_17$$23); + ZEPHIR_CPY_WRT(&attribute, &_18$$23); } if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_18$$26); - object_init_ex(&_18$$26, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_19$$26); - ZEPHIR_CONCAT_SVS(&_19$$26, "Column '", &attribute, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_18$$26, "__construct", &_12, 29, &_19$$26); + object_init_ex(&_19$$26, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$26); + zephir_get_class(&_20$$26, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_21$$26); + ZEPHIR_CONCAT_SVSVS(&_21$$26, "Column '", &attribute, "' doesn't make part of the column map in '", &_20$$26, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$26, "__construct", &_13, 32, &_21$$26); zephir_check_call_status(); - zephir_throw_exception_debug(&_18$$26, "phalcon/Mvc/Model.zep", 780); + zephir_throw_exception_debug(&_19$$26, "phalcon/Mvc/Model.zep", 780); ZEPHIR_MM_RESTORE(); return; } @@ -1265,13 +1322,13 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) continue; } } - _20$$28 = zephir_is_true(&disableAssignSetters); - if (!(_20$$28)) { - ZEPHIR_CALL_METHOD(&_21$$28, this_ptr, "possiblesetter", &_15, 416, &attributeField, &value); + _22$$28 = zephir_is_true(&disableAssignSetters); + if (!(_22$$28)) { + ZEPHIR_CALL_METHOD(&_23$$28, this_ptr, "possiblesetter", &_16, 421, &attributeField, &value); zephir_check_call_status(); - _20$$28 = !zephir_is_true(&_21$$28); + _22$$28 = !zephir_is_true(&_23$$28); } - if (_20$$28) { + if (_22$$28) { zephir_update_property_zval_zval(this_ptr, &attributeField, &value); } } @@ -1377,9 +1434,10 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) zend_string *_4; zend_ulong _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_8 = NULL; zend_long dirtyState, ZEPHIR_LAST_CALL_STATUS; zval data; - zval *base, base_sub, *data_param = NULL, *dirtyState_param = NULL, instance, key, value, _0, *_1, _2, _5; + zval *base, base_sub, *data_param = NULL, *dirtyState_param = NULL, instance, key, value, _0, *_1, _2, _12, _5$$4, _6$$4, _7$$4, _9$$6, _10$$6, _11$$6; zval *this_ptr = getThis(); ZVAL_UNDEF(&base_sub); @@ -1388,7 +1446,13 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$6); ZVAL_UNDEF(&data); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -1431,7 +1495,16 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) ZEPHIR_INIT_NVAR(&value); ZVAL_COPY(&value, _1); if (UNEXPECTED(Z_TYPE_P(&key) != IS_STRING)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid key in array data provided to dumpResult()", "phalcon/Mvc/Model.zep", 886); + ZEPHIR_INIT_NVAR(&_5$$4); + object_init_ex(&_5$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_6$$4); + zephir_get_class(&_6$$4, base, 0); + ZEPHIR_INIT_NVAR(&_7$$4); + ZEPHIR_CONCAT_SVS(&_7$$4, "Invalid key in array data provided to dumpResult() in '", &_6$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", &_8, 32, &_7$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_5$$4, "phalcon/Mvc/Model.zep", 886); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval_zval(&instance, &key, &value); @@ -1450,7 +1523,16 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&key) != IS_STRING)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid key in array data provided to dumpResult()", "phalcon/Mvc/Model.zep", 886); + ZEPHIR_INIT_NVAR(&_9$$6); + object_init_ex(&_9$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_10$$6); + zephir_get_class(&_10$$6, base, 0); + ZEPHIR_INIT_NVAR(&_11$$6); + ZEPHIR_CONCAT_SVS(&_11$$6, "Invalid key in array data provided to dumpResult() in '", &_10$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_9$$6, "__construct", &_8, 32, &_11$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_9$$6, "phalcon/Mvc/Model.zep", 886); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval_zval(&instance, &key, &value); @@ -1460,9 +1542,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) } ZEPHIR_INIT_NVAR(&value); ZEPHIR_INIT_NVAR(&key); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, "afterFetch"); - ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_5); + ZEPHIR_INIT_VAR(&_12); + ZVAL_STRING(&_12, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_12); zephir_check_call_status(); RETURN_CCTOR(&instance); } @@ -1493,11 +1575,11 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) zend_string *_4; zend_ulong _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_8 = NULL, *_14 = NULL; - zend_bool keepSnapshots, _5$$6, _11$$3, _16$$24, _21$$21; + zephir_fcall_cache_entry *_9 = NULL, *_16 = NULL; + zend_bool keepSnapshots, _5$$6, _13$$3, _18$$24, _25$$21; zend_long dirtyState, ZEPHIR_LAST_CALL_STATUS; zval data; - zval *base, base_sub, *data_param = NULL, *columnMap, columnMap_sub, *dirtyState_param = NULL, *keepSnapshots_param = NULL, instance, attribute, key, value, castValue, attributeName, metaData, reverseMap, _0, *_1, _2, _6$$9, _7$$9, _9$$11, _10$$11, _12$$13, _13$$14, _15$$18, _17$$27, _18$$27, _19$$29, _20$$29, _22$$31, _23$$32, _24$$36, _25$$40; + zval *base, base_sub, *data_param = NULL, *columnMap, columnMap_sub, *dirtyState_param = NULL, *keepSnapshots_param = NULL, instance, attribute, key, value, castValue, attributeName, metaData, reverseMap, _0, *_1, _2, _6$$9, _7$$9, _8$$9, _10$$11, _11$$11, _12$$11, _14$$13, _15$$14, _17$$18, _19$$27, _20$$27, _21$$27, _22$$29, _23$$29, _24$$29, _26$$31, _27$$32, _28$$36, _29$$40; zval *this_ptr = getThis(); ZVAL_UNDEF(&base_sub); @@ -1514,19 +1596,23 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_6$$9); ZVAL_UNDEF(&_7$$9); - ZVAL_UNDEF(&_9$$11); + ZVAL_UNDEF(&_8$$9); ZVAL_UNDEF(&_10$$11); - ZVAL_UNDEF(&_12$$13); - ZVAL_UNDEF(&_13$$14); - ZVAL_UNDEF(&_15$$18); - ZVAL_UNDEF(&_17$$27); - ZVAL_UNDEF(&_18$$27); - ZVAL_UNDEF(&_19$$29); - ZVAL_UNDEF(&_20$$29); - ZVAL_UNDEF(&_22$$31); - ZVAL_UNDEF(&_23$$32); - ZVAL_UNDEF(&_24$$36); - ZVAL_UNDEF(&_25$$40); + ZVAL_UNDEF(&_11$$11); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$14); + ZVAL_UNDEF(&_17$$18); + ZVAL_UNDEF(&_19$$27); + ZVAL_UNDEF(&_20$$27); + ZVAL_UNDEF(&_21$$27); + ZVAL_UNDEF(&_22$$29); + ZVAL_UNDEF(&_23$$29); + ZVAL_UNDEF(&_24$$29); + ZVAL_UNDEF(&_26$$31); + ZVAL_UNDEF(&_27$$32); + ZVAL_UNDEF(&_28$$36); + ZVAL_UNDEF(&_29$$40); ZVAL_UNDEF(&data); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -1599,8 +1685,10 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) ZEPHIR_INIT_NVAR(&_6$$9); object_init_ex(&_6$$9, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_7$$9); - ZEPHIR_CONCAT_SVS(&_7$$9, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_6$$9, "__construct", &_8, 29, &_7$$9); + zephir_get_class(&_7$$9, base, 0); + ZEPHIR_INIT_NVAR(&_8$$9); + ZEPHIR_CONCAT_SVSVS(&_8$$9, "Column '", &key, "' doesn't make part of the column map in '", &_7$$9, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$9, "__construct", &_9, 32, &_8$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$9, "phalcon/Mvc/Model.zep", 956); ZEPHIR_MM_RESTORE(); @@ -1610,13 +1698,15 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) } } else { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_9$$11); - object_init_ex(&_9$$11, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_10$$11); - ZEPHIR_CONCAT_SVS(&_10$$11, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_9$$11, "__construct", &_8, 29, &_10$$11); + object_init_ex(&_10$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$11); + zephir_get_class(&_11$$11, base, 0); + ZEPHIR_INIT_NVAR(&_12$$11); + ZEPHIR_CONCAT_SVSVS(&_12$$11, "Column '", &key, "' doesn't make part of the column map in '", &_11$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$11, "__construct", &_9, 32, &_12$$11); zephir_check_call_status(); - zephir_throw_exception_debug(&_9$$11, "phalcon/Mvc/Model.zep", 965); + zephir_throw_exception_debug(&_10$$11, "phalcon/Mvc/Model.zep", 965); ZEPHIR_MM_RESTORE(); return; } @@ -1627,25 +1717,25 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) zephir_update_property_zval_zval(&instance, &attribute, &value); continue; } - _11$$3 = !ZEPHIR_IS_STRING(&value, ""); - if (_11$$3) { - _11$$3 = Z_TYPE_P(&value) != IS_NULL; + _13$$3 = !ZEPHIR_IS_STRING(&value, ""); + if (_13$$3) { + _13$$3 = Z_TYPE_P(&value) != IS_NULL; } - if (_11$$3) { - zephir_array_fetch_long(&_12$$13, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); + if (_13$$3) { + zephir_array_fetch_long(&_14$$13, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); do { - if (ZEPHIR_IS_LONG(&_12$$13, 0) || ZEPHIR_IS_LONG(&_12$$13, 21) || ZEPHIR_IS_LONG(&_12$$13, 22) || ZEPHIR_IS_LONG(&_12$$13, 26)) { - ZVAL_LONG(&_13$$14, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_14, 38, &value, &_13$$14); + if (ZEPHIR_IS_LONG(&_14$$13, 0) || ZEPHIR_IS_LONG(&_14$$13, 21) || ZEPHIR_IS_LONG(&_14$$13, 22) || ZEPHIR_IS_LONG(&_14$$13, 26)) { + ZVAL_LONG(&_15$$14, 10); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_16, 41, &value, &_15$$14); zephir_check_call_status(); break; } - if (ZEPHIR_IS_LONG(&_12$$13, 3) || ZEPHIR_IS_LONG(&_12$$13, 9) || ZEPHIR_IS_LONG(&_12$$13, 7)) { + if (ZEPHIR_IS_LONG(&_14$$13, 3) || ZEPHIR_IS_LONG(&_14$$13, 9) || ZEPHIR_IS_LONG(&_14$$13, 7)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_DOUBLE(&castValue, zephir_get_doubleval(&value)); break; } - if (ZEPHIR_IS_LONG(&_12$$13, 8)) { + if (ZEPHIR_IS_LONG(&_14$$13, 8)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); break; @@ -1655,9 +1745,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) } while(0); } else { - zephir_array_fetch_long(&_15$$18, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); + zephir_array_fetch_long(&_17$$18, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); do { - if (ZEPHIR_IS_LONG(&_15$$18, 14) || ZEPHIR_IS_LONG(&_15$$18, 8) || ZEPHIR_IS_LONG(&_15$$18, 3) || ZEPHIR_IS_LONG(&_15$$18, 9) || ZEPHIR_IS_LONG(&_15$$18, 7) || ZEPHIR_IS_LONG(&_15$$18, 0) || ZEPHIR_IS_LONG(&_15$$18, 21) || ZEPHIR_IS_LONG(&_15$$18, 22) || ZEPHIR_IS_LONG(&_15$$18, 26)) { + if (ZEPHIR_IS_LONG(&_17$$18, 14) || ZEPHIR_IS_LONG(&_17$$18, 8) || ZEPHIR_IS_LONG(&_17$$18, 3) || ZEPHIR_IS_LONG(&_17$$18, 9) || ZEPHIR_IS_LONG(&_17$$18, 7) || ZEPHIR_IS_LONG(&_17$$18, 0) || ZEPHIR_IS_LONG(&_17$$18, 21) || ZEPHIR_IS_LONG(&_17$$18, 22) || ZEPHIR_IS_LONG(&_17$$18, 26)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_NULL(&castValue); break; @@ -1694,11 +1784,11 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) } ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { - _16$$24 = Z_TYPE_P(columnMap) == IS_ARRAY; - if (_16$$24) { - _16$$24 = !(ZEPHIR_IS_EMPTY(columnMap)); + _18$$24 = Z_TYPE_P(columnMap) == IS_ARRAY; + if (_18$$24) { + _18$$24 = !(ZEPHIR_IS_EMPTY(columnMap)); } - if (_16$$24) { + if (_18$$24) { ZEPHIR_CALL_METHOD(&metaData, &instance, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&reverseMap, &metaData, "getreversecolumnmap", NULL, 0, &instance); @@ -1706,13 +1796,15 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_fetch(&attribute, &reverseMap, &key, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_17$$27); - object_init_ex(&_17$$27, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_18$$27); - ZEPHIR_CONCAT_SVS(&_18$$27, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_17$$27, "__construct", &_8, 29, &_18$$27); + ZEPHIR_INIT_NVAR(&_19$$27); + object_init_ex(&_19$$27, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$27); + zephir_get_class(&_20$$27, base, 0); + ZEPHIR_INIT_NVAR(&_21$$27); + ZEPHIR_CONCAT_SVSVS(&_21$$27, "Column '", &key, "' doesn't make part of the column map in '", &_20$$27, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$27, "__construct", &_9, 32, &_21$$27); zephir_check_call_status(); - zephir_throw_exception_debug(&_17$$27, "phalcon/Mvc/Model.zep", 956); + zephir_throw_exception_debug(&_19$$27, "phalcon/Mvc/Model.zep", 956); ZEPHIR_MM_RESTORE(); return; } @@ -1720,13 +1812,15 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) } } else { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_19$$29); - object_init_ex(&_19$$29, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_20$$29); - ZEPHIR_CONCAT_SVS(&_20$$29, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_19$$29, "__construct", &_8, 29, &_20$$29); + ZEPHIR_INIT_NVAR(&_22$$29); + object_init_ex(&_22$$29, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_23$$29); + zephir_get_class(&_23$$29, base, 0); + ZEPHIR_INIT_NVAR(&_24$$29); + ZEPHIR_CONCAT_SVSVS(&_24$$29, "Column '", &key, "' doesn't make part of the column map in '", &_23$$29, "'"); + ZEPHIR_CALL_METHOD(NULL, &_22$$29, "__construct", &_9, 32, &_24$$29); zephir_check_call_status(); - zephir_throw_exception_debug(&_19$$29, "phalcon/Mvc/Model.zep", 965); + zephir_throw_exception_debug(&_22$$29, "phalcon/Mvc/Model.zep", 965); ZEPHIR_MM_RESTORE(); return; } @@ -1737,25 +1831,25 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) zephir_update_property_zval_zval(&instance, &attribute, &value); continue; } - _21$$21 = !ZEPHIR_IS_STRING(&value, ""); - if (_21$$21) { - _21$$21 = Z_TYPE_P(&value) != IS_NULL; + _25$$21 = !ZEPHIR_IS_STRING(&value, ""); + if (_25$$21) { + _25$$21 = Z_TYPE_P(&value) != IS_NULL; } - if (_21$$21) { - zephir_array_fetch_long(&_22$$31, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); + if (_25$$21) { + zephir_array_fetch_long(&_26$$31, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); do { - if (ZEPHIR_IS_LONG(&_22$$31, 0) || ZEPHIR_IS_LONG(&_22$$31, 21) || ZEPHIR_IS_LONG(&_22$$31, 22) || ZEPHIR_IS_LONG(&_22$$31, 26)) { - ZVAL_LONG(&_23$$32, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_14, 38, &value, &_23$$32); + if (ZEPHIR_IS_LONG(&_26$$31, 0) || ZEPHIR_IS_LONG(&_26$$31, 21) || ZEPHIR_IS_LONG(&_26$$31, 22) || ZEPHIR_IS_LONG(&_26$$31, 26)) { + ZVAL_LONG(&_27$$32, 10); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_16, 41, &value, &_27$$32); zephir_check_call_status(); break; } - if (ZEPHIR_IS_LONG(&_22$$31, 3) || ZEPHIR_IS_LONG(&_22$$31, 9) || ZEPHIR_IS_LONG(&_22$$31, 7)) { + if (ZEPHIR_IS_LONG(&_26$$31, 3) || ZEPHIR_IS_LONG(&_26$$31, 9) || ZEPHIR_IS_LONG(&_26$$31, 7)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_DOUBLE(&castValue, zephir_get_doubleval(&value)); break; } - if (ZEPHIR_IS_LONG(&_22$$31, 8)) { + if (ZEPHIR_IS_LONG(&_26$$31, 8)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); break; @@ -1765,9 +1859,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) } while(0); } else { - zephir_array_fetch_long(&_24$$36, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); + zephir_array_fetch_long(&_28$$36, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); do { - if (ZEPHIR_IS_LONG(&_24$$36, 14) || ZEPHIR_IS_LONG(&_24$$36, 8) || ZEPHIR_IS_LONG(&_24$$36, 3) || ZEPHIR_IS_LONG(&_24$$36, 9) || ZEPHIR_IS_LONG(&_24$$36, 7) || ZEPHIR_IS_LONG(&_24$$36, 0) || ZEPHIR_IS_LONG(&_24$$36, 21) || ZEPHIR_IS_LONG(&_24$$36, 22) || ZEPHIR_IS_LONG(&_24$$36, 26)) { + if (ZEPHIR_IS_LONG(&_28$$36, 14) || ZEPHIR_IS_LONG(&_28$$36, 8) || ZEPHIR_IS_LONG(&_28$$36, 3) || ZEPHIR_IS_LONG(&_28$$36, 9) || ZEPHIR_IS_LONG(&_28$$36, 7) || ZEPHIR_IS_LONG(&_28$$36, 0) || ZEPHIR_IS_LONG(&_28$$36, 21) || ZEPHIR_IS_LONG(&_28$$36, 22) || ZEPHIR_IS_LONG(&_28$$36, 26)) { ZEPHIR_INIT_NVAR(&castValue); ZVAL_NULL(&castValue); break; @@ -1794,9 +1888,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) zephir_check_call_status(); } if ((zephir_method_exists_ex(&instance, ZEND_STRL("fireevent")) == SUCCESS)) { - ZEPHIR_INIT_VAR(&_25$$40); - ZVAL_STRING(&_25$$40, "afterFetch"); - ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_25$$40); + ZEPHIR_INIT_VAR(&_29$$40); + ZVAL_STRING(&_29$$40, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_29$$40); zephir_check_call_status(); } RETURN_CCTOR(&instance); @@ -1860,7 +1954,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) } ZEPHIR_INIT_VAR(&hydrateArray); array_init(&hydrateArray); - zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 1113); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 1116); if (Z_TYPE_P(&data) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) { @@ -1881,7 +1975,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) _4$$7 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } if (_4$$7) { - ZEPHIR_CALL_SELF(&_5$$8, "caseinsensitivecolumnmap", &_6, 417, columnMap, &key); + ZEPHIR_CALL_SELF(&_5$$8, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); zephir_check_call_status(); ZEPHIR_CPY_WRT(&key, &_5$$8); } @@ -1892,9 +1986,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) object_init_ex(&_7$$10, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_8$$10); ZEPHIR_CONCAT_SVS(&_8$$10, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_7$$10, "__construct", &_9, 29, &_8$$10); + ZEPHIR_CALL_METHOD(NULL, &_7$$10, "__construct", &_9, 32, &_8$$10); zephir_check_call_status(); - zephir_throw_exception_debug(&_7$$10, "phalcon/Mvc/Model.zep", 1092); + zephir_throw_exception_debug(&_7$$10, "phalcon/Mvc/Model.zep", 1095); ZEPHIR_MM_RESTORE(); return; } @@ -1902,7 +1996,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) } if (Z_TYPE_P(&attribute) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeName); - zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1102); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1105); } else { ZEPHIR_CPY_WRT(&attributeName, &attribute); } @@ -1933,7 +2027,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) _10$$16 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } if (_10$$16) { - ZEPHIR_CALL_SELF(&_11$$17, "caseinsensitivecolumnmap", &_6, 417, columnMap, &key); + ZEPHIR_CALL_SELF(&_11$$17, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); zephir_check_call_status(); ZEPHIR_CPY_WRT(&key, &_11$$17); } @@ -1944,9 +2038,9 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) object_init_ex(&_12$$19, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_13$$19); ZEPHIR_CONCAT_SVS(&_13$$19, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_12$$19, "__construct", &_9, 29, &_13$$19); + ZEPHIR_CALL_METHOD(NULL, &_12$$19, "__construct", &_9, 32, &_13$$19); zephir_check_call_status(); - zephir_throw_exception_debug(&_12$$19, "phalcon/Mvc/Model.zep", 1092); + zephir_throw_exception_debug(&_12$$19, "phalcon/Mvc/Model.zep", 1095); ZEPHIR_MM_RESTORE(); return; } @@ -1954,7 +2048,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) } if (Z_TYPE_P(&attribute) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeName); - zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1102); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1105); } else { ZEPHIR_CPY_WRT(&attributeName, &attribute); } @@ -2009,7 +2103,7 @@ PHP_METHOD(Phalcon_Mvc_Model, collectRelatedToSave) ZEPHIR_CPY_WRT(&related, &_0); zephir_read_property(&_1, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&dirtyRelated, &_1); - zephir_is_iterable(&related, 0, "phalcon/Mvc/Model.zep", 1154); + zephir_is_iterable(&related, 0, "phalcon/Mvc/Model.zep", 1157); if (Z_TYPE_P(&related) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&related), _4, _5, _2) { @@ -2165,8 +2259,8 @@ PHP_METHOD(Phalcon_Mvc_Model, count) */ PHP_METHOD(Phalcon_Mvc_Model, create) { - zval _2$$3; - zval metaData, _0, _1, _3$$3, _4$$3, _5$$3, _6$$3; + zval _2$$3, _4$$3; + zval metaData, _0, _1, _3$$3, _5$$3, _6$$3, _7$$3, _8$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -2175,17 +2269,19 @@ PHP_METHOD(Phalcon_Mvc_Model, create) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$3); ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$3); ZEPHIR_MM_GROW(); ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getwriteconnection", NULL, 418); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getwriteconnection", NULL, 423); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &metaData, &_1); zephir_check_call_status(); @@ -2195,11 +2291,17 @@ PHP_METHOD(Phalcon_Mvc_Model, create) ZEPHIR_INIT_VAR(&_3$$3); object_init_ex(&_3$$3, phalcon_messages_message_ce); ZEPHIR_INIT_VAR(&_4$$3); - ZVAL_STRING(&_4$$3, "Record cannot be created because it already exists"); - ZVAL_NULL(&_5$$3); - ZEPHIR_INIT_VAR(&_6$$3); - ZVAL_STRING(&_6$$3, "InvalidCreateAttempt"); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 6, &_4$$3, &_5$$3, &_6$$3); + zephir_create_array(&_4$$3, 1, 0); + ZEPHIR_INIT_VAR(&_5$$3); + zephir_get_class(&_5$$3, this_ptr, 0); + zephir_array_update_string(&_4$$3, SL("model"), &_5$$3, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_5$$3); + ZVAL_STRING(&_5$$3, "Record cannot be created because it already exists"); + ZVAL_NULL(&_6$$3); + ZEPHIR_INIT_VAR(&_7$$3); + ZVAL_STRING(&_7$$3, "InvalidCreateAttempt"); + ZVAL_LONG(&_8$$3, 0); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 6, &_5$$3, &_6$$3, &_7$$3, &_8$$3, &_4$$3); zephir_check_call_status(); zephir_array_fast_append(&_2$$3, &_3$$3); zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_2$$3); @@ -2229,8 +2331,8 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) { zval values, bindTypes, conditions; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, metaData, writeConnection, primaryKeys, bindDataTypes, columnMap, attributeField, primaryKey, bindType, value, schema, source, table, success, _0, _1, *_3, _4, _27, _2$$3, _5$$9, _6$$9, _8$$11, _9$$11, _10$$13, _11$$13, _12$$8, _14$$8, _15$$15, _16$$15, _17$$17, _18$$17, _19$$19, _20$$19, _21$$14, _23$$14, _24$$20, _25$$20, _26$$20, _28$$25, _29$$28; - zephir_fcall_cache_entry *_7 = NULL, *_13 = NULL, *_22 = NULL; + zval __$true, __$false, metaData, writeConnection, primaryKeys, bindDataTypes, columnMap, attributeField, primaryKey, bindType, value, schema, source, table, success, _0, _1, *_6, _7, _35, _2$$3, _3$$7, _4$$7, _5$$7, _8$$9, _9$$9, _10$$9, _11$$11, _12$$11, _13$$11, _14$$13, _15$$13, _16$$13, _17$$8, _19$$8, _20$$15, _21$$15, _22$$15, _23$$17, _24$$17, _25$$17, _26$$19, _27$$19, _28$$19, _29$$14, _31$$14, _32$$20, _33$$20, _34$$20, _36$$25, _37$$28, _38$$29, _39$$29; + zephir_fcall_cache_entry *_18 = NULL, *_30 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -2251,30 +2353,41 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) ZVAL_UNDEF(&success); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_27); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_35); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_5$$9); - ZVAL_UNDEF(&_6$$9); - ZVAL_UNDEF(&_8$$11); - ZVAL_UNDEF(&_9$$11); - ZVAL_UNDEF(&_10$$13); - ZVAL_UNDEF(&_11$$13); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_14$$8); - ZVAL_UNDEF(&_15$$15); - ZVAL_UNDEF(&_16$$15); - ZVAL_UNDEF(&_17$$17); - ZVAL_UNDEF(&_18$$17); - ZVAL_UNDEF(&_19$$19); - ZVAL_UNDEF(&_20$$19); - ZVAL_UNDEF(&_21$$14); - ZVAL_UNDEF(&_23$$14); - ZVAL_UNDEF(&_24$$20); - ZVAL_UNDEF(&_25$$20); - ZVAL_UNDEF(&_26$$20); - ZVAL_UNDEF(&_28$$25); - ZVAL_UNDEF(&_29$$28); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_9$$9); + ZVAL_UNDEF(&_10$$9); + ZVAL_UNDEF(&_11$$11); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_13$$11); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$13); + ZVAL_UNDEF(&_16$$13); + ZVAL_UNDEF(&_17$$8); + ZVAL_UNDEF(&_19$$8); + ZVAL_UNDEF(&_20$$15); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_22$$15); + ZVAL_UNDEF(&_23$$17); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$17); + ZVAL_UNDEF(&_26$$19); + ZVAL_UNDEF(&_27$$19); + ZVAL_UNDEF(&_28$$19); + ZVAL_UNDEF(&_29$$14); + ZVAL_UNDEF(&_31$$14); + ZVAL_UNDEF(&_32$$20); + ZVAL_UNDEF(&_33$$20); + ZVAL_UNDEF(&_34$$20); + ZVAL_UNDEF(&_36$$25); + ZVAL_UNDEF(&_37$$28); + ZVAL_UNDEF(&_38$$29); + ZVAL_UNDEF(&_39$$29); ZVAL_UNDEF(&values); ZVAL_UNDEF(&bindTypes); ZVAL_UNDEF(&conditions); @@ -2284,7 +2397,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 418); + ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 423); zephir_check_call_status(); ZEPHIR_INIT_ZVAL_NREF(_0); ZVAL_LONG(&_0, 3); @@ -2293,7 +2406,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) array_init(&_1); zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_1); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "checkforeignkeysreverserestrict", NULL, 419); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "checkforeignkeysreverserestrict", NULL, 424); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_2$$3)) { RETURN_MM_BOOL(0); @@ -2317,37 +2430,50 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) ZVAL_NULL(&columnMap); } if (UNEXPECTED(!(zephir_fast_count_int(&primaryKeys)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/Mvc/Model.zep", 1307); + ZEPHIR_INIT_VAR(&_3$$7); + object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_4$$7); + zephir_get_class(&_4$$7, this_ptr, 0); + ZEPHIR_INIT_VAR(&_5$$7); + ZEPHIR_CONCAT_SVS(&_5$$7, "A primary key must be defined in the model in order to perform the operation in '", &_4$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", NULL, 32, &_5$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 1314); + ZEPHIR_MM_RESTORE(); return; } - zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 1355); + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 1363); if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _3) + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _6) { ZEPHIR_INIT_NVAR(&primaryKey); - ZVAL_COPY(&primaryKey, _3); + ZVAL_COPY(&primaryKey, _6); ZEPHIR_OBS_NVAR(&bindType); if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &primaryKey, 0)))) { - ZEPHIR_INIT_NVAR(&_5$$9); - object_init_ex(&_5$$9, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_6$$9); - ZEPHIR_CONCAT_SVS(&_6$$9, "Column '", &primaryKey, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", &_7, 29, &_6$$9); + ZEPHIR_INIT_NVAR(&_8$$9); + object_init_ex(&_8$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$9); + zephir_get_class(&_9$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$9); + ZEPHIR_CONCAT_SVSVS(&_10$$9, "Column '", &primaryKey, "' have not defined a bind data type in '", &_9$$9, "'"); + ZEPHIR_CALL_METHOD(NULL, &_8$$9, "__construct", NULL, 32, &_10$$9); zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$9, "phalcon/Mvc/Model.zep", 1321); + zephir_throw_exception_debug(&_8$$9, "phalcon/Mvc/Model.zep", 1328); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &primaryKey, 0)))) { - ZEPHIR_INIT_NVAR(&_8$$11); - object_init_ex(&_8$$11, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_9$$11); - ZEPHIR_CONCAT_SVS(&_9$$11, "Column '", &primaryKey, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_8$$11, "__construct", &_7, 29, &_9$$11); + ZEPHIR_INIT_NVAR(&_11$$11); + object_init_ex(&_11$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$11); + zephir_get_class(&_12$$11, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$11); + ZEPHIR_CONCAT_SVSVS(&_13$$11, "Column '", &primaryKey, "' isn't part of the column map in '", &_12$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$11, "__construct", NULL, 32, &_13$$11); zephir_check_call_status(); - zephir_throw_exception_debug(&_8$$11, "phalcon/Mvc/Model.zep", 1331); + zephir_throw_exception_debug(&_11$$11, "phalcon/Mvc/Model.zep", 1338); ZEPHIR_MM_RESTORE(); return; } @@ -2356,57 +2482,63 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) } ZEPHIR_OBS_NVAR(&value); if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)))) { - ZEPHIR_INIT_NVAR(&_10$$13); - object_init_ex(&_10$$13, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_11$$13); - ZEPHIR_CONCAT_SVS(&_11$$13, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set"); - ZEPHIR_CALL_METHOD(NULL, &_10$$13, "__construct", &_7, 29, &_11$$13); + ZEPHIR_INIT_NVAR(&_14$$13); + object_init_ex(&_14$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$13); + zephir_get_class(&_15$$13, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$13); + ZEPHIR_CONCAT_SVSVS(&_16$$13, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set in '", &_15$$13, "'"); + ZEPHIR_CALL_METHOD(NULL, &_14$$13, "__construct", NULL, 32, &_16$$13); zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$13, "phalcon/Mvc/Model.zep", 1344); + zephir_throw_exception_debug(&_14$$13, "phalcon/Mvc/Model.zep", 1352); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1350); - ZEPHIR_CALL_METHOD(&_12$$8, &writeConnection, "escapeidentifier", &_13, 0, &primaryKey); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1358); + ZEPHIR_CALL_METHOD(&_17$$8, &writeConnection, "escapeidentifier", &_18, 0, &primaryKey); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_14$$8); - ZEPHIR_CONCAT_VS(&_14$$8, &_12$$8, " = ?"); - zephir_array_append(&conditions, &_14$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1351); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1352); + ZEPHIR_INIT_NVAR(&_19$$8); + ZEPHIR_CONCAT_VS(&_19$$8, &_17$$8, " = ?"); + zephir_array_append(&conditions, &_19$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1359); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1360); } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_4, &primaryKeys, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_7, &primaryKeys, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_4)) { + if (!zend_is_true(&_7)) { break; } ZEPHIR_CALL_METHOD(&primaryKey, &primaryKeys, "current", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&bindType); if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &primaryKey, 0)))) { - ZEPHIR_INIT_NVAR(&_15$$15); - object_init_ex(&_15$$15, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_16$$15); - ZEPHIR_CONCAT_SVS(&_16$$15, "Column '", &primaryKey, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_15$$15, "__construct", &_7, 29, &_16$$15); + ZEPHIR_INIT_NVAR(&_20$$15); + object_init_ex(&_20$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$15); + zephir_get_class(&_21$$15, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_22$$15); + ZEPHIR_CONCAT_SVSVS(&_22$$15, "Column '", &primaryKey, "' have not defined a bind data type in '", &_21$$15, "'"); + ZEPHIR_CALL_METHOD(NULL, &_20$$15, "__construct", NULL, 32, &_22$$15); zephir_check_call_status(); - zephir_throw_exception_debug(&_15$$15, "phalcon/Mvc/Model.zep", 1321); + zephir_throw_exception_debug(&_20$$15, "phalcon/Mvc/Model.zep", 1328); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &primaryKey, 0)))) { - ZEPHIR_INIT_NVAR(&_17$$17); - object_init_ex(&_17$$17, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_18$$17); - ZEPHIR_CONCAT_SVS(&_18$$17, "Column '", &primaryKey, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_17$$17, "__construct", &_7, 29, &_18$$17); + ZEPHIR_INIT_NVAR(&_23$$17); + object_init_ex(&_23$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_24$$17); + zephir_get_class(&_24$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_25$$17); + ZEPHIR_CONCAT_SVSVS(&_25$$17, "Column '", &primaryKey, "' isn't part of the column map in '", &_24$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_23$$17, "__construct", NULL, 32, &_25$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_17$$17, "phalcon/Mvc/Model.zep", 1331); + zephir_throw_exception_debug(&_23$$17, "phalcon/Mvc/Model.zep", 1338); ZEPHIR_MM_RESTORE(); return; } @@ -2415,23 +2547,25 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) } ZEPHIR_OBS_NVAR(&value); if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)))) { - ZEPHIR_INIT_NVAR(&_19$$19); - object_init_ex(&_19$$19, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_20$$19); - ZEPHIR_CONCAT_SVS(&_20$$19, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set"); - ZEPHIR_CALL_METHOD(NULL, &_19$$19, "__construct", &_7, 29, &_20$$19); + ZEPHIR_INIT_NVAR(&_26$$19); + object_init_ex(&_26$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_27$$19); + zephir_get_class(&_27$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_28$$19); + ZEPHIR_CONCAT_SVSVS(&_28$$19, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set in '", &_27$$19, "'"); + ZEPHIR_CALL_METHOD(NULL, &_26$$19, "__construct", NULL, 32, &_28$$19); zephir_check_call_status(); - zephir_throw_exception_debug(&_19$$19, "phalcon/Mvc/Model.zep", 1344); + zephir_throw_exception_debug(&_26$$19, "phalcon/Mvc/Model.zep", 1352); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1350); - ZEPHIR_CALL_METHOD(&_21$$14, &writeConnection, "escapeidentifier", &_22, 0, &primaryKey); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1358); + ZEPHIR_CALL_METHOD(&_29$$14, &writeConnection, "escapeidentifier", &_30, 0, &primaryKey); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_23$$14); - ZEPHIR_CONCAT_VS(&_23$$14, &_21$$14, " = ?"); - zephir_array_append(&conditions, &_23$$14, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1351); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1352); + ZEPHIR_INIT_NVAR(&_31$$14); + ZEPHIR_CONCAT_VS(&_31$$14, &_29$$14, " = ?"); + zephir_array_append(&conditions, &_31$$14, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1359); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1360); ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); zephir_check_call_status(); } @@ -2443,21 +2577,21 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) } else { zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$false); } - ZEPHIR_INIT_VAR(&_25$$20); - ZVAL_STRING(&_25$$20, "beforeDelete"); - ZEPHIR_CALL_METHOD(&_24$$20, this_ptr, "fireeventcancel", NULL, 0, &_25$$20); + ZEPHIR_INIT_VAR(&_33$$20); + ZVAL_STRING(&_33$$20, "beforeDelete"); + ZEPHIR_CALL_METHOD(&_32$$20, this_ptr, "fireeventcancel", NULL, 0, &_33$$20); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_24$$20)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_32$$20)) { RETURN_MM_BOOL(0); } - zephir_read_property(&_26$$20, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_26$$20)) { + zephir_read_property(&_34$$20, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_34$$20)) { RETURN_MM_BOOL(1); } } - ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 420); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 421); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); zephir_check_call_status(); if (zephir_is_true(&schema)) { ZEPHIR_INIT_VAR(&table); @@ -2467,25 +2601,33 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) } else { ZEPHIR_CPY_WRT(&table, &source); } - ZEPHIR_INIT_VAR(&_27); - zephir_fast_join_str(&_27, SL(" AND "), &conditions); - ZEPHIR_CALL_METHOD(&success, &writeConnection, "delete", NULL, 0, &table, &_27, &values, &bindTypes); + ZEPHIR_INIT_VAR(&_35); + zephir_fast_join_str(&_35, SL(" AND "), &conditions); + ZEPHIR_CALL_METHOD(&success, &writeConnection, "delete", NULL, 0, &table, &_35, &values, &bindTypes); zephir_check_call_status(); if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_28$$25, this_ptr, "checkforeignkeysreversecascade", NULL, 422); + ZEPHIR_CALL_METHOD(&_36$$25, this_ptr, "checkforeignkeysreversecascade", NULL, 427); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_28$$25)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_36$$25)) { RETURN_MM_BOOL(0); } } if (ZEPHIR_GLOBAL(orm).events) { if (zephir_is_true(&success)) { - ZEPHIR_INIT_VAR(&_29$$28); - ZVAL_STRING(&_29$$28, "afterDelete"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_29$$28); + ZEPHIR_INIT_VAR(&_37$$28); + ZVAL_STRING(&_37$$28, "afterDelete"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_37$$28); zephir_check_call_status(); } } + if (zephir_is_true(&success)) { + ZEPHIR_INIT_VAR(&_38$$29); + array_init(&_38$$29); + zephir_update_property_zval(this_ptr, ZEND_STRL("related"), &_38$$29); + zephir_read_property(&_39$$29, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_39$$29, "clearreusableobjects", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_INIT_ZVAL_NREF(_0); ZVAL_LONG(&_0, 2); zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_0); @@ -2512,7 +2654,7 @@ PHP_METHOD(Phalcon_Mvc_Model, dump) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 423, this_ptr); + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 428, this_ptr); zephir_check_call_status(); RETURN_MM(); } @@ -2729,12 +2871,12 @@ PHP_METHOD(Phalcon_Mvc_Model, find) ZEPHIR_INIT_VAR(¶ms); array_init(¶ms); if (Z_TYPE_P(parameters) != IS_NULL) { - zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1616); + zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1633); } } else { ZEPHIR_CPY_WRT(¶ms, parameters); } - ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_0, 424, ¶ms); + ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_0, 429, ¶ms); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&resultset, &query, "execute", NULL, 0); zephir_check_call_status(); @@ -2838,17 +2980,20 @@ PHP_METHOD(Phalcon_Mvc_Model, findFirst) { zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_2 = NULL; - zval *parameters = NULL, parameters_sub, __$null, params, query, _3, _1$$5; + zval *parameters = NULL, parameters_sub, __$null, params, query, _6, _1$$5, _2$$6, _3$$6, _4$$6; zval *this_ptr = getThis(); ZVAL_UNDEF(¶meters_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&query); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_2$$6); + ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&_4$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) @@ -2881,14 +3026,23 @@ PHP_METHOD(Phalcon_Mvc_Model, findFirst) zephir_array_fast_append(&_1$$5, parameters); ZEPHIR_CPY_WRT(¶ms, &_1$$5); } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Parameters passed must be of type array, string, numeric or null", "phalcon/Mvc/Model.zep", 1740); + ZEPHIR_INIT_VAR(&_2$$6); + object_init_ex(&_2$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$6); + zephir_get_called_class(&_3$$6); + ZEPHIR_INIT_VAR(&_4$$6); + ZEPHIR_CONCAT_SVS(&_4$$6, "Parameters passed must be of type array, string, numeric or null in '", &_3$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$6, "__construct", NULL, 32, &_4$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$6, "phalcon/Mvc/Model.zep", 1757); + ZEPHIR_MM_RESTORE(); return; } - ZVAL_LONG(&_3, 1); - ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_2, 424, ¶ms, &_3); + ZVAL_LONG(&_6, 1); + ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_5, 429, ¶ms, &_6); zephir_check_call_status(); - ZVAL_BOOL(&_3, 1); - ZEPHIR_CALL_METHOD(NULL, &query, "setuniquerow", NULL, 0, &_3); + ZVAL_BOOL(&_6, 1); + ZEPHIR_CALL_METHOD(NULL, &query, "setuniquerow", NULL, 0, &_6); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(&query, "execute", NULL, 0); zephir_check_call_status(); @@ -3005,10 +3159,10 @@ PHP_METHOD(Phalcon_Mvc_Model, fireEventCancel) */ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) { - zend_string *_5; - zend_ulong _4; + zend_string *_8; + zend_ulong _7; zval changed; - zval metaData, name, snapshot, columnMap, allAttributes, value, _0, _1, *_2, _3, _6$$6, _7$$10; + zval metaData, name, snapshot, columnMap, allAttributes, value, _0, _4, *_5, _6, _1$$3, _2$$3, _3$$3, _9$$6, _10$$10; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -3020,10 +3174,13 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) ZVAL_UNDEF(&allAttributes); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$10); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$10); ZVAL_UNDEF(&changed); @@ -3032,7 +3189,16 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&snapshot, &_0); if (UNEXPECTED(Z_TYPE_P(&snapshot) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The 'keepSnapshots' option must be enabled to track changes", "phalcon/Mvc/Model.zep", 1826); + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The 'keepSnapshots' option must be enabled to track changes in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 1843); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); @@ -3047,31 +3213,31 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) } ZEPHIR_INIT_VAR(&changed); array_init(&changed); - ZEPHIR_INIT_VAR(&_1); - zephir_is_iterable(&allAttributes, 0, "phalcon/Mvc/Model.zep", 1884); + ZEPHIR_INIT_VAR(&_4); + zephir_is_iterable(&allAttributes, 0, "phalcon/Mvc/Model.zep", 1901); if (Z_TYPE_P(&allAttributes) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&allAttributes), _4, _5, _2) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&allAttributes), _7, _8, _5) { ZEPHIR_INIT_NVAR(&name); - if (_5 != NULL) { - ZVAL_STR_COPY(&name, _5); + if (_8 != NULL) { + ZVAL_STR_COPY(&name, _8); } else { - ZVAL_LONG(&name, _4); + ZVAL_LONG(&name, _7); } - ZEPHIR_INIT_NVAR(&_1); - ZVAL_COPY(&_1, _2); + ZEPHIR_INIT_NVAR(&_4); + ZVAL_COPY(&_4, _5); if (!(zephir_array_isset(&snapshot, &name))) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1859); + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1876); continue; } ZEPHIR_OBS_NVAR(&value); if (!(zephir_fetch_property_zval(&value, this_ptr, &name, PH_SILENT_CC))) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1869); + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1886); continue; } - zephir_array_fetch(&_6$$6, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1877); - if (!ZEPHIR_IS_IDENTICAL(&value, &_6$$6)) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1878); + zephir_array_fetch(&_9$$6, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1894); + if (!ZEPHIR_IS_IDENTICAL(&value, &_9$$6)) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1895); continue; } } ZEND_HASH_FOREACH_END(); @@ -3079,34 +3245,34 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) ZEPHIR_CALL_METHOD(NULL, &allAttributes, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_3, &allAttributes, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_6, &allAttributes, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_3)) { + if (!zend_is_true(&_6)) { break; } ZEPHIR_CALL_METHOD(&name, &allAttributes, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, &allAttributes, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&_4, &allAttributes, "current", NULL, 0); zephir_check_call_status(); if (!(zephir_array_isset(&snapshot, &name))) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1859); + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1876); continue; } ZEPHIR_OBS_NVAR(&value); if (!(zephir_fetch_property_zval(&value, this_ptr, &name, PH_SILENT_CC))) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1869); + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1886); continue; } - zephir_array_fetch(&_7$$10, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1877); - if (!ZEPHIR_IS_IDENTICAL(&value, &_7$$10)) { - zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1878); + zephir_array_fetch(&_10$$10, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1894); + if (!ZEPHIR_IS_IDENTICAL(&value, &_10$$10)) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1895); continue; } ZEPHIR_CALL_METHOD(NULL, &allAttributes, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&_1); + ZEPHIR_INIT_NVAR(&_4); ZEPHIR_INIT_NVAR(&name); RETURN_CTOR(&changed); } @@ -3210,7 +3376,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getMessages) ZEPHIR_INIT_VAR(&filtered); array_init(&filtered); zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("errorMessages"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_1$$3, 0, "phalcon/Mvc/Model.zep", 1941); + zephir_is_iterable(&_1$$3, 0, "phalcon/Mvc/Model.zep", 1958); if (Z_TYPE_P(&_1$$3) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_1$$3), _2$$3) { @@ -3219,7 +3385,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getMessages) ZEPHIR_CALL_METHOD(&_4$$4, &message, "getfield", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EQUAL(&_4$$4, filter)) { - zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1937); + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1954); } } ZEND_HASH_FOREACH_END(); } else { @@ -3236,7 +3402,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getMessages) ZEPHIR_CALL_METHOD(&_5$$6, &message, "getfield", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EQUAL(&_5$$6, filter)) { - zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1937); + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1954); } ZEPHIR_CALL_METHOD(NULL, &_1$$3, "next", NULL, 0); zephir_check_call_status(); @@ -3265,7 +3431,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsManager) */ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) { - zval metaData, container, _0$$3, _1$$3, _2$$3; + zval metaData, container, _0$$3, _1$$3, _2$$3, _3$$4, _4$$4, _5$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -3275,6 +3441,9 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$4); ZEPHIR_MM_GROW(); @@ -3290,7 +3459,16 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) zephir_check_call_status(); ZEPHIR_CPY_WRT(&metaData, &_1$$3); if (UNEXPECTED(Z_TYPE_P(&metaData) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsMetadata' is not valid", "phalcon/Mvc/Model.zep", 1975); + ZEPHIR_INIT_VAR(&_3$$4); + object_init_ex(&_3$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_4$$4); + zephir_get_class(&_4$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_5$$4); + ZEPHIR_CONCAT_SVS(&_5$$4, "The injected service 'modelsMetadata' is not valid in '", &_4$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_3$$4, "__construct", NULL, 32, &_5$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$4, "phalcon/Mvc/Model.zep", 1992); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("modelsMetaData"), &metaData); @@ -3434,9 +3612,9 @@ PHP_METHOD(Phalcon_Mvc_Model, getRelated) object_init_ex(&_2$$3, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_3$$3); ZEPHIR_CONCAT_SVSVS(&_3$$3, "There is no defined relations for the model '", &className, "' using alias '", &alias, "'"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 29, &_3$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 32, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "phalcon/Mvc/Model.zep", 2050); + zephir_throw_exception_debug(&_2$$3, "phalcon/Mvc/Model.zep", 2068); ZEPHIR_MM_RESTORE(); return; } @@ -3572,11 +3750,11 @@ PHP_METHOD(Phalcon_Mvc_Model, getSource) */ PHP_METHOD(Phalcon_Mvc_Model, getUpdatedFields) { - zend_bool _5$$6, _7$$8; - zend_string *_4; - zend_ulong _3; + zend_bool _11$$6, _13$$8; + zend_string *_10; + zend_ulong _9; zval updated; - zval name, snapshot, oldSnapshot, value, _0, *_1, _2, _6$$6, _8$$8; + zval name, snapshot, oldSnapshot, value, _0, *_7, _8, _1$$3, _2$$3, _3$$3, _4$$5, _5$$5, _6$$5, _12$$6, _14$$8; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -3586,9 +3764,15 @@ PHP_METHOD(Phalcon_Mvc_Model, getUpdatedFields) ZVAL_UNDEF(&oldSnapshot); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$8); ZVAL_UNDEF(&updated); @@ -3599,61 +3783,79 @@ PHP_METHOD(Phalcon_Mvc_Model, getUpdatedFields) zephir_read_property(&_0, this_ptr, ZEND_STRL("oldSnapshot"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&oldSnapshot, &_0); if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).update_snapshot_on_save))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The 'updateSnapshotOnSave' option must be enabled for this method to work properly", "phalcon/Mvc/Model.zep", 2174); + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 2192); + ZEPHIR_MM_RESTORE(); return; } if (UNEXPECTED(Z_TYPE_P(&snapshot) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The 'keepSnapshots' option must be enabled to track changes", "phalcon/Mvc/Model.zep", 2180); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The 'keepSnapshots' option must be enabled to track changes", "phalcon/Mvc/Model.zep", 2198); return; } zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); if (UNEXPECTED(!ZEPHIR_IS_LONG(&_0, 0))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Change checking cannot be performed because the object has not been persisted or is deleted", "phalcon/Mvc/Model.zep", 2189); + ZEPHIR_INIT_VAR(&_4$$5); + object_init_ex(&_4$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_5$$5); + zephir_get_class(&_5$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_6$$5); + ZEPHIR_CONCAT_SVS(&_6$$5, "Change checking cannot be performed because the object has not been persisted or is deleted in '", &_5$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_4$$5, "__construct", NULL, 32, &_6$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_4$$5, "phalcon/Mvc/Model.zep", 2207); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(&updated); array_init(&updated); - zephir_is_iterable(&snapshot, 0, "phalcon/Mvc/Model.zep", 2204); + zephir_is_iterable(&snapshot, 0, "phalcon/Mvc/Model.zep", 2222); if (Z_TYPE_P(&snapshot) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&snapshot), _3, _4, _1) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&snapshot), _9, _10, _7) { ZEPHIR_INIT_NVAR(&name); - if (_4 != NULL) { - ZVAL_STR_COPY(&name, _4); + if (_10 != NULL) { + ZVAL_STR_COPY(&name, _10); } else { - ZVAL_LONG(&name, _3); + ZVAL_LONG(&name, _9); } ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _1); - _5$$6 = !(zephir_array_isset(&oldSnapshot, &name)); - if (!(_5$$6)) { - zephir_array_fetch(&_6$$6, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2199); - _5$$6 = !ZEPHIR_IS_IDENTICAL(&value, &_6$$6); + ZVAL_COPY(&value, _7); + _11$$6 = !(zephir_array_isset(&oldSnapshot, &name)); + if (!(_11$$6)) { + zephir_array_fetch(&_12$$6, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2217); + _11$$6 = !ZEPHIR_IS_IDENTICAL(&value, &_12$$6); } - if (_5$$6) { - zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2200); + if (_11$$6) { + zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2218); } } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &snapshot, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_2, &snapshot, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_8, &snapshot, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_2)) { + if (!zend_is_true(&_8)) { break; } ZEPHIR_CALL_METHOD(&name, &snapshot, "key", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&value, &snapshot, "current", NULL, 0); zephir_check_call_status(); - _7$$8 = !(zephir_array_isset(&oldSnapshot, &name)); - if (!(_7$$8)) { - zephir_array_fetch(&_8$$8, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2199); - _7$$8 = !ZEPHIR_IS_IDENTICAL(&value, &_8$$8); + _13$$8 = !(zephir_array_isset(&oldSnapshot, &name)); + if (!(_13$$8)) { + zephir_array_fetch(&_14$$8, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2217); + _13$$8 = !ZEPHIR_IS_IDENTICAL(&value, &_14$$8); } - if (_7$$8) { - zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2200); + if (_13$$8) { + zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2218); } ZEPHIR_CALL_METHOD(NULL, &snapshot, "next", NULL, 0); zephir_check_call_status(); @@ -3780,7 +3982,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) RETURN_MM_BOOL(zephir_fast_in_array(fieldName, &changedFields)); } if (Z_TYPE_P(fieldName) == IS_ARRAY) { - ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 425, fieldName, &changedFields); + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 430, fieldName, &changedFields); zephir_check_call_status(); if (allFields) { RETURN_MM_BOOL(ZEPHIR_IS_EQUAL(&intersect, fieldName)); @@ -3853,7 +4055,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasUpdated) RETURN_MM_BOOL(zephir_fast_in_array(fieldName, &updatedFields)); } if (Z_TYPE_P(fieldName) == IS_ARRAY) { - ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 425, fieldName, &updatedFields); + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 430, fieldName, &updatedFields); zephir_check_call_status(); if (allFields) { RETURN_MM_BOOL(ZEPHIR_IS_EQUAL(&intersect, fieldName)); @@ -4068,12 +4270,12 @@ PHP_METHOD(Phalcon_Mvc_Model, query) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 426, container); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 431, container); zephir_check_call_status(); } ZEPHIR_INIT_VAR(&_3); zephir_get_called_class(&_3); - ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 427, &_3); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 432, &_3); zephir_check_call_status(); RETURN_CCTOR(&criteria); } @@ -4128,8 +4330,8 @@ PHP_METHOD(Phalcon_Mvc_Model, readAttribute) */ PHP_METHOD(Phalcon_Mvc_Model, refresh) { - zval fields, _9, _7$$9, _8$$10; - zval metaData, readConnection, schema, source, table, uniqueKey, tables, uniqueParams, dialect, row, attribute, manager, columnMap, _0, _1, _4, *_5, _6, _10, _11, _14, _2$$6, _3$$6, _12$$11, _13$$11; + zval fields, _18, _16$$9, _17$$10; + zval metaData, readConnection, schema, source, table, uniqueKey, tables, uniqueParams, dialect, row, attribute, manager, columnMap, _0, _4, _13, *_14, _15, _19, _20, _23, _1$$3, _2$$3, _3$$3, _5$$6, _9$$6, _6$$7, _7$$7, _8$$7, _10$$8, _11$$8, _12$$8, _21$$11, _22$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -4148,38 +4350,56 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) ZVAL_UNDEF(&manager); ZVAL_UNDEF(&columnMap); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_2$$6); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_12$$11); - ZVAL_UNDEF(&_13$$11); + ZVAL_UNDEF(&_13); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_19); + ZVAL_UNDEF(&_20); + ZVAL_UNDEF(&_23); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_21$$11); + ZVAL_UNDEF(&_22$$11); ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_7$$9); - ZVAL_UNDEF(&_8$$10); + ZVAL_UNDEF(&_18); + ZVAL_UNDEF(&_16$$9); + ZVAL_UNDEF(&_17$$10); ZEPHIR_MM_GROW(); zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); if (UNEXPECTED(!ZEPHIR_IS_LONG(&_0, 0))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/Mvc/Model.zep", 2455); + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The record cannot be refreshed because it does not exist or is deleted in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 2473); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 428); + ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 433); zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&manager, &_1); - ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 420); + zephir_read_property(&_4, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_4); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 421); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); zephir_check_call_status(); if (zephir_is_true(&schema)) { ZEPHIR_INIT_VAR(&table); @@ -4189,92 +4409,110 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) } else { ZEPHIR_CPY_WRT(&table, &source); } - zephir_read_property(&_1, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueKey, &_1); + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_4); if (!(zephir_is_true(&uniqueKey))) { - ZEPHIR_CALL_METHOD(&_2$$6, this_ptr, "has", NULL, 0, &metaData, &readConnection); + ZEPHIR_CALL_METHOD(&_5$$6, this_ptr, "has", NULL, 0, &metaData, &readConnection); zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_2$$6))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/Mvc/Model.zep", 2480); + if (UNEXPECTED(!zephir_is_true(&_5$$6))) { + ZEPHIR_INIT_VAR(&_6$$7); + object_init_ex(&_6$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$7); + zephir_get_class(&_7$$7, this_ptr, 0); + ZEPHIR_INIT_VAR(&_8$$7); + ZEPHIR_CONCAT_SVS(&_8$$7, "The record cannot be refreshed because it does not exist or is deleted in '", &_7$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", NULL, 32, &_8$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$7, "phalcon/Mvc/Model.zep", 2498); + ZEPHIR_MM_RESTORE(); return; } - zephir_read_property(&_3$$6, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueKey, &_3$$6); + zephir_read_property(&_9$$6, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_9$$6); } - zephir_read_property(&_1, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueParams, &_1); + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueParams, &_4); if (UNEXPECTED(Z_TYPE_P(&uniqueParams) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/Mvc/Model.zep", 2491); + ZEPHIR_INIT_VAR(&_10$$8); + object_init_ex(&_10$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_11$$8); + zephir_get_class(&_11$$8, this_ptr, 0); + ZEPHIR_INIT_VAR(&_12$$8); + ZEPHIR_CONCAT_SVS(&_12$$8, "The record cannot be refreshed because it does not exist or is deleted in '", &_11$$8, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$8, "__construct", NULL, 32, &_12$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$8, "phalcon/Mvc/Model.zep", 2509); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(&fields); array_init(&fields); - ZEPHIR_CALL_METHOD(&_4, &metaData, "getattributes", NULL, 0, this_ptr); + ZEPHIR_CALL_METHOD(&_13, &metaData, "getattributes", NULL, 0, this_ptr); zephir_check_call_status(); - zephir_is_iterable(&_4, 0, "phalcon/Mvc/Model.zep", 2506); - if (Z_TYPE_P(&_4) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_4), _5) + zephir_is_iterable(&_13, 0, "phalcon/Mvc/Model.zep", 2524); + if (Z_TYPE_P(&_13) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_13), _14) { ZEPHIR_INIT_NVAR(&attribute); - ZVAL_COPY(&attribute, _5); - ZEPHIR_INIT_NVAR(&_7$$9); - zephir_create_array(&_7$$9, 1, 0); - zephir_array_fast_append(&_7$$9, &attribute); - zephir_array_append(&fields, &_7$$9, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2500); + ZVAL_COPY(&attribute, _14); + ZEPHIR_INIT_NVAR(&_16$$9); + zephir_create_array(&_16$$9, 1, 0); + zephir_array_fast_append(&_16$$9, &attribute); + zephir_array_append(&fields, &_16$$9, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2518); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &_4, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_13, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_6, &_4, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_15, &_13, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_6)) { + if (!zend_is_true(&_15)) { break; } - ZEPHIR_CALL_METHOD(&attribute, &_4, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&attribute, &_13, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$10); - zephir_create_array(&_8$$10, 1, 0); - zephir_array_fast_append(&_8$$10, &attribute); - zephir_array_append(&fields, &_8$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2500); - ZEPHIR_CALL_METHOD(NULL, &_4, "next", NULL, 0); + ZEPHIR_INIT_NVAR(&_17$$10); + zephir_create_array(&_17$$10, 1, 0); + zephir_array_fast_append(&_17$$10, &attribute); + zephir_array_append(&fields, &_17$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2518); + ZEPHIR_CALL_METHOD(NULL, &_13, "next", NULL, 0); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(&attribute); ZEPHIR_CALL_METHOD(&dialect, &readConnection, "getdialect", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_9); - zephir_create_array(&_9, 3, 0); - zephir_array_update_string(&_9, SL("columns"), &fields, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_10, &readConnection, "escapeidentifier", NULL, 0, &table); + ZEPHIR_INIT_VAR(&_18); + zephir_create_array(&_18, 3, 0); + zephir_array_update_string(&_18, SL("columns"), &fields, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_19, &readConnection, "escapeidentifier", NULL, 0, &table); zephir_check_call_status(); - zephir_array_update_string(&_9, SL("tables"), &_10, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_9, SL("where"), &uniqueKey, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&tables, &dialect, "select", NULL, 0, &_9); + zephir_array_update_string(&_18, SL("tables"), &_19, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_18, SL("where"), &uniqueKey, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&tables, &dialect, "select", NULL, 0, &_18); zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_11, 2); - ZEPHIR_CALL_METHOD(&row, &readConnection, "fetchone", NULL, 0, &tables, &_11, &uniqueParams, &_1); + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_20, 2); + ZEPHIR_CALL_METHOD(&row, &readConnection, "fetchone", NULL, 0, &tables, &_20, &uniqueParams, &_4); zephir_check_call_status(); if (Z_TYPE_P(&row) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getcolumnmap", NULL, 0, this_ptr); zephir_check_call_status(); - ZVAL_NULL(&_12$$11); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "assign", NULL, 0, &row, &_12$$11, &columnMap); + ZVAL_NULL(&_21$$11); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "assign", NULL, 0, &row, &_21$$11, &columnMap); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_13$$11, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + ZEPHIR_CALL_METHOD(&_22$$11, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); - if (zephir_is_true(&_13$$11)) { + if (zephir_is_true(&_22$$11)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "setsnapshotdata", NULL, 0, &row, &columnMap); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "setoldsnapshotdata", NULL, 0, &row, &columnMap); zephir_check_call_status(); } } - ZEPHIR_INIT_VAR(&_14); - ZVAL_STRING(&_14, "afterFetch"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_14); + ZEPHIR_INIT_VAR(&_23); + ZVAL_STRING(&_23, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_23); zephir_check_call_status(); RETURN_THIS(); } @@ -4338,7 +4576,7 @@ PHP_METHOD(Phalcon_Mvc_Model, save) ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 418); + ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 423); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "prepareSave"); @@ -4354,9 +4592,9 @@ PHP_METHOD(Phalcon_Mvc_Model, save) RETURN_MM_BOOL(0); } } - ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 420); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 421); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); zephir_check_call_status(); if (zephir_is_true(&schema)) { ZEPHIR_INIT_VAR(&table); @@ -4366,7 +4604,7 @@ PHP_METHOD(Phalcon_Mvc_Model, save) } else { ZEPHIR_CPY_WRT(&table, &source); } - ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 428); + ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 433); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&exists, this_ptr, "has", NULL, 0, &metaData, &readConnection); zephir_check_call_status(); @@ -4397,9 +4635,9 @@ PHP_METHOD(Phalcon_Mvc_Model, save) object_init_ex(&_6$$11, phalcon_mvc_model_validationfailed_ce); ZEPHIR_CALL_METHOD(&_7$$11, this_ptr, "getmessages", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_6$$11, "__construct", NULL, 429, this_ptr, &_7$$11); + ZEPHIR_CALL_METHOD(NULL, &_6$$11, "__construct", NULL, 434, this_ptr, &_7$$11); zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$11, "phalcon/Mvc/Model.zep", 2657); + zephir_throw_exception_debug(&_6$$11, "phalcon/Mvc/Model.zep", 2675); ZEPHIR_MM_RESTORE(); return; } @@ -4515,12 +4753,12 @@ PHP_METHOD(Phalcon_Mvc_Model, serialize) */ PHP_METHOD(Phalcon_Mvc_Model, unserialize) { - zend_string *_7$$7; - zend_ulong _6$$7; + zend_string *_13$$7; + zend_ulong _12$$7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data, data_sub, attributes, container, manager, key, value, snapshot, properties, dirtyState, _0$$4, _2$$3, _3$$3, *_4$$7, _5$$7; + zval *data, data_sub, attributes, container, manager, key, value, snapshot, properties, dirtyState, _0$$4, _2$$5, _3$$5, _4$$5, _5$$3, _6$$3, _7$$6, _8$$6, _9$$6, *_10$$7, _11$$7; zval *this_ptr = getThis(); ZVAL_UNDEF(&data_sub); @@ -4533,9 +4771,15 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) ZVAL_UNDEF(&properties); ZVAL_UNDEF(&dirtyState); ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$6); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_11$$7); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -4560,17 +4804,35 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_1, 0); zephir_check_call_status(); if (Z_TYPE_P(&container) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ODM", "phalcon/Mvc/Model.zep", 2776); + ZEPHIR_INIT_VAR(&_2$$5); + object_init_ex(&_2$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$5); + zephir_get_class(&_3$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_4$$5); + ZEPHIR_CONCAT_SVS(&_4$$5, "A dependency injection container is required to access the services related to the ODM in '", &_3$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 32, &_4$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$5, "phalcon/Mvc/Model.zep", 2794); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &container); - ZEPHIR_INIT_VAR(&_3$$3); - ZVAL_STRING(&_3$$3, "modelsManager"); - ZEPHIR_CALL_METHOD(&_2$$3, &container, "getshared", NULL, 0, &_3$$3); + ZEPHIR_INIT_VAR(&_6$$3); + ZVAL_STRING(&_6$$3, "modelsManager"); + ZEPHIR_CALL_METHOD(&_5$$3, &container, "getshared", NULL, 0, &_6$$3); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&manager, &_2$$3); + ZEPHIR_CPY_WRT(&manager, &_5$$3); if (UNEXPECTED(Z_TYPE_P(&manager) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/Mvc/Model.zep", 2792); + ZEPHIR_INIT_VAR(&_7$$6); + object_init_ex(&_7$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_8$$6); + zephir_get_class(&_8$$6, this_ptr, 0); + ZEPHIR_INIT_VAR(&_9$$6); + ZEPHIR_CONCAT_SVS(&_9$$6, "The injected service 'modelsManager' is not valid in '", &_8$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", NULL, 32, &_9$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_7$$6, "phalcon/Mvc/Model.zep", 2810); + ZEPHIR_MM_RESTORE(); return; } zephir_update_property_zval(this_ptr, ZEND_STRL("modelsManager"), &manager); @@ -4578,27 +4840,27 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) zephir_check_call_status(); ZEPHIR_OBS_VAR(&properties); if (zephir_array_isset_string_fetch(&properties, &attributes, SL("attributes"), 0)) { - zephir_is_iterable(&properties, 0, "phalcon/Mvc/Model.zep", 2815); + zephir_is_iterable(&properties, 0, "phalcon/Mvc/Model.zep", 2833); if (Z_TYPE_P(&properties) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _6$$7, _7$$7, _4$$7) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _12$$7, _13$$7, _10$$7) { ZEPHIR_INIT_NVAR(&key); - if (_7$$7 != NULL) { - ZVAL_STR_COPY(&key, _7$$7); + if (_13$$7 != NULL) { + ZVAL_STR_COPY(&key, _13$$7); } else { - ZVAL_LONG(&key, _6$$7); + ZVAL_LONG(&key, _12$$7); } ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _4$$7); + ZVAL_COPY(&value, _10$$7); zephir_update_property_zval_zval(this_ptr, &key, &value); } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_5$$7, &properties, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_11$$7, &properties, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_5$$7)) { + if (!zend_is_true(&_11$$7)) { break; } ZEPHIR_CALL_METHOD(&key, &properties, "key", NULL, 0); @@ -4620,9 +4882,9 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) if (zephir_array_isset_string_fetch(&dirtyState, &attributes, SL("dirtyState"), 0)) { zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &dirtyState); } - ZEPHIR_CALL_METHOD(&_2$$3, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + ZEPHIR_CALL_METHOD(&_5$$3, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); - if (zephir_is_true(&_2$$3)) { + if (zephir_is_true(&_5$$3)) { if (zephir_array_isset_string_fetch(&snapshot, &attributes, SL("snapshot"), 1)) { zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); } else { @@ -4784,9 +5046,9 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) zend_string *_3$$3; zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _4$$7, _5$$7, _7$$10, _8$$10, _9$$14, _10$$14, _11$$17, _12$$17; + zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _4$$7, _5$$7, _6$$7, _8$$10, _9$$10, _10$$10, _11$$14, _12$$14, _13$$14, _14$$17, _15$$17, _16$$17; zval data, snapshot; zval *this_ptr = getThis(); @@ -4800,12 +5062,16 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_4$$7); ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_7$$10); + ZVAL_UNDEF(&_6$$7); ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_9$$14); - ZVAL_UNDEF(&_10$$14); - ZVAL_UNDEF(&_11$$17); - ZVAL_UNDEF(&_12$$17); + ZVAL_UNDEF(&_9$$10); + ZVAL_UNDEF(&_10$$10); + ZVAL_UNDEF(&_11$$14); + ZVAL_UNDEF(&_12$$14); + ZVAL_UNDEF(&_13$$14); + ZVAL_UNDEF(&_14$$17); + ZVAL_UNDEF(&_15$$17); + ZVAL_UNDEF(&_16$$17); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -4828,7 +5094,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) if (Z_TYPE_P(columnMap) == IS_ARRAY) { ZEPHIR_INIT_VAR(&snapshot); array_init(&snapshot); - zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 2933); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 2951); if (Z_TYPE_P(&data) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2$$3, _3$$3, _0$$3) { @@ -4849,10 +5115,12 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) ZEPHIR_INIT_NVAR(&_4$$7); object_init_ex(&_4$$7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_5$$7); - ZEPHIR_CONCAT_SVS(&_5$$7, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_4$$7, "__construct", &_6, 29, &_5$$7); + zephir_get_class(&_5$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_6$$7); + ZEPHIR_CONCAT_SVSVS(&_6$$7, "Column '", &key, "' doesn't make part of the column map in '", &_5$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_4$$7, "__construct", &_7, 32, &_6$$7); zephir_check_call_status(); - zephir_throw_exception_debug(&_4$$7, "phalcon/Mvc/Model.zep", 2913); + zephir_throw_exception_debug(&_4$$7, "phalcon/Mvc/Model.zep", 2931); ZEPHIR_MM_RESTORE(); return; } @@ -4862,13 +5130,15 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_7$$10); - object_init_ex(&_7$$10, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_8$$10); - ZEPHIR_CONCAT_SVS(&_8$$10, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_7$$10, "__construct", &_6, 29, &_8$$10); + object_init_ex(&_8$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$10); + zephir_get_class(&_9$$10, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$10); + ZEPHIR_CONCAT_SVSVS(&_10$$10, "Column '", &key, "' doesn't make part of the column map in '", &_9$$10, "'"); + ZEPHIR_CALL_METHOD(NULL, &_8$$10, "__construct", &_7, 32, &_10$$10); zephir_check_call_status(); - zephir_throw_exception_debug(&_7$$10, "phalcon/Mvc/Model.zep", 2924); + zephir_throw_exception_debug(&_8$$10, "phalcon/Mvc/Model.zep", 2942); ZEPHIR_MM_RESTORE(); return; } @@ -4896,13 +5166,15 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_9$$14); - object_init_ex(&_9$$14, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_10$$14); - ZEPHIR_CONCAT_SVS(&_10$$14, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_9$$14, "__construct", &_6, 29, &_10$$14); + ZEPHIR_INIT_NVAR(&_11$$14); + object_init_ex(&_11$$14, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$14); + zephir_get_class(&_12$$14, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$14); + ZEPHIR_CONCAT_SVSVS(&_13$$14, "Column '", &key, "' doesn't make part of the column map in '", &_12$$14, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$14, "__construct", &_7, 32, &_13$$14); zephir_check_call_status(); - zephir_throw_exception_debug(&_9$$14, "phalcon/Mvc/Model.zep", 2913); + zephir_throw_exception_debug(&_11$$14, "phalcon/Mvc/Model.zep", 2931); ZEPHIR_MM_RESTORE(); return; } @@ -4912,13 +5184,15 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_11$$17); - object_init_ex(&_11$$17, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_12$$17); - ZEPHIR_CONCAT_SVS(&_12$$17, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_11$$17, "__construct", &_6, 29, &_12$$17); + ZEPHIR_INIT_NVAR(&_14$$17); + object_init_ex(&_14$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$17); + zephir_get_class(&_15$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$17); + ZEPHIR_CONCAT_SVSVS(&_16$$17, "Column '", &key, "' doesn't make part of the column map in '", &_15$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_14$$17, "__construct", &_7, 32, &_16$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_11$$17, "phalcon/Mvc/Model.zep", 2924); + zephir_throw_exception_debug(&_14$$17, "phalcon/Mvc/Model.zep", 2942); ZEPHIR_MM_RESTORE(); return; } @@ -4948,13 +5222,13 @@ PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) */ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) { - zend_bool _4$$4, _12$$12; + zend_bool _4$$4, _14$$12; zend_string *_3$$3; zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_9 = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _5$$6, _7$$8, _8$$8, _10$$11, _11$$11, _13$$14, _14$$16, _15$$16, _16$$19, _17$$19; + zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _5$$6, _7$$8, _8$$8, _9$$8, _11$$11, _12$$11, _13$$11, _15$$14, _16$$16, _17$$16, _18$$16, _19$$19, _20$$19, _21$$19; zval data, snapshot; zval *this_ptr = getThis(); @@ -4969,13 +5243,17 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) ZVAL_UNDEF(&_5$$6); ZVAL_UNDEF(&_7$$8); ZVAL_UNDEF(&_8$$8); - ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&_9$$8); ZVAL_UNDEF(&_11$$11); - ZVAL_UNDEF(&_13$$14); - ZVAL_UNDEF(&_14$$16); - ZVAL_UNDEF(&_15$$16); - ZVAL_UNDEF(&_16$$19); - ZVAL_UNDEF(&_17$$19); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_13$$11); + ZVAL_UNDEF(&_15$$14); + ZVAL_UNDEF(&_16$$16); + ZVAL_UNDEF(&_17$$16); + ZVAL_UNDEF(&_18$$16); + ZVAL_UNDEF(&_19$$19); + ZVAL_UNDEF(&_20$$19); + ZVAL_UNDEF(&_21$$19); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -4998,7 +5276,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) if (Z_TYPE_P(columnMap) == IS_ARRAY) { ZEPHIR_INIT_VAR(&snapshot); array_init(&snapshot); - zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 2998); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 3016); if (Z_TYPE_P(&data) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2$$3, _3$$3, _0$$3) { @@ -5018,7 +5296,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) _4$$4 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } if (_4$$4) { - ZEPHIR_CALL_SELF(&_5$$6, "caseinsensitivecolumnmap", &_6, 417, columnMap, &key); + ZEPHIR_CALL_SELF(&_5$$6, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); zephir_check_call_status(); ZEPHIR_CPY_WRT(&key, &_5$$6); } @@ -5028,10 +5306,12 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) ZEPHIR_INIT_NVAR(&_7$$8); object_init_ex(&_7$$8, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_8$$8); - ZEPHIR_CONCAT_SVS(&_8$$8, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_7$$8, "__construct", &_9, 29, &_8$$8); + zephir_get_class(&_8$$8, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_9$$8); + ZEPHIR_CONCAT_SVSVS(&_9$$8, "Column '", &key, "' doesn't make part of the column map in '", &_8$$8, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$8, "__construct", &_10, 32, &_9$$8); zephir_check_call_status(); - zephir_throw_exception_debug(&_7$$8, "phalcon/Mvc/Model.zep", 2978); + zephir_throw_exception_debug(&_7$$8, "phalcon/Mvc/Model.zep", 2996); ZEPHIR_MM_RESTORE(); return; } @@ -5041,13 +5321,15 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_10$$11); - object_init_ex(&_10$$11, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_11$$11); - ZEPHIR_CONCAT_SVS(&_11$$11, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_10$$11, "__construct", &_9, 29, &_11$$11); + object_init_ex(&_11$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$11); + zephir_get_class(&_12$$11, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$11); + ZEPHIR_CONCAT_SVSVS(&_13$$11, "Column '", &key, "' doesn't make part of the column map in '", &_12$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$11, "__construct", &_10, 32, &_13$$11); zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$11, "phalcon/Mvc/Model.zep", 2989); + zephir_throw_exception_debug(&_11$$11, "phalcon/Mvc/Model.zep", 3007); ZEPHIR_MM_RESTORE(); return; } @@ -5072,25 +5354,27 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) if (Z_TYPE_P(&key) != IS_STRING) { continue; } - _12$$12 = !(zephir_array_isset(columnMap, &key)); - if (_12$$12) { - _12$$12 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + _14$$12 = !(zephir_array_isset(columnMap, &key)); + if (_14$$12) { + _14$$12 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } - if (_12$$12) { - ZEPHIR_CALL_SELF(&_13$$14, "caseinsensitivecolumnmap", &_6, 417, columnMap, &key); + if (_14$$12) { + ZEPHIR_CALL_SELF(&_15$$14, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&key, &_13$$14); + ZEPHIR_CPY_WRT(&key, &_15$$14); } ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_14$$16); - object_init_ex(&_14$$16, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_15$$16); - ZEPHIR_CONCAT_SVS(&_15$$16, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_14$$16, "__construct", &_9, 29, &_15$$16); + ZEPHIR_INIT_NVAR(&_16$$16); + object_init_ex(&_16$$16, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$16); + zephir_get_class(&_17$$16, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_18$$16); + ZEPHIR_CONCAT_SVSVS(&_18$$16, "Column '", &key, "' doesn't make part of the column map in '", &_17$$16, "'"); + ZEPHIR_CALL_METHOD(NULL, &_16$$16, "__construct", &_10, 32, &_18$$16); zephir_check_call_status(); - zephir_throw_exception_debug(&_14$$16, "phalcon/Mvc/Model.zep", 2978); + zephir_throw_exception_debug(&_16$$16, "phalcon/Mvc/Model.zep", 2996); ZEPHIR_MM_RESTORE(); return; } @@ -5100,13 +5384,15 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) ZEPHIR_OBS_NVAR(&attribute); if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_16$$19); - object_init_ex(&_16$$19, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_17$$19); - ZEPHIR_CONCAT_SVS(&_17$$19, "Column '", &key, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_16$$19, "__construct", &_9, 29, &_17$$19); + ZEPHIR_INIT_NVAR(&_19$$19); + object_init_ex(&_19$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$19); + zephir_get_class(&_20$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_21$$19); + ZEPHIR_CONCAT_SVSVS(&_21$$19, "Column '", &key, "' doesn't make part of the column map in '", &_20$$19, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$19, "__construct", &_10, 32, &_21$$19); zephir_check_call_status(); - zephir_throw_exception_debug(&_16$$19, "phalcon/Mvc/Model.zep", 2989); + zephir_throw_exception_debug(&_19$$19, "phalcon/Mvc/Model.zep", 3007); ZEPHIR_MM_RESTORE(); return; } @@ -5446,12 +5732,12 @@ PHP_METHOD(Phalcon_Mvc_Model, sum) */ PHP_METHOD(Phalcon_Mvc_Model, toArray) { - zend_bool _3$$4, _9$$14; + zend_bool _3$$4, _10$$14; zval data; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL, *_8 = NULL; + zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *columns = NULL, columns_sub, __$null, metaData, columnMap, attribute, attributeField, value, _0, *_1, _2, _4$$5, _6$$7, _7$$7, _10$$15, _11$$17, _12$$17; + zval *columns = NULL, columns_sub, __$null, metaData, columnMap, attribute, attributeField, value, _0, *_1, _2, _4$$5, _6$$7, _7$$7, _8$$7, _11$$15, _12$$17, _13$$17, _14$$17; zval *this_ptr = getThis(); ZVAL_UNDEF(&columns_sub); @@ -5466,9 +5752,11 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) ZVAL_UNDEF(&_4$$5); ZVAL_UNDEF(&_6$$7); ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_10$$15); - ZVAL_UNDEF(&_11$$17); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_11$$15); ZVAL_UNDEF(&_12$$17); + ZVAL_UNDEF(&_13$$17); + ZVAL_UNDEF(&_14$$17); ZVAL_UNDEF(&data); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -5495,7 +5783,7 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, &metaData, "getattributes", NULL, 0, this_ptr); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 3275); + zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 3293); if (Z_TYPE_P(&_0) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) { @@ -5507,7 +5795,7 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) _3$$4 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } if (_3$$4) { - ZEPHIR_CALL_SELF(&_4$$5, "caseinsensitivecolumnmap", &_5, 417, &columnMap, &attribute); + ZEPHIR_CALL_SELF(&_4$$5, "caseinsensitivecolumnmap", &_5, 422, &columnMap, &attribute); zephir_check_call_status(); ZEPHIR_CPY_WRT(&attribute, &_4$$5); } @@ -5517,10 +5805,12 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) ZEPHIR_INIT_NVAR(&_6$$7); object_init_ex(&_6$$7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_7$$7); - ZEPHIR_CONCAT_SVS(&_7$$7, "Column '", &attribute, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", &_8, 29, &_7$$7); + zephir_get_class(&_7$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_8$$7); + ZEPHIR_CONCAT_SVSVS(&_8$$7, "Column '", &attribute, "' doesn't make part of the column map in '", &_7$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", &_9, 32, &_8$$7); zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$7, "phalcon/Mvc/Model.zep", 3253); + zephir_throw_exception_debug(&_6$$7, "phalcon/Mvc/Model.zep", 3271); ZEPHIR_MM_RESTORE(); return; } @@ -5553,25 +5843,27 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) ZEPHIR_CALL_METHOD(&attribute, &_0, "current", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&columnMap) == IS_ARRAY) { - _9$$14 = !(zephir_array_isset(&columnMap, &attribute)); - if (_9$$14) { - _9$$14 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + _10$$14 = !(zephir_array_isset(&columnMap, &attribute)); + if (_10$$14) { + _10$$14 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; } - if (_9$$14) { - ZEPHIR_CALL_SELF(&_10$$15, "caseinsensitivecolumnmap", &_5, 417, &columnMap, &attribute); + if (_10$$14) { + ZEPHIR_CALL_SELF(&_11$$15, "caseinsensitivecolumnmap", &_5, 422, &columnMap, &attribute); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&attribute, &_10$$15); + ZEPHIR_CPY_WRT(&attribute, &_11$$15); } ZEPHIR_OBS_NVAR(&attributeField); if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_11$$17); - object_init_ex(&_11$$17, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_12$$17); - ZEPHIR_CONCAT_SVS(&_12$$17, "Column '", &attribute, "' doesn't make part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_11$$17, "__construct", &_8, 29, &_12$$17); + object_init_ex(&_12$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_13$$17); + zephir_get_class(&_13$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_14$$17); + ZEPHIR_CONCAT_SVSVS(&_14$$17, "Column '", &attribute, "' doesn't make part of the column map in '", &_13$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_12$$17, "__construct", &_9, 32, &_14$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_11$$17, "phalcon/Mvc/Model.zep", 3253); + zephir_throw_exception_debug(&_12$$17, "phalcon/Mvc/Model.zep", 3271); ZEPHIR_MM_RESTORE(); return; } @@ -5615,8 +5907,8 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) */ PHP_METHOD(Phalcon_Mvc_Model, update) { - zval _3$$4; - zval metaData, _0, _1$$3, _2$$3, _4$$4, _5$$4, _6$$4, _7$$4; + zval _3$$4, _5$$4; + zval metaData, _0, _1$$3, _2$$3, _4$$4, _6$$4, _7$$4, _8$$4, _9$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -5626,10 +5918,12 @@ PHP_METHOD(Phalcon_Mvc_Model, update) ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); ZVAL_UNDEF(&_6$$4); ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$4); ZEPHIR_MM_GROW(); @@ -5638,7 +5932,7 @@ PHP_METHOD(Phalcon_Mvc_Model, update) if (zephir_is_true(&_0)) { ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getreadconnection", NULL, 428); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getreadconnection", NULL, 433); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "has", NULL, 0, &metaData, &_2$$3); zephir_check_call_status(); @@ -5648,11 +5942,17 @@ PHP_METHOD(Phalcon_Mvc_Model, update) ZEPHIR_INIT_VAR(&_4$$4); object_init_ex(&_4$$4, phalcon_messages_message_ce); ZEPHIR_INIT_VAR(&_5$$4); - ZVAL_STRING(&_5$$4, "Record cannot be updated because it does not exist"); - ZVAL_NULL(&_6$$4); - ZEPHIR_INIT_VAR(&_7$$4); - ZVAL_STRING(&_7$$4, "InvalidUpdateAttempt"); - ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 6, &_5$$4, &_6$$4, &_7$$4); + zephir_create_array(&_5$$4, 1, 0); + ZEPHIR_INIT_VAR(&_6$$4); + zephir_get_class(&_6$$4, this_ptr, 0); + zephir_array_update_string(&_5$$4, SL("model"), &_6$$4, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_6$$4); + ZVAL_STRING(&_6$$4, "Record cannot be updated because it does not exist"); + ZVAL_NULL(&_7$$4); + ZEPHIR_INIT_VAR(&_8$$4); + ZVAL_STRING(&_8$$4, "InvalidUpdateAttempt"); + ZVAL_LONG(&_9$$4, 0); + ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 6, &_6$$4, &_7$$4, &_8$$4, &_9$$4, &_5$$4); zephir_check_call_status(); zephir_array_fast_append(&_3$$4, &_4$$4); zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_3$$4); @@ -5713,13 +6013,13 @@ PHP_METHOD(Phalcon_Mvc_Model, writeAttribute) */ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) { - zend_string *_9$$7, *_30$$26; - zend_ulong _8$$7, _29$$26; - zend_bool error = 0, validateWithNulls = 0, _15$$3, _36$$22; - zval conditions, _17$$3, _38$$22; - zval manager, belongsTo, foreignKey, relation, position, bindParams, extraConditions, message, fields, referencedFields, field, referencedModel, value, allowNulls, _0, *_1, _2, _3$$5, _4$$3, _16$$3, _18$$3, *_6$$7, _7$$7, _10$$8, _11$$8, _12$$10, _13$$10, _14$$12, _19$$20, _20$$18, _21$$18, _24$$24, _25$$22, _37$$22, _39$$22, *_27$$26, _28$$26, _31$$27, _32$$27, _33$$29, _34$$29, _35$$31, _40$$39, _41$$37, _42$$37, _43$$42; + zend_string *_9$$7, *_33$$26; + zend_ulong _8$$7, _32$$26; + zend_bool error = 0, validateWithNulls = 0, _15$$3, _39$$22; + zval conditions, _17$$3, _21$$18, _41$$22, _45$$37; + zval manager, belongsTo, foreignKey, relation, position, bindParams, extraConditions, message, fields, referencedFields, field, referencedModel, value, allowNulls, _0, *_1, _2, _3$$5, _4$$3, _16$$3, _18$$3, *_6$$7, _7$$7, _10$$8, _11$$8, _12$$10, _13$$10, _14$$12, _19$$20, _20$$18, _22$$18, _23$$18, _24$$18, _27$$24, _28$$22, _40$$22, _42$$22, *_30$$26, _31$$26, _34$$27, _35$$27, _36$$29, _37$$29, _38$$31, _43$$39, _44$$37, _46$$37, _47$$37, _48$$37, _49$$42; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL, *_22 = NULL, *_23 = NULL, *_26 = NULL; + zephir_fcall_cache_entry *_5 = NULL, *_25 = NULL, *_26 = NULL, *_29 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, action = 0, numberNull = 0; zval *this_ptr = getThis(); @@ -5751,24 +6051,30 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZVAL_UNDEF(&_14$$12); ZVAL_UNDEF(&_19$$20); ZVAL_UNDEF(&_20$$18); - ZVAL_UNDEF(&_21$$18); - ZVAL_UNDEF(&_24$$24); - ZVAL_UNDEF(&_25$$22); - ZVAL_UNDEF(&_37$$22); - ZVAL_UNDEF(&_39$$22); - ZVAL_UNDEF(&_28$$26); - ZVAL_UNDEF(&_31$$27); - ZVAL_UNDEF(&_32$$27); - ZVAL_UNDEF(&_33$$29); - ZVAL_UNDEF(&_34$$29); - ZVAL_UNDEF(&_35$$31); - ZVAL_UNDEF(&_40$$39); - ZVAL_UNDEF(&_41$$37); - ZVAL_UNDEF(&_42$$37); - ZVAL_UNDEF(&_43$$42); + ZVAL_UNDEF(&_22$$18); + ZVAL_UNDEF(&_23$$18); + ZVAL_UNDEF(&_24$$18); + ZVAL_UNDEF(&_27$$24); + ZVAL_UNDEF(&_28$$22); + ZVAL_UNDEF(&_40$$22); + ZVAL_UNDEF(&_42$$22); + ZVAL_UNDEF(&_31$$26); + ZVAL_UNDEF(&_34$$27); + ZVAL_UNDEF(&_35$$27); + ZVAL_UNDEF(&_36$$29); + ZVAL_UNDEF(&_37$$29); + ZVAL_UNDEF(&_38$$31); + ZVAL_UNDEF(&_43$$39); + ZVAL_UNDEF(&_44$$37); + ZVAL_UNDEF(&_46$$37); + ZVAL_UNDEF(&_47$$37); + ZVAL_UNDEF(&_48$$37); + ZVAL_UNDEF(&_49$$42); ZVAL_UNDEF(&conditions); ZVAL_UNDEF(&_17$$3); - ZVAL_UNDEF(&_38$$22); + ZVAL_UNDEF(&_21$$18); + ZVAL_UNDEF(&_41$$22); + ZVAL_UNDEF(&_45$$37); ZEPHIR_MM_GROW(); @@ -5778,7 +6084,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_CALL_METHOD(&belongsTo, &manager, "getbelongsto", NULL, 0, this_ptr); zephir_check_call_status(); error = 0; - zephir_is_iterable(&belongsTo, 0, "phalcon/Mvc/Model.zep", 3486); + zephir_is_iterable(&belongsTo, 0, "phalcon/Mvc/Model.zep", 3513); if (Z_TYPE_P(&belongsTo) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&belongsTo), _1) { @@ -5793,7 +6099,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) action = 1; if (zephir_array_isset_string(&foreignKey, SL("action"))) { ZEPHIR_OBS_NVAR(&_3$$5); - zephir_array_fetch_string(&_3$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3377); + zephir_array_fetch_string(&_3$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3399); action = zephir_get_intval(&_3$$5); } if (action != 1) { @@ -5813,7 +6119,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&fields) == IS_ARRAY) { - zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3420); + zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3442); if (Z_TYPE_P(&fields) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&fields), _8$$7, _9$$7, _6$$7) { @@ -5827,11 +6133,11 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZVAL_COPY(&field, _6$$7); ZEPHIR_OBS_NVAR(&value); zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); - zephir_array_fetch(&_10$$8, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3412); + zephir_array_fetch(&_10$$8, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); ZEPHIR_INIT_NVAR(&_11$$8); ZEPHIR_CONCAT_SVSV(&_11$$8, "[", &_10$$8, "] = ?", &position); - zephir_array_append(&conditions, &_11$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3412); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3413); + zephir_array_append(&conditions, &_11$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); if (Z_TYPE_P(&value) == IS_NULL) { numberNull++; } @@ -5851,11 +6157,11 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) zephir_check_call_status(); ZEPHIR_OBS_NVAR(&value); zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); - zephir_array_fetch(&_12$$10, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3412); + zephir_array_fetch(&_12$$10, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); ZEPHIR_INIT_NVAR(&_13$$10); ZEPHIR_CONCAT_SVSV(&_13$$10, "[", &_12$$10, "] = ?", &position); - zephir_array_append(&conditions, &_13$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3412); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3413); + zephir_array_append(&conditions, &_13$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); if (Z_TYPE_P(&value) == IS_NULL) { numberNull++; } @@ -5871,15 +6177,15 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) zephir_fetch_property_zval(&value, this_ptr, &fields, PH_SILENT_CC); ZEPHIR_INIT_NVAR(&_14$$12); ZEPHIR_CONCAT_SVS(&_14$$12, "[", &referencedFields, "] = ?0"); - zephir_array_append(&conditions, &_14$$12, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3424); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3425); + zephir_array_append(&conditions, &_14$$12, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3446); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3447); if (Z_TYPE_P(&value) == IS_NULL) { validateWithNulls = 1; } } ZEPHIR_OBS_NVAR(&extraConditions); if (zephir_array_isset_string_fetch(&extraConditions, &foreignKey, SL("conditions"), 0)) { - zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3436); + zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3458); } if (validateWithNulls) { ZEPHIR_OBS_NVAR(&allowNulls); @@ -5916,10 +6222,19 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_INIT_NVAR(&_20$$18); object_init_ex(&_20$$18, phalcon_messages_message_ce); ZEPHIR_INIT_NVAR(&_21$$18); - ZVAL_STRING(&_21$$18, "ConstraintViolation"); - ZEPHIR_CALL_METHOD(NULL, &_20$$18, "__construct", &_22, 6, &message, &fields, &_21$$18); + zephir_create_array(&_21$$18, 2, 0); + ZEPHIR_INIT_NVAR(&_22$$18); + zephir_get_class(&_22$$18, this_ptr, 0); + zephir_array_update_string(&_21$$18, SL("model"), &_22$$18, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_23$$18, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + zephir_array_update_string(&_21$$18, SL("referenceModel"), &_23$$18, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_22$$18); + ZVAL_STRING(&_22$$18, "ConstraintViolation"); + ZVAL_LONG(&_24$$18, 0); + ZEPHIR_CALL_METHOD(NULL, &_20$$18, "__construct", &_25, 6, &message, &fields, &_22$$18, &_24$$18, &_21$$18); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_23, 0, &_20$$18); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &_20$$18); zephir_check_call_status(); error = 1; break; @@ -5944,16 +6259,16 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) } action = 1; if (zephir_array_isset_string(&foreignKey, SL("action"))) { - ZEPHIR_OBS_NVAR(&_24$$24); - zephir_array_fetch_string(&_24$$24, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3377); - action = zephir_get_intval(&_24$$24); + ZEPHIR_OBS_NVAR(&_27$$24); + zephir_array_fetch_string(&_27$$24, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3399); + action = zephir_get_intval(&_27$$24); } if (action != 1) { continue; } - ZEPHIR_CALL_METHOD(&_25$$22, &relation, "getreferencedmodel", NULL, 0); + ZEPHIR_CALL_METHOD(&_28$$22, &relation, "getreferencedmodel", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&referencedModel, &manager, "load", &_26, 0, &_25$$22); + ZEPHIR_CALL_METHOD(&referencedModel, &manager, "load", &_29, 0, &_28$$22); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&conditions); array_init(&conditions); @@ -5965,25 +6280,25 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&fields) == IS_ARRAY) { - zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3420); + zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3442); if (Z_TYPE_P(&fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&fields), _29$$26, _30$$26, _27$$26) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&fields), _32$$26, _33$$26, _30$$26) { ZEPHIR_INIT_NVAR(&position); - if (_30$$26 != NULL) { - ZVAL_STR_COPY(&position, _30$$26); + if (_33$$26 != NULL) { + ZVAL_STR_COPY(&position, _33$$26); } else { - ZVAL_LONG(&position, _29$$26); + ZVAL_LONG(&position, _32$$26); } ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _27$$26); + ZVAL_COPY(&field, _30$$26); ZEPHIR_OBS_NVAR(&value); zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); - zephir_array_fetch(&_31$$27, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3412); - ZEPHIR_INIT_NVAR(&_32$$27); - ZEPHIR_CONCAT_SVSV(&_32$$27, "[", &_31$$27, "] = ?", &position); - zephir_array_append(&conditions, &_32$$27, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3412); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3413); + zephir_array_fetch(&_34$$27, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_35$$27); + ZEPHIR_CONCAT_SVSV(&_35$$27, "[", &_34$$27, "] = ?", &position); + zephir_array_append(&conditions, &_35$$27, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); if (Z_TYPE_P(&value) == IS_NULL) { numberNull++; } @@ -5992,9 +6307,9 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_28$$26, &fields, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_31$$26, &fields, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_28$$26)) { + if (!zend_is_true(&_31$$26)) { break; } ZEPHIR_CALL_METHOD(&position, &fields, "key", NULL, 0); @@ -6003,11 +6318,11 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) zephir_check_call_status(); ZEPHIR_OBS_NVAR(&value); zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); - zephir_array_fetch(&_33$$29, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3412); - ZEPHIR_INIT_NVAR(&_34$$29); - ZEPHIR_CONCAT_SVSV(&_34$$29, "[", &_33$$29, "] = ?", &position); - zephir_array_append(&conditions, &_34$$29, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3412); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3413); + zephir_array_fetch(&_36$$29, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_37$$29); + ZEPHIR_CONCAT_SVSV(&_37$$29, "[", &_36$$29, "] = ?", &position); + zephir_array_append(&conditions, &_37$$29, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); if (Z_TYPE_P(&value) == IS_NULL) { numberNull++; } @@ -6021,17 +6336,17 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) } else { ZEPHIR_OBS_NVAR(&value); zephir_fetch_property_zval(&value, this_ptr, &fields, PH_SILENT_CC); - ZEPHIR_INIT_NVAR(&_35$$31); - ZEPHIR_CONCAT_SVS(&_35$$31, "[", &referencedFields, "] = ?0"); - zephir_array_append(&conditions, &_35$$31, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3424); - zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3425); + ZEPHIR_INIT_NVAR(&_38$$31); + ZEPHIR_CONCAT_SVS(&_38$$31, "[", &referencedFields, "] = ?0"); + zephir_array_append(&conditions, &_38$$31, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3446); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3447); if (Z_TYPE_P(&value) == IS_NULL) { validateWithNulls = 1; } } ZEPHIR_OBS_NVAR(&extraConditions); if (zephir_array_isset_string_fetch(&extraConditions, &foreignKey, SL("conditions"), 0)) { - zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3436); + zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3458); } if (validateWithNulls) { ZEPHIR_OBS_NVAR(&allowNulls); @@ -6041,37 +6356,46 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) validateWithNulls = 0; } } - _36$$22 = !validateWithNulls; - if (_36$$22) { - ZEPHIR_INIT_NVAR(&_38$$22); - zephir_create_array(&_38$$22, 2, 0); - ZEPHIR_INIT_NVAR(&_39$$22); - zephir_fast_join_str(&_39$$22, SL(" AND "), &conditions); - zephir_array_fast_append(&_38$$22, &_39$$22); - zephir_array_update_string(&_38$$22, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_37$$22, &referencedModel, "count", NULL, 0, &_38$$22); + _39$$22 = !validateWithNulls; + if (_39$$22) { + ZEPHIR_INIT_NVAR(&_41$$22); + zephir_create_array(&_41$$22, 2, 0); + ZEPHIR_INIT_NVAR(&_42$$22); + zephir_fast_join_str(&_42$$22, SL(" AND "), &conditions); + zephir_array_fast_append(&_41$$22, &_42$$22); + zephir_array_update_string(&_41$$22, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_40$$22, &referencedModel, "count", NULL, 0, &_41$$22); zephir_check_call_status(); - _36$$22 = !zephir_is_true(&_37$$22); + _39$$22 = !zephir_is_true(&_40$$22); } - if (_36$$22) { + if (_39$$22) { ZEPHIR_OBS_NVAR(&message); if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { ZEPHIR_INIT_NVAR(&message); if (Z_TYPE_P(&fields) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_40$$39); - zephir_fast_join_str(&_40$$39, SL(", "), &fields); - ZEPHIR_CONCAT_SVS(&message, "Value of fields \"", &_40$$39, "\" does not exist on referenced table"); + ZEPHIR_INIT_NVAR(&_43$$39); + zephir_fast_join_str(&_43$$39, SL(", "), &fields); + ZEPHIR_CONCAT_SVS(&message, "Value of fields \"", &_43$$39, "\" does not exist on referenced table"); } else { ZEPHIR_CONCAT_SVS(&message, "Value of field \"", &fields, "\" does not exist on referenced table"); } } - ZEPHIR_INIT_NVAR(&_41$$37); - object_init_ex(&_41$$37, phalcon_messages_message_ce); - ZEPHIR_INIT_NVAR(&_42$$37); - ZVAL_STRING(&_42$$37, "ConstraintViolation"); - ZEPHIR_CALL_METHOD(NULL, &_41$$37, "__construct", &_22, 6, &message, &fields, &_42$$37); + ZEPHIR_INIT_NVAR(&_44$$37); + object_init_ex(&_44$$37, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_45$$37); + zephir_create_array(&_45$$37, 2, 0); + ZEPHIR_INIT_NVAR(&_46$$37); + zephir_get_class(&_46$$37, this_ptr, 0); + zephir_array_update_string(&_45$$37, SL("model"), &_46$$37, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_47$$37, &relation, "getreferencedmodel", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_23, 0, &_41$$37); + zephir_array_update_string(&_45$$37, SL("referenceModel"), &_47$$37, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_46$$37); + ZVAL_STRING(&_46$$37, "ConstraintViolation"); + ZVAL_LONG(&_48$$37, 0); + ZEPHIR_CALL_METHOD(NULL, &_44$$37, "__construct", &_25, 6, &message, &fields, &_46$$37, &_48$$37, &_45$$37); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &_44$$37); zephir_check_call_status(); error = 1; break; @@ -6083,9 +6407,9 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) ZEPHIR_INIT_NVAR(&relation); if (error) { if (ZEPHIR_GLOBAL(orm).events) { - ZEPHIR_INIT_VAR(&_43$$42); - ZVAL_STRING(&_43$$42, "onValidationFails"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_43$$42); + ZEPHIR_INIT_VAR(&_49$$42); + ZVAL_STRING(&_49$$42, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_49$$42); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); zephir_check_call_status(); @@ -6127,7 +6451,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseCascade) ZEPHIR_CPY_WRT(&manager, &_0); ZEPHIR_CALL_METHOD(&relations, &manager, "gethasoneandhasmany", NULL, 0, this_ptr); zephir_check_call_status(); - zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3562); + zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3589); if (Z_TYPE_P(&relations) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relations), _1) { @@ -6145,7 +6469,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseCascade) } if (_3$$3) { ZEPHIR_OBS_NVAR(&_4$$5); - zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3536); + zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3563); action = zephir_get_intval(&_4$$5); } if (action != 2) { @@ -6184,7 +6508,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseCascade) } if (_7$$9) { ZEPHIR_OBS_NVAR(&_8$$11); - zephir_array_fetch_string(&_8$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3536); + zephir_array_fetch_string(&_8$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3563); action = zephir_get_intval(&_8$$11); } if (action != 2) { @@ -6213,10 +6537,11 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseCascade) */ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) { - zval manager, relations, foreignKey, relation, relationClass, fields, message, _0, *_1, _2, _5$$3, _6$$3, _7$$3, _4$$5, _9$$7, _10$$7, _15$$9, _16$$9, _17$$9, _14$$11, _19$$13, _20$$13, _21$$16; - zend_bool error = 0, _3$$3, _13$$9; + zval _10$$7, _22$$13; + zval manager, relations, foreignKey, relation, relationClass, fields, message, _0, *_1, _2, _5$$3, _6$$3, _7$$3, _4$$5, _9$$7, _11$$7, _12$$7, _17$$9, _18$$9, _19$$9, _16$$11, _21$$13, _23$$13, _24$$13, _25$$16; + zend_bool error = 0, _3$$3, _15$$9; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL, *_12 = NULL, *_18 = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_13 = NULL, *_14 = NULL, *_20 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, action = 0; zval *this_ptr = getThis(); @@ -6234,14 +6559,18 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_4$$5); ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&_15$$9); - ZVAL_UNDEF(&_16$$9); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_12$$7); ZVAL_UNDEF(&_17$$9); - ZVAL_UNDEF(&_14$$11); - ZVAL_UNDEF(&_19$$13); - ZVAL_UNDEF(&_20$$13); - ZVAL_UNDEF(&_21$$16); + ZVAL_UNDEF(&_18$$9); + ZVAL_UNDEF(&_19$$9); + ZVAL_UNDEF(&_16$$11); + ZVAL_UNDEF(&_21$$13); + ZVAL_UNDEF(&_23$$13); + ZVAL_UNDEF(&_24$$13); + ZVAL_UNDEF(&_25$$16); + ZVAL_UNDEF(&_10$$7); + ZVAL_UNDEF(&_22$$13); ZEPHIR_MM_GROW(); @@ -6251,7 +6580,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) ZEPHIR_CALL_METHOD(&relations, &manager, "gethasoneandhasmany", NULL, 0, this_ptr); zephir_check_call_status(); error = 0; - zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3648); + zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3680); if (Z_TYPE_P(&relations) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relations), _1) { @@ -6269,7 +6598,7 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) } if (_3$$3) { ZEPHIR_OBS_NVAR(&_4$$5); - zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3607); + zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3634); action = zephir_get_intval(&_4$$5); } if (action != 1) { @@ -6293,10 +6622,17 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) ZEPHIR_INIT_NVAR(&_9$$7); object_init_ex(&_9$$7, phalcon_messages_message_ce); ZEPHIR_INIT_NVAR(&_10$$7); - ZVAL_STRING(&_10$$7, "ConstraintViolation"); - ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_11, 6, &message, &fields, &_10$$7); + zephir_create_array(&_10$$7, 2, 0); + ZEPHIR_INIT_NVAR(&_11$$7); + zephir_get_class(&_11$$7, this_ptr, 0); + zephir_array_update_string(&_10$$7, SL("model"), &_11$$7, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_10$$7, SL("referenceModel"), &relationClass, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_11$$7); + ZVAL_STRING(&_11$$7, "ConstraintViolation"); + ZVAL_LONG(&_12$$7, 0); + ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_13, 6, &message, &fields, &_11$$7, &_12$$7, &_10$$7); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_12, 0, &_9$$7); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_14, 0, &_9$$7); zephir_check_call_status(); error = 1; break; @@ -6319,14 +6655,14 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) continue; } action = 1; - _13$$9 = Z_TYPE_P(&foreignKey) == IS_ARRAY; - if (_13$$9) { - _13$$9 = zephir_array_isset_string(&foreignKey, SL("action")); + _15$$9 = Z_TYPE_P(&foreignKey) == IS_ARRAY; + if (_15$$9) { + _15$$9 = zephir_array_isset_string(&foreignKey, SL("action")); } - if (_13$$9) { - ZEPHIR_OBS_NVAR(&_14$$11); - zephir_array_fetch_string(&_14$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3607); - action = zephir_get_intval(&_14$$11); + if (_15$$9) { + ZEPHIR_OBS_NVAR(&_16$$11); + zephir_array_fetch_string(&_16$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3634); + action = zephir_get_intval(&_16$$11); } if (action != 1) { continue; @@ -6335,24 +6671,31 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&fields, &relation, "getfields", NULL, 0); zephir_check_call_status(); - ZVAL_NULL(&_16$$9); - ZEPHIR_INIT_NVAR(&_17$$9); - ZVAL_STRING(&_17$$9, "count"); - ZEPHIR_CALL_METHOD(&_15$$9, &manager, "getrelationrecords", &_18, 0, &relation, this_ptr, &_16$$9, &_17$$9); + ZVAL_NULL(&_18$$9); + ZEPHIR_INIT_NVAR(&_19$$9); + ZVAL_STRING(&_19$$9, "count"); + ZEPHIR_CALL_METHOD(&_17$$9, &manager, "getrelationrecords", &_20, 0, &relation, this_ptr, &_18$$9, &_19$$9); zephir_check_call_status(); - if (zephir_is_true(&_15$$9)) { + if (zephir_is_true(&_17$$9)) { ZEPHIR_OBS_NVAR(&message); if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { ZEPHIR_INIT_NVAR(&message); ZEPHIR_CONCAT_SV(&message, "Record is referenced by model ", &relationClass); } - ZEPHIR_INIT_NVAR(&_19$$13); - object_init_ex(&_19$$13, phalcon_messages_message_ce); - ZEPHIR_INIT_NVAR(&_20$$13); - ZVAL_STRING(&_20$$13, "ConstraintViolation"); - ZEPHIR_CALL_METHOD(NULL, &_19$$13, "__construct", &_11, 6, &message, &fields, &_20$$13); + ZEPHIR_INIT_NVAR(&_21$$13); + object_init_ex(&_21$$13, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_22$$13); + zephir_create_array(&_22$$13, 2, 0); + ZEPHIR_INIT_NVAR(&_23$$13); + zephir_get_class(&_23$$13, this_ptr, 0); + zephir_array_update_string(&_22$$13, SL("model"), &_23$$13, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_22$$13, SL("referenceModel"), &relationClass, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_23$$13); + ZVAL_STRING(&_23$$13, "ConstraintViolation"); + ZVAL_LONG(&_24$$13, 0); + ZEPHIR_CALL_METHOD(NULL, &_21$$13, "__construct", &_13, 6, &message, &fields, &_23$$13, &_24$$13, &_22$$13); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_12, 0, &_19$$13); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_14, 0, &_21$$13); zephir_check_call_status(); error = 1; break; @@ -6364,9 +6707,9 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) ZEPHIR_INIT_NVAR(&relation); if (error) { if (ZEPHIR_GLOBAL(orm).events) { - ZEPHIR_INIT_VAR(&_21$$16); - ZVAL_STRING(&_21$$16, "onValidationFails"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_21$$16); + ZEPHIR_INIT_VAR(&_25$$16); + ZVAL_STRING(&_25$$16, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_25$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); zephir_check_call_status(); @@ -6384,13 +6727,13 @@ PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) */ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) { - zend_string *_52$$56; - zend_ulong _51$$56; - zend_bool useExplicitIdentity = 0, _45, _6$$11, _22$$26, _39$$40, _54$$56; + zend_string *_58$$56; + zend_ulong _57$$56; + zend_bool useExplicitIdentity = 0, _51, _7$$11, _25$$26, _44$$40, _60$$56; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL, *_10 = NULL, *_11 = NULL, *_17 = NULL, *_19 = NULL, *_26 = NULL, *_27 = NULL, *_33 = NULL, *_35 = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_11 = NULL, *_12 = NULL, *_19 = NULL, *_21 = NULL, *_29 = NULL, *_30 = NULL, *_37 = NULL, *_39 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, *identityField, identityField_sub, __$null, attributeField, attributes, automaticAttributes, bindDataTypes, bindSkip, bindType, bindTypes, columnMap, defaultValue, defaultValues, field, fields, lastInsertedId, manager, sequenceName, schema, snapshot, source, success, unsetDefaultValues, value, values, _0, *_1, _2, _3$$7, _4$$7, _7$$12, _8$$12, _9$$12, _12$$15, _13$$15, _14$$17, _15$$17, _16$$17, _18$$17, _20$$22, _21$$22, _23$$27, _24$$27, _25$$27, _28$$30, _29$$30, _30$$32, _31$$32, _32$$32, _34$$32, _36$$35, _37$$38, _38$$38, _40$$45, _41$$45, _42$$48, _43$$48, _44$$48, _46$$49, _47$$55, _48$$55, *_49$$56, _50$$56, _53$$56; + zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, *identityField, identityField_sub, __$null, attributeField, attributes, automaticAttributes, bindDataTypes, bindSkip, bindType, bindTypes, columnMap, defaultValue, defaultValues, field, fields, lastInsertedId, manager, sequenceName, schema, snapshot, source, success, unsetDefaultValues, value, values, _0, *_1, _2, _3$$7, _4$$7, _5$$7, _8$$12, _9$$12, _10$$12, _13$$15, _14$$15, _15$$15, _16$$17, _17$$17, _18$$17, _20$$17, _22$$22, _23$$22, _24$$22, _26$$27, _27$$27, _28$$27, _31$$30, _32$$30, _33$$30, _34$$32, _35$$32, _36$$32, _38$$32, _40$$35, _41$$38, _42$$38, _43$$38, _45$$45, _46$$45, _47$$45, _48$$48, _49$$48, _50$$48, _52$$49, _53$$55, _54$$55, *_55$$56, _56$$56, _59$$56; zval *this_ptr = getThis(); ZVAL_UNDEF(&metaData_sub); @@ -6424,39 +6767,45 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$7); ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_7$$12); + ZVAL_UNDEF(&_5$$7); ZVAL_UNDEF(&_8$$12); ZVAL_UNDEF(&_9$$12); - ZVAL_UNDEF(&_12$$15); + ZVAL_UNDEF(&_10$$12); ZVAL_UNDEF(&_13$$15); - ZVAL_UNDEF(&_14$$17); - ZVAL_UNDEF(&_15$$17); + ZVAL_UNDEF(&_14$$15); + ZVAL_UNDEF(&_15$$15); ZVAL_UNDEF(&_16$$17); + ZVAL_UNDEF(&_17$$17); ZVAL_UNDEF(&_18$$17); - ZVAL_UNDEF(&_20$$22); - ZVAL_UNDEF(&_21$$22); - ZVAL_UNDEF(&_23$$27); - ZVAL_UNDEF(&_24$$27); - ZVAL_UNDEF(&_25$$27); - ZVAL_UNDEF(&_28$$30); - ZVAL_UNDEF(&_29$$30); - ZVAL_UNDEF(&_30$$32); - ZVAL_UNDEF(&_31$$32); - ZVAL_UNDEF(&_32$$32); + ZVAL_UNDEF(&_20$$17); + ZVAL_UNDEF(&_22$$22); + ZVAL_UNDEF(&_23$$22); + ZVAL_UNDEF(&_24$$22); + ZVAL_UNDEF(&_26$$27); + ZVAL_UNDEF(&_27$$27); + ZVAL_UNDEF(&_28$$27); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$30); + ZVAL_UNDEF(&_33$$30); ZVAL_UNDEF(&_34$$32); - ZVAL_UNDEF(&_36$$35); - ZVAL_UNDEF(&_37$$38); - ZVAL_UNDEF(&_38$$38); - ZVAL_UNDEF(&_40$$45); - ZVAL_UNDEF(&_41$$45); - ZVAL_UNDEF(&_42$$48); - ZVAL_UNDEF(&_43$$48); - ZVAL_UNDEF(&_44$$48); - ZVAL_UNDEF(&_46$$49); - ZVAL_UNDEF(&_47$$55); - ZVAL_UNDEF(&_48$$55); - ZVAL_UNDEF(&_50$$56); - ZVAL_UNDEF(&_53$$56); + ZVAL_UNDEF(&_35$$32); + ZVAL_UNDEF(&_36$$32); + ZVAL_UNDEF(&_38$$32); + ZVAL_UNDEF(&_40$$35); + ZVAL_UNDEF(&_41$$38); + ZVAL_UNDEF(&_42$$38); + ZVAL_UNDEF(&_43$$38); + ZVAL_UNDEF(&_45$$45); + ZVAL_UNDEF(&_46$$45); + ZVAL_UNDEF(&_47$$45); + ZVAL_UNDEF(&_48$$48); + ZVAL_UNDEF(&_49$$48); + ZVAL_UNDEF(&_50$$48); + ZVAL_UNDEF(&_52$$49); + ZVAL_UNDEF(&_53$$55); + ZVAL_UNDEF(&_54$$55); + ZVAL_UNDEF(&_56$$56); + ZVAL_UNDEF(&_59$$56); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) @@ -6502,7 +6851,7 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) ZEPHIR_INIT_NVAR(&columnMap); ZVAL_NULL(&columnMap); } - zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 3770); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 3802); if (Z_TYPE_P(&attributes) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _1) { @@ -6514,10 +6863,12 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) ZEPHIR_INIT_NVAR(&_3$$7); object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_4$$7); - ZEPHIR_CONCAT_SVS(&_4$$7, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", &_5, 29, &_4$$7); + zephir_get_class(&_4$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_5$$7); + ZEPHIR_CONCAT_SVSVS(&_5$$7, "Column '", &field, "' in '", &_4$$7, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", &_6, 32, &_5$$7); zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 3704); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 3736); ZEPHIR_MM_RESTORE(); return; } @@ -6528,60 +6879,62 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) if (!ZEPHIR_IS_EQUAL(&field, identityField)) { ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - _6$$11 = Z_TYPE_P(&value) == IS_NULL; - if (_6$$11) { - _6$$11 = zephir_array_isset(&defaultValues, &field); + _7$$11 = Z_TYPE_P(&value) == IS_NULL; + if (_7$$11) { + _7$$11 = zephir_array_isset(&defaultValues, &field); } - if (_6$$11) { - zephir_array_fetch(&_7$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3721); - zephir_array_update_zval(&snapshot, &attributeField, &_7$$12, PH_COPY | PH_SEPARATE); - zephir_array_fetch(&_8$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3722); - zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_8$$12, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_9$$12, connection, "supportsdefaultvalue", &_10, 0); + if (_7$$11) { + zephir_array_fetch(&_8$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3753); + zephir_array_update_zval(&snapshot, &attributeField, &_8$$12, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_9$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3754); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_9$$12, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_10$$12, connection, "supportsdefaultvalue", &_11, 0); zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_9$$12))) { + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_10$$12))) { continue; } - ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_11, 0); + ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_12, 0); zephir_check_call_status(); } else { zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(&bindType); if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_12$$15); - object_init_ex(&_12$$15, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_13$$15); - ZEPHIR_CONCAT_SVS(&_13$$15, "Column '", &field, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_12$$15, "__construct", &_5, 29, &_13$$15); + object_init_ex(&_13$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_14$$15); + zephir_get_class(&_14$$15, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_15$$15); + ZEPHIR_CONCAT_SVSVS(&_15$$15, "Column '", &field, "' in '", &_14$$15, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_13$$15, "__construct", &_6, 32, &_15$$15); zephir_check_call_status(); - zephir_throw_exception_debug(&_12$$15, "phalcon/Mvc/Model.zep", 3739); + zephir_throw_exception_debug(&_13$$15, "phalcon/Mvc/Model.zep", 3771); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3742); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3743); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3744); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3774); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3775); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3776); } else { if (zephir_array_isset(&defaultValues, &field)) { - zephir_array_fetch(&_14$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3747); - zephir_array_update_zval(&snapshot, &attributeField, &_14$$17, PH_COPY | PH_SEPARATE); - zephir_array_fetch(&_15$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3748); - zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_15$$17, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_16$$17, connection, "supportsdefaultvalue", &_17, 0); + zephir_array_fetch(&_16$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3779); + zephir_array_update_zval(&snapshot, &attributeField, &_16$$17, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_17$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3780); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_17$$17, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_18$$17, connection, "supportsdefaultvalue", &_19, 0); zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_16$$17))) { + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_18$$17))) { continue; } - ZEPHIR_CALL_METHOD(&_18$$17, connection, "getdefaultvalue", &_19, 0); + ZEPHIR_CALL_METHOD(&_20$$17, connection, "getdefaultvalue", &_21, 0); zephir_check_call_status(); - zephir_array_append(&values, &_18$$17, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3754); + zephir_array_append(&values, &_20$$17, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3786); } else { - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3756); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3788); zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3760); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3761); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3792); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3793); } } } @@ -6600,13 +6953,15 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_20$$22); - object_init_ex(&_20$$22, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_21$$22); - ZEPHIR_CONCAT_SVS(&_21$$22, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_20$$22, "__construct", &_5, 29, &_21$$22); + ZEPHIR_INIT_NVAR(&_22$$22); + object_init_ex(&_22$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_23$$22); + zephir_get_class(&_23$$22, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_24$$22); + ZEPHIR_CONCAT_SVSVS(&_24$$22, "Column '", &field, "' in '", &_23$$22, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_22$$22, "__construct", &_6, 32, &_24$$22); zephir_check_call_status(); - zephir_throw_exception_debug(&_20$$22, "phalcon/Mvc/Model.zep", 3704); + zephir_throw_exception_debug(&_22$$22, "phalcon/Mvc/Model.zep", 3736); ZEPHIR_MM_RESTORE(); return; } @@ -6617,60 +6972,62 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) if (!ZEPHIR_IS_EQUAL(&field, identityField)) { ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - _22$$26 = Z_TYPE_P(&value) == IS_NULL; - if (_22$$26) { - _22$$26 = zephir_array_isset(&defaultValues, &field); + _25$$26 = Z_TYPE_P(&value) == IS_NULL; + if (_25$$26) { + _25$$26 = zephir_array_isset(&defaultValues, &field); } - if (_22$$26) { - zephir_array_fetch(&_23$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3721); - zephir_array_update_zval(&snapshot, &attributeField, &_23$$27, PH_COPY | PH_SEPARATE); - zephir_array_fetch(&_24$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3722); - zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_24$$27, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_25$$27, connection, "supportsdefaultvalue", &_26, 0); + if (_25$$26) { + zephir_array_fetch(&_26$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3753); + zephir_array_update_zval(&snapshot, &attributeField, &_26$$27, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_27$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3754); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_27$$27, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_28$$27, connection, "supportsdefaultvalue", &_29, 0); zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_25$$27))) { + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_28$$27))) { continue; } - ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_27, 0); + ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_30, 0); zephir_check_call_status(); } else { zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(&bindType); if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_28$$30); - object_init_ex(&_28$$30, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_29$$30); - ZEPHIR_CONCAT_SVS(&_29$$30, "Column '", &field, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_28$$30, "__construct", &_5, 29, &_29$$30); + ZEPHIR_INIT_NVAR(&_31$$30); + object_init_ex(&_31$$30, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_32$$30); + zephir_get_class(&_32$$30, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_33$$30); + ZEPHIR_CONCAT_SVSVS(&_33$$30, "Column '", &field, "' in '", &_32$$30, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_31$$30, "__construct", &_6, 32, &_33$$30); zephir_check_call_status(); - zephir_throw_exception_debug(&_28$$30, "phalcon/Mvc/Model.zep", 3739); + zephir_throw_exception_debug(&_31$$30, "phalcon/Mvc/Model.zep", 3771); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3742); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3743); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3744); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3774); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3775); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3776); } else { if (zephir_array_isset(&defaultValues, &field)) { - zephir_array_fetch(&_30$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3747); - zephir_array_update_zval(&snapshot, &attributeField, &_30$$32, PH_COPY | PH_SEPARATE); - zephir_array_fetch(&_31$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3748); - zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_31$$32, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_32$$32, connection, "supportsdefaultvalue", &_33, 0); + zephir_array_fetch(&_34$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3779); + zephir_array_update_zval(&snapshot, &attributeField, &_34$$32, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_35$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3780); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_35$$32, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_36$$32, connection, "supportsdefaultvalue", &_37, 0); zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_32$$32))) { + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_36$$32))) { continue; } - ZEPHIR_CALL_METHOD(&_34$$32, connection, "getdefaultvalue", &_35, 0); + ZEPHIR_CALL_METHOD(&_38$$32, connection, "getdefaultvalue", &_39, 0); zephir_check_call_status(); - zephir_array_append(&values, &_34$$32, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3754); + zephir_array_append(&values, &_38$$32, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3786); } else { - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3756); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3788); zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3760); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3761); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3792); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3793); } } } @@ -6682,22 +7039,24 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) if (!ZEPHIR_IS_FALSE_IDENTICAL(identityField)) { ZEPHIR_CALL_METHOD(&defaultValue, connection, "getdefaultidvalue", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_36$$35, connection, "useexplicitidvalue", NULL, 0); + ZEPHIR_CALL_METHOD(&_40$$35, connection, "useexplicitidvalue", NULL, 0); zephir_check_call_status(); - useExplicitIdentity = zephir_get_boolval(&_36$$35); + useExplicitIdentity = zephir_get_boolval(&_40$$35); if (useExplicitIdentity) { - zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3780); + zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3812); } if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, identityField, 0)))) { - ZEPHIR_INIT_VAR(&_37$$38); - object_init_ex(&_37$$38, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(&_38$$38); - ZEPHIR_CONCAT_SVS(&_38$$38, "Identity column '", identityField, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_37$$38, "__construct", &_5, 29, &_38$$38); + ZEPHIR_INIT_VAR(&_41$$38); + object_init_ex(&_41$$38, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_42$$38); + zephir_get_class(&_42$$38, this_ptr, 0); + ZEPHIR_INIT_VAR(&_43$$38); + ZEPHIR_CONCAT_SVSVS(&_43$$38, "Identity column '", identityField, "' isn't part of the column map in '", &_42$$38, "'"); + ZEPHIR_CALL_METHOD(NULL, &_41$$38, "__construct", &_6, 32, &_43$$38); zephir_check_call_status(); - zephir_throw_exception_debug(&_37$$38, "phalcon/Mvc/Model.zep", 3790); + zephir_throw_exception_debug(&_41$$38, "phalcon/Mvc/Model.zep", 3822); ZEPHIR_MM_RESTORE(); return; } @@ -6706,67 +7065,69 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) } ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - _39$$40 = Z_TYPE_P(&value) == IS_NULL; - if (!(_39$$40)) { - _39$$40 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + _44$$40 = Z_TYPE_P(&value) == IS_NULL; + if (!(_44$$40)) { + _44$$40 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); } - if (_39$$40) { + if (_44$$40) { if (useExplicitIdentity) { - zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3802); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3802); + zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3834); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3834); } } else { if (!(useExplicitIdentity)) { - zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3810); + zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3842); } ZEPHIR_OBS_NVAR(&bindType); if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, identityField, 0)))) { - ZEPHIR_INIT_VAR(&_40$$45); - object_init_ex(&_40$$45, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_VAR(&_41$$45); - ZEPHIR_CONCAT_SVS(&_41$$45, "Identity column '", identityField, "' isn\'t part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, &_40$$45, "__construct", &_5, 29, &_41$$45); + ZEPHIR_INIT_VAR(&_45$$45); + object_init_ex(&_45$$45, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_46$$45); + zephir_get_class(&_46$$45, this_ptr, 0); + ZEPHIR_INIT_VAR(&_47$$45); + ZEPHIR_CONCAT_SVSVS(&_47$$45, "Identity column '", identityField, "' isn\'t part of the table columns in '", &_46$$45, "'"); + ZEPHIR_CALL_METHOD(NULL, &_45$$45, "__construct", &_6, 32, &_47$$45); zephir_check_call_status(); - zephir_throw_exception_debug(&_40$$45, "phalcon/Mvc/Model.zep", 3819); + zephir_throw_exception_debug(&_45$$45, "phalcon/Mvc/Model.zep", 3851); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3822); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3823); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3854); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3855); } } else { if (useExplicitIdentity) { - zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3827); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3828); + zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3859); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3860); } } } if (Z_TYPE_P(table) == IS_ARRAY) { - zephir_array_fetch_long(&_42$$48, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3837); - zephir_array_fetch_long(&_43$$48, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3837); - ZEPHIR_INIT_VAR(&_44$$48); - ZEPHIR_CONCAT_VSV(&_44$$48, &_42$$48, ".", &_43$$48); - ZEPHIR_CPY_WRT(table, &_44$$48); + zephir_array_fetch_long(&_48$$48, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3869); + zephir_array_fetch_long(&_49$$48, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3869); + ZEPHIR_INIT_VAR(&_50$$48); + ZEPHIR_CONCAT_VSV(&_50$$48, &_48$$48, ".", &_49$$48); + ZEPHIR_CPY_WRT(table, &_50$$48); } ZEPHIR_CALL_METHOD(&success, connection, "insert", NULL, 0, table, &values, &fields, &bindTypes); zephir_check_call_status(); - _45 = zephir_is_true(&success); - if (_45) { - _45 = !ZEPHIR_IS_FALSE_IDENTICAL(identityField); + _51 = zephir_is_true(&success); + if (_51) { + _51 = !ZEPHIR_IS_FALSE_IDENTICAL(identityField); } - if (_45) { + if (_51) { ZEPHIR_INIT_VAR(&sequenceName); ZVAL_NULL(&sequenceName); - ZEPHIR_CALL_METHOD(&_46$$49, connection, "supportsequences", NULL, 0); + ZEPHIR_CALL_METHOD(&_52$$49, connection, "supportsequences", NULL, 0); zephir_check_call_status(); - if (zephir_is_true(&_46$$49)) { + if (zephir_is_true(&_52$$49)) { if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("getsequencename")) == SUCCESS)) { ZEPHIR_CALL_METHOD(&sequenceName, this_ptr, "getsequencename", NULL, 0); zephir_check_call_status(); } else { - ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 421); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 420); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&sequenceName); if (ZEPHIR_IS_EMPTY(&schema)) { @@ -6779,37 +7140,37 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) ZEPHIR_CALL_METHOD(&lastInsertedId, connection, "lastinsertid", NULL, 0, &sequenceName); zephir_check_call_status(); if (UNEXPECTED(ZEPHIR_GLOBAL(orm).cast_last_insert_id_to_int)) { - ZVAL_LONG(&_47$$55, 10); - ZEPHIR_CALL_FUNCTION(&_48$$55, "intval", NULL, 38, &lastInsertedId, &_47$$55); + ZVAL_LONG(&_53$$55, 10); + ZEPHIR_CALL_FUNCTION(&_54$$55, "intval", NULL, 41, &lastInsertedId, &_53$$55); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&lastInsertedId, &_48$$55); + ZEPHIR_CPY_WRT(&lastInsertedId, &_54$$55); } zephir_update_property_zval_zval(this_ptr, &attributeField, &lastInsertedId); zephir_array_update_zval(&snapshot, &attributeField, &lastInsertedId, PH_COPY | PH_SEPARATE); zephir_update_property_zval(this_ptr, ZEND_STRL("uniqueParams"), &__$null); } if (zephir_is_true(&success)) { - zephir_is_iterable(&unsetDefaultValues, 0, "phalcon/Mvc/Model.zep", 3898); + zephir_is_iterable(&unsetDefaultValues, 0, "phalcon/Mvc/Model.zep", 3930); if (Z_TYPE_P(&unsetDefaultValues) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&unsetDefaultValues), _51$$56, _52$$56, _49$$56) + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&unsetDefaultValues), _57$$56, _58$$56, _55$$56) { ZEPHIR_INIT_NVAR(&attributeField); - if (_52$$56 != NULL) { - ZVAL_STR_COPY(&attributeField, _52$$56); + if (_58$$56 != NULL) { + ZVAL_STR_COPY(&attributeField, _58$$56); } else { - ZVAL_LONG(&attributeField, _51$$56); + ZVAL_LONG(&attributeField, _57$$56); } ZEPHIR_INIT_NVAR(&defaultValue); - ZVAL_COPY(&defaultValue, _49$$56); + ZVAL_COPY(&defaultValue, _55$$56); zephir_update_property_zval_zval(this_ptr, &attributeField, &defaultValue); } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &unsetDefaultValues, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_50$$56, &unsetDefaultValues, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_56$$56, &unsetDefaultValues, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_50$$56)) { + if (!zend_is_true(&_56$$56)) { break; } ZEPHIR_CALL_METHOD(&attributeField, &unsetDefaultValues, "key", NULL, 0); @@ -6823,13 +7184,13 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) } ZEPHIR_INIT_NVAR(&defaultValue); ZEPHIR_INIT_NVAR(&attributeField); - ZEPHIR_CALL_METHOD(&_53$$56, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + ZEPHIR_CALL_METHOD(&_59$$56, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); - _54$$56 = zephir_is_true(&_53$$56); - if (_54$$56) { - _54$$56 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; + _60$$56 = zephir_is_true(&_59$$56); + if (_60$$56) { + _60$$56 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; } - if (_54$$56) { + if (_60$$56) { zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); } } @@ -6843,13 +7204,13 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) */ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) { - zval _17$$28, _18$$28, _30$$53, _31$$53; - zval _41; - zend_bool changed = 0, useDynamicUpdate = 0, _43, _44, _11$$22, _13$$22, _25$$47, _27$$47; + zval _21$$25, _22$$25, _37$$48, _38$$48; + zval _67; + zend_bool changed = 0, useDynamicUpdate = 0, _2, _69, _70, _15$$19, _17$$19, _32$$42, _34$$42; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_15 = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_19 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, __$null, automaticAttributes, attributeField, bindSkip, bindDataTypes, bindType, bindTypes, columnMap, dataType, dataTypes, field, fields, manager, nonPrimary, newSnapshot, success, primaryKeys, snapshot, snapshotValue, uniqueKey, uniqueParams, value, values, updateValue, _0, _1, *_2, _3, _42, _4$$10, _5$$10, _7$$13, _8$$13, _9$$23, _10$$23, _12$$24, _14$$27, _16$$27, _19$$35, _20$$35, _21$$38, _22$$38, _23$$48, _24$$48, _26$$49, _28$$52, _29$$52, *_32$$59, _33$$59, _34$$63, _35$$63, _36$$69, _37$$69, _38$$73, _39$$73, _40$$73, _45$$75, _46$$76; + zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, __$null, automaticAttributes, attributeField, bindSkip, bindDataTypes, bindType, bindTypes, columnMap, dataType, dataTypes, field, fields, manager, nonPrimary, newSnapshot, success, primaryKeys, snapshot, snapshotValue, uniqueKey, uniqueParams, value, values, updateValue, _0, _1, _68, *_3$$5, _4$$5, _5$$9, _6$$9, _7$$9, _9$$12, _10$$12, _11$$12, _12$$20, _13$$20, _14$$20, _16$$21, _18$$24, _20$$24, _23$$32, _24$$32, _25$$32, _26$$35, _27$$35, _28$$35, _29$$43, _30$$43, _31$$43, _33$$44, _35$$47, _36$$47, *_39$$53, _40$$53, _41$$57, _42$$57, _43$$57, _44$$60, _45$$60, _46$$60, _47$$66, _48$$66, _49$$66, _50$$69, _51$$69, _52$$69, _53$$74, _54$$74, _55$$74, *_56$$73, _57$$73, _58$$77, _59$$77, _60$$77, _61$$83, _62$$83, _63$$83, _64$$87, _65$$87, _66$$87, _71$$89, _72$$90; zval *this_ptr = getThis(); ZVAL_UNDEF(&metaData_sub); @@ -6881,41 +7242,65 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZVAL_UNDEF(&updateValue); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_42); - ZVAL_UNDEF(&_4$$10); - ZVAL_UNDEF(&_5$$10); - ZVAL_UNDEF(&_7$$13); - ZVAL_UNDEF(&_8$$13); - ZVAL_UNDEF(&_9$$23); - ZVAL_UNDEF(&_10$$23); - ZVAL_UNDEF(&_12$$24); - ZVAL_UNDEF(&_14$$27); - ZVAL_UNDEF(&_16$$27); - ZVAL_UNDEF(&_19$$35); - ZVAL_UNDEF(&_20$$35); - ZVAL_UNDEF(&_21$$38); - ZVAL_UNDEF(&_22$$38); - ZVAL_UNDEF(&_23$$48); - ZVAL_UNDEF(&_24$$48); - ZVAL_UNDEF(&_26$$49); - ZVAL_UNDEF(&_28$$52); - ZVAL_UNDEF(&_29$$52); - ZVAL_UNDEF(&_33$$59); - ZVAL_UNDEF(&_34$$63); - ZVAL_UNDEF(&_35$$63); - ZVAL_UNDEF(&_36$$69); - ZVAL_UNDEF(&_37$$69); - ZVAL_UNDEF(&_38$$73); - ZVAL_UNDEF(&_39$$73); - ZVAL_UNDEF(&_40$$73); - ZVAL_UNDEF(&_45$$75); - ZVAL_UNDEF(&_46$$76); - ZVAL_UNDEF(&_41); - ZVAL_UNDEF(&_17$$28); - ZVAL_UNDEF(&_18$$28); - ZVAL_UNDEF(&_30$$53); - ZVAL_UNDEF(&_31$$53); + ZVAL_UNDEF(&_68); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$9); + ZVAL_UNDEF(&_6$$9); + ZVAL_UNDEF(&_7$$9); + ZVAL_UNDEF(&_9$$12); + ZVAL_UNDEF(&_10$$12); + ZVAL_UNDEF(&_11$$12); + ZVAL_UNDEF(&_12$$20); + ZVAL_UNDEF(&_13$$20); + ZVAL_UNDEF(&_14$$20); + ZVAL_UNDEF(&_16$$21); + ZVAL_UNDEF(&_18$$24); + ZVAL_UNDEF(&_20$$24); + ZVAL_UNDEF(&_23$$32); + ZVAL_UNDEF(&_24$$32); + ZVAL_UNDEF(&_25$$32); + ZVAL_UNDEF(&_26$$35); + ZVAL_UNDEF(&_27$$35); + ZVAL_UNDEF(&_28$$35); + ZVAL_UNDEF(&_29$$43); + ZVAL_UNDEF(&_30$$43); + ZVAL_UNDEF(&_31$$43); + ZVAL_UNDEF(&_33$$44); + ZVAL_UNDEF(&_35$$47); + ZVAL_UNDEF(&_36$$47); + ZVAL_UNDEF(&_40$$53); + ZVAL_UNDEF(&_41$$57); + ZVAL_UNDEF(&_42$$57); + ZVAL_UNDEF(&_43$$57); + ZVAL_UNDEF(&_44$$60); + ZVAL_UNDEF(&_45$$60); + ZVAL_UNDEF(&_46$$60); + ZVAL_UNDEF(&_47$$66); + ZVAL_UNDEF(&_48$$66); + ZVAL_UNDEF(&_49$$66); + ZVAL_UNDEF(&_50$$69); + ZVAL_UNDEF(&_51$$69); + ZVAL_UNDEF(&_52$$69); + ZVAL_UNDEF(&_53$$74); + ZVAL_UNDEF(&_54$$74); + ZVAL_UNDEF(&_55$$74); + ZVAL_UNDEF(&_57$$73); + ZVAL_UNDEF(&_58$$77); + ZVAL_UNDEF(&_59$$77); + ZVAL_UNDEF(&_60$$77); + ZVAL_UNDEF(&_61$$83); + ZVAL_UNDEF(&_62$$83); + ZVAL_UNDEF(&_63$$83); + ZVAL_UNDEF(&_64$$87); + ZVAL_UNDEF(&_65$$87); + ZVAL_UNDEF(&_66$$87); + ZVAL_UNDEF(&_71$$89); + ZVAL_UNDEF(&_72$$90); + ZVAL_UNDEF(&_67); + ZVAL_UNDEF(&_21$$25); + ZVAL_UNDEF(&_22$$25); + ZVAL_UNDEF(&_37$$48); + ZVAL_UNDEF(&_38$$48); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) @@ -6948,11 +7333,6 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) useDynamicUpdate = zephir_get_boolval(&_1); zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&snapshot, &_0); - if (useDynamicUpdate) { - if (Z_TYPE_P(&snapshot) != IS_ARRAY) { - useDynamicUpdate = 0; - } - } ZEPHIR_CALL_METHOD(&dataTypes, metaData, "getdatatypes", NULL, 0, this_ptr); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, this_ptr); @@ -6968,50 +7348,55 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZEPHIR_INIT_NVAR(&columnMap); ZVAL_NULL(&columnMap); } - zephir_is_iterable(&nonPrimary, 0, "phalcon/Mvc/Model.zep", 4087); - if (Z_TYPE_P(&nonPrimary) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&nonPrimary), _2) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _2); - if (Z_TYPE_P(&columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&attributeField); - if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_4$$10); - object_init_ex(&_4$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_5$$10); - ZEPHIR_CONCAT_SVS(&_5$$10, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_4$$10, "__construct", &_6, 29, &_5$$10); + _2 = useDynamicUpdate; + if (_2) { + _2 = Z_TYPE_P(&snapshot) == IS_ARRAY; + } + if (EXPECTED(_2)) { + zephir_is_iterable(&nonPrimary, 0, "phalcon/Mvc/Model.zep", 4090); + if (Z_TYPE_P(&nonPrimary) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&nonPrimary), _3$$5) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _3$$5); + changed = 0; + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_5$$9); + object_init_ex(&_5$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_6$$9); + zephir_get_class(&_6$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_7$$9); + ZEPHIR_CONCAT_SVSVS(&_7$$9, "Column '", &field, "' in '", &_6$$9, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", &_8, 32, &_7$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(&_5$$9, "phalcon/Mvc/Model.zep", 3984); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_9$$12); + object_init_ex(&_9$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_10$$12); + zephir_get_class(&_10$$12, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_11$$12); + ZEPHIR_CONCAT_SVSVS(&_11$$12, "Column '", &field, "' in '", &_10$$12, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_9$$12, "__construct", &_8, 32, &_11$$12); zephir_check_call_status(); - zephir_throw_exception_debug(&_4$$10, "phalcon/Mvc/Model.zep", 3963); + zephir_throw_exception_debug(&_9$$12, "phalcon/Mvc/Model.zep", 3997); ZEPHIR_MM_RESTORE(); return; } - } - } else { - ZEPHIR_CPY_WRT(&attributeField, &field); - } - if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_7$$13); - object_init_ex(&_7$$13, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_8$$13); - ZEPHIR_CONCAT_SVS(&_8$$13, "Column '", &field, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_7$$13, "__construct", &_6, 29, &_8$$13); - zephir_check_call_status(); - zephir_throw_exception_debug(&_7$$13, "phalcon/Mvc/Model.zep", 3977); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&value); - if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - if (!(useDynamicUpdate)) { - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3989); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3990); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3991); - } else { + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { ZEPHIR_OBS_NVAR(&snapshotValue); if (!(zephir_array_isset_fetch(&snapshotValue, &snapshot, &attributeField, 0))) { changed = 1; @@ -7024,31 +7409,33 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) } else { ZEPHIR_OBS_NVAR(&dataType); if (UNEXPECTED(!(zephir_array_isset_fetch(&dataType, &dataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_9$$23); - object_init_ex(&_9$$23, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_10$$23); - ZEPHIR_CONCAT_SVS(&_10$$23, "Column '", &field, "' have not defined a data type"); - ZEPHIR_CALL_METHOD(NULL, &_9$$23, "__construct", &_6, 29, &_10$$23); + ZEPHIR_INIT_NVAR(&_12$$20); + object_init_ex(&_12$$20, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_13$$20); + zephir_get_class(&_13$$20, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_14$$20); + ZEPHIR_CONCAT_SVSVS(&_14$$20, "Column '", &field, "' in '", &_13$$20, "' have not defined a data type"); + ZEPHIR_CALL_METHOD(NULL, &_12$$20, "__construct", &_8, 32, &_14$$20); zephir_check_call_status(); - zephir_throw_exception_debug(&_9$$23, "phalcon/Mvc/Model.zep", 4016); + zephir_throw_exception_debug(&_12$$20, "phalcon/Mvc/Model.zep", 4027); ZEPHIR_MM_RESTORE(); return; } - _11$$22 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; - if (_11$$22) { - _11$$22 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); + _15$$19 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; + if (_15$$19) { + _15$$19 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); } - if (_11$$22) { - ZEPHIR_CALL_METHOD(&_12$$24, &snapshotValue, "getvalue", NULL, 0); + if (_15$$19) { + ZEPHIR_CALL_METHOD(&_16$$21, &snapshotValue, "getvalue", NULL, 0); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&snapshotValue, &_12$$24); + ZEPHIR_CPY_WRT(&snapshotValue, &_16$$21); } ZEPHIR_CPY_WRT(&updateValue, &value); - _13$$22 = Z_TYPE_P(&value) == IS_OBJECT; - if (_13$$22) { - _13$$22 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); + _17$$19 = Z_TYPE_P(&value) == IS_OBJECT; + if (_17$$19) { + _17$$19 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); } - if (_13$$22) { + if (_17$$19) { ZEPHIR_CALL_METHOD(&updateValue, &value, "getvalue", NULL, 0); zephir_check_call_status(); } @@ -7058,17 +7445,17 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) break; } if (ZEPHIR_IS_LONG(&dataType, 3) || ZEPHIR_IS_LONG(&dataType, 7)) { - ZEPHIR_CALL_FUNCTION(&_14$$27, "floatval", &_15, 18, &snapshotValue); + ZEPHIR_CALL_FUNCTION(&_18$$24, "floatval", &_19, 18, &snapshotValue); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_16$$27, "floatval", &_15, 18, &updateValue); + ZEPHIR_CALL_FUNCTION(&_20$$24, "floatval", &_19, 18, &updateValue); zephir_check_call_status(); - changed = !ZEPHIR_IS_IDENTICAL(&_14$$27, &_16$$27); + changed = !ZEPHIR_IS_IDENTICAL(&_18$$24, &_20$$24); break; } if (ZEPHIR_IS_LONG(&dataType, 0) || ZEPHIR_IS_LONG(&dataType, 1) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 4) || ZEPHIR_IS_LONG(&dataType, 5) || ZEPHIR_IS_LONG(&dataType, 6) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 14)) { - zephir_cast_to_string(&_17$$28, &snapshotValue); - zephir_cast_to_string(&_18$$28, &updateValue); - changed = !ZEPHIR_IS_IDENTICAL(&_17$$28, &_18$$28); + zephir_cast_to_string(&_21$$25, &snapshotValue); + zephir_cast_to_string(&_22$$25, &updateValue); + changed = !ZEPHIR_IS_IDENTICAL(&_21$$25, &_22$$25); break; } changed = !ZEPHIR_IS_EQUAL(&updateValue, &snapshotValue); @@ -7078,69 +7465,65 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) } } if (changed) { - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4067); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4068); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4069); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); } + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); } - zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); - zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &nonPrimary, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&field, &nonPrimary, "current", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "rewind", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&columnMap) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&attributeField); - if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_19$$35); - object_init_ex(&_19$$35, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_20$$35); - ZEPHIR_CONCAT_SVS(&_20$$35, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_19$$35, "__construct", &_6, 29, &_20$$35); + while (1) { + ZEPHIR_CALL_METHOD(&_4$$5, &nonPrimary, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4$$5)) { + break; + } + ZEPHIR_CALL_METHOD(&field, &nonPrimary, "current", NULL, 0); + zephir_check_call_status(); + changed = 0; + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_23$$32); + object_init_ex(&_23$$32, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_24$$32); + zephir_get_class(&_24$$32, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_25$$32); + ZEPHIR_CONCAT_SVSVS(&_25$$32, "Column '", &field, "' in '", &_24$$32, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_23$$32, "__construct", &_8, 32, &_25$$32); + zephir_check_call_status(); + zephir_throw_exception_debug(&_23$$32, "phalcon/Mvc/Model.zep", 3984); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_26$$35); + object_init_ex(&_26$$35, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_27$$35); + zephir_get_class(&_27$$35, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_28$$35); + ZEPHIR_CONCAT_SVSVS(&_28$$35, "Column '", &field, "' in '", &_27$$35, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_26$$35, "__construct", &_8, 32, &_28$$35); zephir_check_call_status(); - zephir_throw_exception_debug(&_19$$35, "phalcon/Mvc/Model.zep", 3963); + zephir_throw_exception_debug(&_26$$35, "phalcon/Mvc/Model.zep", 3997); ZEPHIR_MM_RESTORE(); return; } - } - } else { - ZEPHIR_CPY_WRT(&attributeField, &field); - } - if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_21$$38); - object_init_ex(&_21$$38, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_22$$38); - ZEPHIR_CONCAT_SVS(&_22$$38, "Column '", &field, "' have not defined a bind data type"); - ZEPHIR_CALL_METHOD(NULL, &_21$$38, "__construct", &_6, 29, &_22$$38); - zephir_check_call_status(); - zephir_throw_exception_debug(&_21$$38, "phalcon/Mvc/Model.zep", 3977); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&value); - if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - if (!(useDynamicUpdate)) { - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3989); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3990); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3991); - } else { + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { ZEPHIR_OBS_NVAR(&snapshotValue); if (!(zephir_array_isset_fetch(&snapshotValue, &snapshot, &attributeField, 0))) { changed = 1; @@ -7153,31 +7536,33 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) } else { ZEPHIR_OBS_NVAR(&dataType); if (UNEXPECTED(!(zephir_array_isset_fetch(&dataType, &dataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_23$$48); - object_init_ex(&_23$$48, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_24$$48); - ZEPHIR_CONCAT_SVS(&_24$$48, "Column '", &field, "' have not defined a data type"); - ZEPHIR_CALL_METHOD(NULL, &_23$$48, "__construct", &_6, 29, &_24$$48); + ZEPHIR_INIT_NVAR(&_29$$43); + object_init_ex(&_29$$43, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_30$$43); + zephir_get_class(&_30$$43, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_31$$43); + ZEPHIR_CONCAT_SVSVS(&_31$$43, "Column '", &field, "' in '", &_30$$43, "' have not defined a data type"); + ZEPHIR_CALL_METHOD(NULL, &_29$$43, "__construct", &_8, 32, &_31$$43); zephir_check_call_status(); - zephir_throw_exception_debug(&_23$$48, "phalcon/Mvc/Model.zep", 4016); + zephir_throw_exception_debug(&_29$$43, "phalcon/Mvc/Model.zep", 4027); ZEPHIR_MM_RESTORE(); return; } - _25$$47 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; - if (_25$$47) { - _25$$47 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); + _32$$42 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; + if (_32$$42) { + _32$$42 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); } - if (_25$$47) { - ZEPHIR_CALL_METHOD(&_26$$49, &snapshotValue, "getvalue", NULL, 0); + if (_32$$42) { + ZEPHIR_CALL_METHOD(&_33$$44, &snapshotValue, "getvalue", NULL, 0); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&snapshotValue, &_26$$49); + ZEPHIR_CPY_WRT(&snapshotValue, &_33$$44); } ZEPHIR_CPY_WRT(&updateValue, &value); - _27$$47 = Z_TYPE_P(&value) == IS_OBJECT; - if (_27$$47) { - _27$$47 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); + _34$$42 = Z_TYPE_P(&value) == IS_OBJECT; + if (_34$$42) { + _34$$42 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); } - if (_27$$47) { + if (_34$$42) { ZEPHIR_CALL_METHOD(&updateValue, &value, "getvalue", NULL, 0); zephir_check_call_status(); } @@ -7187,17 +7572,17 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) break; } if (ZEPHIR_IS_LONG(&dataType, 3) || ZEPHIR_IS_LONG(&dataType, 7)) { - ZEPHIR_CALL_FUNCTION(&_28$$52, "floatval", &_15, 18, &snapshotValue); + ZEPHIR_CALL_FUNCTION(&_35$$47, "floatval", &_19, 18, &snapshotValue); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_29$$52, "floatval", &_15, 18, &updateValue); + ZEPHIR_CALL_FUNCTION(&_36$$47, "floatval", &_19, 18, &updateValue); zephir_check_call_status(); - changed = !ZEPHIR_IS_IDENTICAL(&_28$$52, &_29$$52); + changed = !ZEPHIR_IS_IDENTICAL(&_35$$47, &_36$$47); break; } if (ZEPHIR_IS_LONG(&dataType, 0) || ZEPHIR_IS_LONG(&dataType, 1) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 4) || ZEPHIR_IS_LONG(&dataType, 5) || ZEPHIR_IS_LONG(&dataType, 6) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 14)) { - zephir_cast_to_string(&_30$$53, &snapshotValue); - zephir_cast_to_string(&_31$$53, &updateValue); - changed = !ZEPHIR_IS_IDENTICAL(&_30$$53, &_31$$53); + zephir_cast_to_string(&_37$$48, &snapshotValue); + zephir_cast_to_string(&_38$$48, &updateValue); + changed = !ZEPHIR_IS_IDENTICAL(&_37$$48, &_38$$48); break; } changed = !ZEPHIR_IS_EQUAL(&updateValue, &snapshotValue); @@ -7207,28 +7592,146 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) } } if (changed) { - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4067); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4068); - zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4069); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); } + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); + if (!(zephir_fast_count_int(&fields))) { + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); + RETURN_MM_BOOL(1); + } + } else { + zephir_is_iterable(&nonPrimary, 0, "phalcon/Mvc/Model.zep", 4145); + if (Z_TYPE_P(&nonPrimary) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&nonPrimary), _39$$53) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _39$$53); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_41$$57); + object_init_ex(&_41$$57, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_42$$57); + zephir_get_class(&_42$$57, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_43$$57); + ZEPHIR_CONCAT_SVSVS(&_43$$57, "Column '", &field, "' in '", &_42$$57, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_41$$57, "__construct", &_8, 32, &_43$$57); + zephir_check_call_status(); + zephir_throw_exception_debug(&_41$$57, "phalcon/Mvc/Model.zep", 4108); + ZEPHIR_MM_RESTORE(); + return; } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_44$$60); + object_init_ex(&_44$$60, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_45$$60); + zephir_get_class(&_45$$60, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_46$$60); + ZEPHIR_CONCAT_SVSVS(&_46$$60, "Column '", &field, "' in '", &_45$$60, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_44$$60, "__construct", &_8, 32, &_46$$60); + zephir_check_call_status(); + zephir_throw_exception_debug(&_44$$60, "phalcon/Mvc/Model.zep", 4122); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4133); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4135); zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } else { zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); - zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); - zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4139); + zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4140); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4141); } } - ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "next", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_40$$53, &nonPrimary, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_40$$53)) { + break; + } + ZEPHIR_CALL_METHOD(&field, &nonPrimary, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_47$$66); + object_init_ex(&_47$$66, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_48$$66); + zephir_get_class(&_48$$66, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_49$$66); + ZEPHIR_CONCAT_SVSVS(&_49$$66, "Column '", &field, "' in '", &_48$$66, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_47$$66, "__construct", &_8, 32, &_49$$66); + zephir_check_call_status(); + zephir_throw_exception_debug(&_47$$66, "phalcon/Mvc/Model.zep", 4108); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_50$$69); + object_init_ex(&_50$$69, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_51$$69); + zephir_get_class(&_51$$69, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_52$$69); + ZEPHIR_CONCAT_SVSVS(&_52$$69, "Column '", &field, "' in '", &_51$$69, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_50$$69, "__construct", &_8, 32, &_52$$69); + zephir_check_call_status(); + zephir_throw_exception_debug(&_50$$69, "phalcon/Mvc/Model.zep", 4122); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4133); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4135); + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4139); + zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4140); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4141); + } + } + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&field); } - ZEPHIR_INIT_NVAR(&field); if (!(zephir_fast_count_int(&fields))) { - if (useDynamicUpdate) { - zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); - } RETURN_MM_BOOL(1); } zephir_read_property(&_0, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); @@ -7239,27 +7742,38 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZEPHIR_CALL_METHOD(&primaryKeys, metaData, "getprimarykeyattributes", NULL, 0, this_ptr); zephir_check_call_status(); if (UNEXPECTED(!(zephir_fast_count_int(&primaryKeys)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/Mvc/Model.zep", 4110); + ZEPHIR_INIT_VAR(&_53$$74); + object_init_ex(&_53$$74, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_54$$74); + zephir_get_class(&_54$$74, this_ptr, 0); + ZEPHIR_INIT_VAR(&_55$$74); + ZEPHIR_CONCAT_SVS(&_55$$74, "A primary key must be defined in the model in order to perform the operation in '", &_54$$74, "'"); + ZEPHIR_CALL_METHOD(NULL, &_53$$74, "__construct", &_8, 32, &_55$$74); + zephir_check_call_status(); + zephir_throw_exception_debug(&_53$$74, "phalcon/Mvc/Model.zep", 4168); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_NVAR(&uniqueParams); array_init(&uniqueParams); - zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4137); + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4195); if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _32$$59) + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _56$$73) { ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _32$$59); + ZVAL_COPY(&field, _56$$73); if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_34$$63); - object_init_ex(&_34$$63, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_35$$63); - ZEPHIR_CONCAT_SVS(&_35$$63, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_34$$63, "__construct", &_6, 29, &_35$$63); + ZEPHIR_INIT_NVAR(&_58$$77); + object_init_ex(&_58$$77, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_59$$77); + zephir_get_class(&_59$$77, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_60$$77); + ZEPHIR_CONCAT_SVSVS(&_60$$77, "Column '", &field, "' in '", &_59$$77, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_58$$77, "__construct", &_8, 32, &_60$$77); zephir_check_call_status(); - zephir_throw_exception_debug(&_34$$63, "phalcon/Mvc/Model.zep", 4123); + zephir_throw_exception_debug(&_58$$77, "phalcon/Mvc/Model.zep", 4181); ZEPHIR_MM_RESTORE(); return; } @@ -7269,19 +7783,19 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); - zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4131); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4189); } else { zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); - zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4192); } } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_33$$59, &primaryKeys, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_57$$73, &primaryKeys, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_33$$59)) { + if (!zend_is_true(&_57$$73)) { break; } ZEPHIR_CALL_METHOD(&field, &primaryKeys, "current", NULL, 0); @@ -7289,13 +7803,15 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_36$$69); - object_init_ex(&_36$$69, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_37$$69); - ZEPHIR_CONCAT_SVS(&_37$$69, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_36$$69, "__construct", &_6, 29, &_37$$69); + ZEPHIR_INIT_NVAR(&_61$$83); + object_init_ex(&_61$$83, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_62$$83); + zephir_get_class(&_62$$83, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_63$$83); + ZEPHIR_CONCAT_SVSVS(&_63$$83, "Column '", &field, "' in '", &_62$$83, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_61$$83, "__construct", &_8, 32, &_63$$83); zephir_check_call_status(); - zephir_throw_exception_debug(&_36$$69, "phalcon/Mvc/Model.zep", 4123); + zephir_throw_exception_debug(&_61$$83, "phalcon/Mvc/Model.zep", 4181); ZEPHIR_MM_RESTORE(); return; } @@ -7305,10 +7821,10 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); - zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4131); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4189); } else { zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); - zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4192); } ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); zephir_check_call_status(); @@ -7317,41 +7833,41 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) ZEPHIR_INIT_NVAR(&field); } if (Z_TYPE_P(table) == IS_ARRAY) { - zephir_array_fetch_long(&_38$$73, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4143); - zephir_array_fetch_long(&_39$$73, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4143); - ZEPHIR_INIT_VAR(&_40$$73); - ZEPHIR_CONCAT_VSV(&_40$$73, &_38$$73, ".", &_39$$73); - ZEPHIR_CPY_WRT(table, &_40$$73); - } - ZEPHIR_INIT_VAR(&_41); - zephir_create_array(&_41, 3, 0); - zephir_array_update_string(&_41, SL("conditions"), &uniqueKey, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_41, SL("bind"), &uniqueParams, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_VAR(&_42); - zephir_read_property(&_42, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC); - zephir_array_update_string(&_41, SL("bindTypes"), &_42, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&success, connection, "update", NULL, 0, table, &fields, &values, &_41, &bindTypes); - zephir_check_call_status(); - _43 = zephir_is_true(&success); - if (_43) { + zephir_array_fetch_long(&_64$$87, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4201); + zephir_array_fetch_long(&_65$$87, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4201); + ZEPHIR_INIT_VAR(&_66$$87); + ZEPHIR_CONCAT_VSV(&_66$$87, &_64$$87, ".", &_65$$87); + ZEPHIR_CPY_WRT(table, &_66$$87); + } + ZEPHIR_INIT_VAR(&_67); + zephir_create_array(&_67, 3, 0); + zephir_array_update_string(&_67, SL("conditions"), &uniqueKey, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_67, SL("bind"), &uniqueParams, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_VAR(&_68); + zephir_read_property(&_68, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC); + zephir_array_update_string(&_67, SL("bindTypes"), &_68, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&success, connection, "update", NULL, 0, table, &fields, &values, &_67, &bindTypes); + zephir_check_call_status(); + _69 = zephir_is_true(&success); + if (_69) { ZEPHIR_CALL_METHOD(&_1, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); - _43 = zephir_is_true(&_1); + _69 = zephir_is_true(&_1); } - _44 = _43; - if (_44) { - _44 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; + _70 = _69; + if (_70) { + _70 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; } - if (_44) { + if (_70) { if (Z_TYPE_P(&snapshot) == IS_ARRAY) { zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); - ZEPHIR_INIT_VAR(&_45$$75); - zephir_fast_array_merge(&_45$$75, &snapshot, &newSnapshot); - zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &_45$$75); + ZEPHIR_INIT_VAR(&_71$$89); + zephir_fast_array_merge(&_71$$89, &snapshot, &newSnapshot); + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &_71$$89); } else { - ZEPHIR_INIT_VAR(&_46$$76); - array_init(&_46$$76); - zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &_46$$76); + ZEPHIR_INIT_VAR(&_72$$90); + array_init(&_72$$90); + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &_72$$90); zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &newSnapshot); } } @@ -7365,11 +7881,11 @@ PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) */ PHP_METHOD(Phalcon_Mvc_Model, has) { - zend_bool _6$$11, _14$$19; + zend_bool _7$$11, _17$$19; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL, *_10 = NULL, *_18 = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_22 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, numberEmpty = 0, numberPrimary = 0; - zval *metaData, metaData_sub, *connection, connection_sub, __$null, attributeField, bindDataTypes, columnMap, field, joinWhere, num, primaryKeys, schema, source, table, type, uniqueKey, uniqueParams, uniqueTypes, value, wherePk, _0, _23, _24, _25, _26, *_1$$3, _2$$3, _3$$9, _4$$9, _7$$14, _8$$14, _9$$7, _11$$7, _12$$17, _13$$17, _15$$22, _16$$22, _17$$15, _19$$15, _20$$25, _21$$26, _22$$27, _27$$30, _28$$31; + zval *metaData, metaData_sub, *connection, connection_sub, __$null, attributeField, bindDataTypes, columnMap, field, joinWhere, num, primaryKeys, schema, source, table, type, uniqueKey, uniqueParams, uniqueTypes, value, wherePk, _0, _27, _28, _29, _30, *_1$$3, _2$$3, _3$$9, _4$$9, _5$$9, _8$$14, _9$$14, _10$$14, _11$$7, _13$$7, _14$$17, _15$$17, _16$$17, _18$$22, _19$$22, _20$$22, _21$$15, _23$$15, _24$$25, _25$$26, _26$$27, _31$$30, _32$$31; zval *this_ptr = getThis(); ZVAL_UNDEF(&metaData_sub); @@ -7392,28 +7908,32 @@ PHP_METHOD(Phalcon_Mvc_Model, has) ZVAL_UNDEF(&value); ZVAL_UNDEF(&wherePk); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_23); - ZVAL_UNDEF(&_24); - ZVAL_UNDEF(&_25); - ZVAL_UNDEF(&_26); + ZVAL_UNDEF(&_27); + ZVAL_UNDEF(&_28); + ZVAL_UNDEF(&_29); + ZVAL_UNDEF(&_30); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$9); ZVAL_UNDEF(&_4$$9); - ZVAL_UNDEF(&_7$$14); + ZVAL_UNDEF(&_5$$9); ZVAL_UNDEF(&_8$$14); - ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_9$$14); + ZVAL_UNDEF(&_10$$14); ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$17); - ZVAL_UNDEF(&_13$$17); - ZVAL_UNDEF(&_15$$22); - ZVAL_UNDEF(&_16$$22); - ZVAL_UNDEF(&_17$$15); - ZVAL_UNDEF(&_19$$15); - ZVAL_UNDEF(&_20$$25); - ZVAL_UNDEF(&_21$$26); - ZVAL_UNDEF(&_22$$27); - ZVAL_UNDEF(&_27$$30); - ZVAL_UNDEF(&_28$$31); + ZVAL_UNDEF(&_13$$7); + ZVAL_UNDEF(&_14$$17); + ZVAL_UNDEF(&_15$$17); + ZVAL_UNDEF(&_16$$17); + ZVAL_UNDEF(&_18$$22); + ZVAL_UNDEF(&_19$$22); + ZVAL_UNDEF(&_20$$22); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_23$$15); + ZVAL_UNDEF(&_24$$25); + ZVAL_UNDEF(&_25$$26); + ZVAL_UNDEF(&_26$$27); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$31); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -7456,7 +7976,7 @@ PHP_METHOD(Phalcon_Mvc_Model, has) array_init(&uniqueParams); ZEPHIR_INIT_NVAR(&uniqueTypes); array_init(&uniqueTypes); - zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4267); + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4325); if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _1$$3) { @@ -7468,10 +7988,12 @@ PHP_METHOD(Phalcon_Mvc_Model, has) ZEPHIR_INIT_NVAR(&_3$$9); object_init_ex(&_3$$9, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_4$$9); - ZEPHIR_CONCAT_SVS(&_4$$9, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_3$$9, "__construct", &_5, 29, &_4$$9); + zephir_get_class(&_4$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_5$$9); + ZEPHIR_CONCAT_SVSVS(&_5$$9, "Column '", &field, "' in '", &_4$$9, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_3$$9, "__construct", &_6, 32, &_5$$9); zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$9, "phalcon/Mvc/Model.zep", 4226); + zephir_throw_exception_debug(&_3$$9, "phalcon/Mvc/Model.zep", 4284); ZEPHIR_MM_RESTORE(); return; } @@ -7482,36 +8004,38 @@ PHP_METHOD(Phalcon_Mvc_Model, has) ZVAL_NULL(&value); ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - _6$$11 = Z_TYPE_P(&value) == IS_NULL; - if (!(_6$$11)) { - _6$$11 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + _7$$11 = Z_TYPE_P(&value) == IS_NULL; + if (!(_7$$11)) { + _7$$11 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); } - if (_6$$11) { + if (_7$$11) { numberEmpty++; } - zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4247); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4305); } else { - zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4249); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4307); numberEmpty++; } ZEPHIR_OBS_NVAR(&type); if (UNEXPECTED(!(zephir_array_isset_fetch(&type, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_7$$14); - object_init_ex(&_7$$14, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_8$$14); - ZEPHIR_CONCAT_SVS(&_8$$14, "Column '", &field, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, &_7$$14, "__construct", &_5, 29, &_8$$14); + object_init_ex(&_8$$14, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$14); + zephir_get_class(&_9$$14, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$14); + ZEPHIR_CONCAT_SVSVS(&_10$$14, "Column '", &field, "' in '", &_9$$14, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, &_8$$14, "__construct", &_6, 32, &_10$$14); zephir_check_call_status(); - zephir_throw_exception_debug(&_7$$14, "phalcon/Mvc/Model.zep", 4256); + zephir_throw_exception_debug(&_8$$14, "phalcon/Mvc/Model.zep", 4314); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4259); - ZEPHIR_CALL_METHOD(&_9$$7, connection, "escapeidentifier", &_10, 0, &field); + zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4317); + ZEPHIR_CALL_METHOD(&_11$$7, connection, "escapeidentifier", &_12, 0, &field); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_11$$7); - ZEPHIR_CONCAT_VS(&_11$$7, &_9$$7, " = ?"); - zephir_array_append(&wherePk, &_11$$7, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4260); + ZEPHIR_INIT_NVAR(&_13$$7); + ZEPHIR_CONCAT_VS(&_13$$7, &_11$$7, " = ?"); + zephir_array_append(&wherePk, &_13$$7, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4318); } ZEND_HASH_FOREACH_END(); } else { ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); @@ -7527,13 +8051,15 @@ PHP_METHOD(Phalcon_Mvc_Model, has) if (Z_TYPE_P(&columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_12$$17); - object_init_ex(&_12$$17, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_13$$17); - ZEPHIR_CONCAT_SVS(&_13$$17, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_12$$17, "__construct", &_5, 29, &_13$$17); + ZEPHIR_INIT_NVAR(&_14$$17); + object_init_ex(&_14$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$17); + zephir_get_class(&_15$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$17); + ZEPHIR_CONCAT_SVSVS(&_16$$17, "Column '", &field, "' in '", &_15$$17, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_14$$17, "__construct", &_6, 32, &_16$$17); zephir_check_call_status(); - zephir_throw_exception_debug(&_12$$17, "phalcon/Mvc/Model.zep", 4226); + zephir_throw_exception_debug(&_14$$17, "phalcon/Mvc/Model.zep", 4284); ZEPHIR_MM_RESTORE(); return; } @@ -7544,36 +8070,38 @@ PHP_METHOD(Phalcon_Mvc_Model, has) ZVAL_NULL(&value); ZEPHIR_OBS_NVAR(&value); if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { - _14$$19 = Z_TYPE_P(&value) == IS_NULL; - if (!(_14$$19)) { - _14$$19 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + _17$$19 = Z_TYPE_P(&value) == IS_NULL; + if (!(_17$$19)) { + _17$$19 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); } - if (_14$$19) { + if (_17$$19) { numberEmpty++; } - zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4247); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4305); } else { - zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4249); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4307); numberEmpty++; } ZEPHIR_OBS_NVAR(&type); if (UNEXPECTED(!(zephir_array_isset_fetch(&type, &bindDataTypes, &field, 0)))) { - ZEPHIR_INIT_NVAR(&_15$$22); - object_init_ex(&_15$$22, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_16$$22); - ZEPHIR_CONCAT_SVS(&_16$$22, "Column '", &field, "' isn't part of the table columns"); - ZEPHIR_CALL_METHOD(NULL, &_15$$22, "__construct", &_5, 29, &_16$$22); + ZEPHIR_INIT_NVAR(&_18$$22); + object_init_ex(&_18$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_19$$22); + zephir_get_class(&_19$$22, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_20$$22); + ZEPHIR_CONCAT_SVSVS(&_20$$22, "Column '", &field, "' in '", &_19$$22, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, &_18$$22, "__construct", &_6, 32, &_20$$22); zephir_check_call_status(); - zephir_throw_exception_debug(&_15$$22, "phalcon/Mvc/Model.zep", 4256); + zephir_throw_exception_debug(&_18$$22, "phalcon/Mvc/Model.zep", 4314); ZEPHIR_MM_RESTORE(); return; } - zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4259); - ZEPHIR_CALL_METHOD(&_17$$15, connection, "escapeidentifier", &_18, 0, &field); + zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4317); + ZEPHIR_CALL_METHOD(&_21$$15, connection, "escapeidentifier", &_22, 0, &field); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_19$$15); - ZEPHIR_CONCAT_VS(&_19$$15, &_17$$15, " = ?"); - zephir_array_append(&wherePk, &_19$$15, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4260); + ZEPHIR_INIT_NVAR(&_23$$15); + ZEPHIR_CONCAT_VS(&_23$$15, &_21$$15, " = ?"); + zephir_array_append(&wherePk, &_23$$15, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4318); ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); zephir_check_call_status(); } @@ -7594,20 +8122,20 @@ PHP_METHOD(Phalcon_Mvc_Model, has) RETURN_MM_BOOL(1); } if (Z_TYPE_P(&uniqueKey) == IS_NULL) { - zephir_read_property(&_20$$25, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueKey, &_20$$25); + zephir_read_property(&_24$$25, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_24$$25); } if (Z_TYPE_P(&uniqueParams) == IS_NULL) { - zephir_read_property(&_21$$26, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueParams, &_21$$26); + zephir_read_property(&_25$$26, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueParams, &_25$$26); } if (Z_TYPE_P(&uniqueTypes) == IS_NULL) { - zephir_read_property(&_22$$27, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&uniqueTypes, &_22$$27); + zephir_read_property(&_26$$27, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueTypes, &_26$$27); } - ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 420); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 421); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); zephir_check_call_status(); if (zephir_is_true(&schema)) { ZEPHIR_INIT_VAR(&table); @@ -7617,23 +8145,23 @@ PHP_METHOD(Phalcon_Mvc_Model, has) } else { ZEPHIR_CPY_WRT(&table, &source); } - ZEPHIR_CALL_METHOD(&_23, connection, "escapeidentifier", NULL, 0, &table); + ZEPHIR_CALL_METHOD(&_27, connection, "escapeidentifier", NULL, 0, &table); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_24); - ZEPHIR_CONCAT_SVSV(&_24, "SELECT COUNT(*) \"rowcount\" FROM ", &_23, " WHERE ", &uniqueKey); - ZVAL_NULL(&_25); - ZEPHIR_CALL_METHOD(&num, connection, "fetchone", NULL, 0, &_24, &_25, &uniqueParams, &uniqueTypes); - zephir_check_call_status(); - zephir_array_fetch_string(&_26, &num, SL("rowcount"), PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4321); - if (zephir_is_true(&_26)) { - ZEPHIR_INIT_ZVAL_NREF(_27$$30); - ZVAL_LONG(&_27$$30, 0); - zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_27$$30); + ZEPHIR_INIT_VAR(&_28); + ZEPHIR_CONCAT_SVSV(&_28, "SELECT COUNT(*) \"rowcount\" FROM ", &_27, " WHERE ", &uniqueKey); + ZVAL_NULL(&_29); + ZEPHIR_CALL_METHOD(&num, connection, "fetchone", NULL, 0, &_28, &_29, &uniqueParams, &uniqueTypes); + zephir_check_call_status(); + zephir_array_fetch_string(&_30, &num, SL("rowcount"), PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4379); + if (zephir_is_true(&_30)) { + ZEPHIR_INIT_ZVAL_NREF(_31$$30); + ZVAL_LONG(&_31$$30, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_31$$30); RETURN_MM_BOOL(1); } else { - ZEPHIR_INIT_ZVAL_NREF(_28$$31); - ZVAL_LONG(&_28$$31, 1); - zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_28$$31); + ZEPHIR_INIT_ZVAL_NREF(_32$$31); + ZVAL_LONG(&_32$$31, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_32$$31); } RETURN_MM_BOOL(0); } @@ -7837,7 +8365,7 @@ PHP_METHOD(Phalcon_Mvc_Model, groupResult) ZEPHIR_INIT_VAR(¶ms); array_init(¶ms); if (Z_TYPE_P(parameters) != IS_NULL) { - zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4426); + zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4484); } } else { ZEPHIR_CPY_WRT(¶ms, parameters); @@ -7881,10 +8409,10 @@ PHP_METHOD(Phalcon_Mvc_Model, groupResult) } if (zephir_array_isset_string(¶ms, SL("bind"))) { ZEPHIR_OBS_NVAR(&bindParams); - zephir_array_fetch_string(&bindParams, ¶ms, SL("bind"), PH_NOISY, "phalcon/Mvc/Model.zep", 4469); + zephir_array_fetch_string(&bindParams, ¶ms, SL("bind"), PH_NOISY, "phalcon/Mvc/Model.zep", 4527); if (zephir_array_isset_string(¶ms, SL("bindTypes"))) { ZEPHIR_OBS_NVAR(&bindTypes); - zephir_array_fetch_string(&bindTypes, ¶ms, SL("bindTypes"), PH_NOISY, "phalcon/Mvc/Model.zep", 4472); + zephir_array_fetch_string(&bindTypes, ¶ms, SL("bindTypes"), PH_NOISY, "phalcon/Mvc/Model.zep", 4530); } } ZEPHIR_OBS_VAR(&cache); @@ -7911,16 +8439,15 @@ PHP_METHOD(Phalcon_Mvc_Model, groupResult) */ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) { - zend_class_entry *_13; + zend_class_entry *_15; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval arguments, _9$$14; - zval *method_param = NULL, *arguments_param = NULL, extraMethod, type, modelName, value, model, attributes, field, extraMethodFirst, metaData, params, _12, _0$$3, _1$$4, _2$$5, _3$$7, _5$$13, _6$$13, _7$$14, _8$$14, _10$$15, _11$$15; - zval method, _4$$7; + zval arguments, _11$$14; + zval *method_param = NULL, *arguments_param = NULL, extraMethod, type, modelName, value, model, attributes, field, extraMethodFirst, metaData, params, _14, _0$$3, _1$$4, _2$$5, _3$$7, _4$$7, _5$$7, _6$$13, _7$$13, _8$$13, _9$$14, _10$$14, _12$$15, _13$$15; + zval method; zval *this_ptr = getThis(); ZVAL_UNDEF(&method); - ZVAL_UNDEF(&_4$$7); ZVAL_UNDEF(&extraMethod); ZVAL_UNDEF(&type); ZVAL_UNDEF(&modelName); @@ -7931,19 +8458,22 @@ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) ZVAL_UNDEF(&extraMethodFirst); ZVAL_UNDEF(&metaData); ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_14); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$7); - ZVAL_UNDEF(&_5$$13); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); ZVAL_UNDEF(&_6$$13); - ZVAL_UNDEF(&_7$$14); - ZVAL_UNDEF(&_8$$14); - ZVAL_UNDEF(&_10$$15); - ZVAL_UNDEF(&_11$$15); - ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_7$$13); + ZVAL_UNDEF(&_8$$13); ZVAL_UNDEF(&_9$$14); + ZVAL_UNDEF(&_10$$14); + ZVAL_UNDEF(&_12$$15); + ZVAL_UNDEF(&_13$$15); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_11$$14); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -7989,10 +8519,12 @@ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) ZEPHIR_INIT_VAR(&_3$$7); object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_4$$7); - ZEPHIR_CONCAT_SVS(&_4$$7, "The static method '", &method, "' requires one argument"); - ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", NULL, 29, &_4$$7); + zephir_get_called_class(&_4$$7); + ZEPHIR_INIT_VAR(&_5$$7); + ZEPHIR_CONCAT_SVSVS(&_5$$7, "The static method '", &method, "' in '", &_4$$7, "' requires one argument"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", NULL, 32, &_5$$7); zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 4551); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 4609); ZEPHIR_MM_RESTORE(); return; } @@ -8010,7 +8542,7 @@ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) if (zephir_array_isset(&attributes, &extraMethod)) { ZEPHIR_CPY_WRT(&field, &extraMethod); } else { - ZEPHIR_CALL_FUNCTION(&extraMethodFirst, "lcfirst", NULL, 73, &extraMethod); + ZEPHIR_CALL_FUNCTION(&extraMethodFirst, "lcfirst", NULL, 76, &extraMethod); zephir_check_call_status(); if (zephir_array_isset(&attributes, &extraMethodFirst)) { ZEPHIR_CPY_WRT(&field, &extraMethodFirst); @@ -8018,13 +8550,15 @@ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) ZEPHIR_INIT_NVAR(&field); zephir_uncamelize(&field, &extraMethod, NULL ); if (UNEXPECTED(!(zephir_array_isset(&attributes, &field)))) { - ZEPHIR_INIT_VAR(&_5$$13); - object_init_ex(&_5$$13, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_6$$13); - ZEPHIR_CONCAT_SVS(&_6$$13, "Cannot resolve attribute '", &extraMethod, "' in the model"); - ZEPHIR_CALL_METHOD(NULL, &_5$$13, "__construct", NULL, 29, &_6$$13); + object_init_ex(&_6$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$13); + zephir_get_called_class(&_7$$13); + ZEPHIR_INIT_VAR(&_8$$13); + ZEPHIR_CONCAT_SVSVS(&_8$$13, "Cannot resolve attribute '", &extraMethod, "' in the model '", &_7$$13, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$13, "__construct", NULL, 32, &_8$$13); zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$13, "phalcon/Mvc/Model.zep", 4588); + zephir_throw_exception_debug(&_6$$13, "phalcon/Mvc/Model.zep", 4646); ZEPHIR_MM_RESTORE(); return; } @@ -8034,32 +8568,32 @@ PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) zephir_array_isset_long_fetch(&value, &arguments, 0, 0); ZEPHIR_INIT_VAR(¶ms); if (Z_TYPE_P(&value) != IS_NULL) { - ZEPHIR_INIT_VAR(&_7$$14); - zephir_create_array(&_7$$14, 2, 0); - ZEPHIR_INIT_VAR(&_8$$14); - ZEPHIR_CONCAT_SVS(&_8$$14, "[", &field, "] = ?0"); - zephir_array_update_string(&_7$$14, SL("conditions"), &_8$$14, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(&_9$$14); - zephir_create_array(&_9$$14, 1, 0); - zephir_array_fast_append(&_9$$14, &value); - zephir_array_update_string(&_7$$14, SL("bind"), &_9$$14, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(¶ms, &_7$$14); + zephir_create_array(&_9$$14, 2, 0); + ZEPHIR_INIT_VAR(&_10$$14); + ZEPHIR_CONCAT_SVS(&_10$$14, "[", &field, "] = ?0"); + zephir_array_update_string(&_9$$14, SL("conditions"), &_10$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&_11$$14); + zephir_create_array(&_11$$14, 1, 0); + zephir_array_fast_append(&_11$$14, &value); + zephir_array_update_string(&_9$$14, SL("bind"), &_11$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(¶ms, &_9$$14); } else { - ZEPHIR_INIT_VAR(&_10$$15); - zephir_create_array(&_10$$15, 1, 0); - ZEPHIR_INIT_VAR(&_11$$15); - ZEPHIR_CONCAT_SVS(&_11$$15, "[", &field, "] IS NULL"); - zephir_array_update_string(&_10$$15, SL("conditions"), &_11$$15, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(¶ms, &_10$$15); + ZEPHIR_INIT_VAR(&_12$$15); + zephir_create_array(&_12$$15, 1, 0); + ZEPHIR_INIT_VAR(&_13$$15); + ZEPHIR_CONCAT_SVS(&_13$$15, "[", &field, "] IS NULL"); + zephir_array_update_string(&_12$$15, SL("conditions"), &_13$$15, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(¶ms, &_12$$15); } zephir_array_unset_long(&arguments, 0, PH_SEPARATE); zephir_array_unset_string(&arguments, SL("conditions"), PH_SEPARATE); zephir_array_unset_string(&arguments, SL("bind"), PH_SEPARATE); - ZEPHIR_INIT_VAR(&_12); - zephir_fast_array_merge(&_12, ¶ms, &arguments); - ZEPHIR_CPY_WRT(¶ms, &_12); - _13 = zephir_fetch_class(&modelName); - ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(_13, type, NULL, 0, ¶ms); + ZEPHIR_INIT_VAR(&_14); + zephir_fast_array_merge(&_14, ¶ms, &arguments); + ZEPHIR_CPY_WRT(¶ms, &_14); + _15 = zephir_fetch_class(&modelName); + ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(_15, type, NULL, 0, ¶ms); zephir_check_call_status(); RETURN_MM(); } @@ -8128,12 +8662,13 @@ PHP_METHOD(Phalcon_Mvc_Model, possibleSetter) */ PHP_METHOD(Phalcon_Mvc_Model, preSave) { + zval _16$$32, _29$$52; zval eventName; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_8 = NULL, *_16 = NULL; + zephir_fcall_cache_entry *_9 = NULL, *_19 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool exists, error = 0, isNull = 0, _9$$27, _10$$27, _11$$27, _19$$47, _20$$47, _21$$47; - zval *metaData, metaData_sub, *exists_param = NULL, *identityField, identityField_sub, __$true, __$false, notNull, columnMap, dataTypeNumeric, automaticAttributes, defaultValues, field, attributeField, value, emptyStringValues, _27, _28, _0$$3, _1$$3, _2$$3, _3$$8, *_4$$11, _5$$11, _6$$19, _7$$19, _12$$27, _13$$32, _14$$32, _15$$32, _17$$39, _18$$39, _22$$47, _23$$52, _24$$52, _25$$52, _26$$57, _29$$59, _30$$60, _31$$60, _32$$60, _33$$60, _34$$60, _35$$60; + zend_bool exists, error = 0, isNull = 0, _10$$27, _11$$27, _12$$27, _23$$47, _24$$47, _25$$47; + zval *metaData, metaData_sub, *exists_param = NULL, *identityField, identityField_sub, __$true, __$false, notNull, columnMap, dataTypeNumeric, automaticAttributes, defaultValues, field, attributeField, value, emptyStringValues, _33, _34, _0$$3, _1$$3, _2$$3, _3$$8, *_4$$11, _5$$11, _6$$19, _7$$19, _8$$19, _13$$27, _14$$32, _15$$32, _17$$32, _18$$32, _20$$39, _21$$39, _22$$39, _26$$47, _27$$52, _28$$52, _30$$52, _31$$52, _32$$57, _35$$59, _36$$60, _37$$60, _38$$60, _39$$60, _40$$60, _41$$60; zval *this_ptr = getThis(); ZVAL_UNDEF(&metaData_sub); @@ -8149,8 +8684,8 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZVAL_UNDEF(&attributeField); ZVAL_UNDEF(&value); ZVAL_UNDEF(&emptyStringValues); - ZVAL_UNDEF(&_27); - ZVAL_UNDEF(&_28); + ZVAL_UNDEF(&_33); + ZVAL_UNDEF(&_34); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); @@ -8158,25 +8693,31 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZVAL_UNDEF(&_5$$11); ZVAL_UNDEF(&_6$$19); ZVAL_UNDEF(&_7$$19); - ZVAL_UNDEF(&_12$$27); - ZVAL_UNDEF(&_13$$32); + ZVAL_UNDEF(&_8$$19); + ZVAL_UNDEF(&_13$$27); ZVAL_UNDEF(&_14$$32); ZVAL_UNDEF(&_15$$32); - ZVAL_UNDEF(&_17$$39); - ZVAL_UNDEF(&_18$$39); - ZVAL_UNDEF(&_22$$47); - ZVAL_UNDEF(&_23$$52); - ZVAL_UNDEF(&_24$$52); - ZVAL_UNDEF(&_25$$52); - ZVAL_UNDEF(&_26$$57); - ZVAL_UNDEF(&_29$$59); - ZVAL_UNDEF(&_30$$60); - ZVAL_UNDEF(&_31$$60); - ZVAL_UNDEF(&_32$$60); - ZVAL_UNDEF(&_33$$60); - ZVAL_UNDEF(&_34$$60); - ZVAL_UNDEF(&_35$$60); + ZVAL_UNDEF(&_17$$32); + ZVAL_UNDEF(&_18$$32); + ZVAL_UNDEF(&_20$$39); + ZVAL_UNDEF(&_21$$39); + ZVAL_UNDEF(&_22$$39); + ZVAL_UNDEF(&_26$$47); + ZVAL_UNDEF(&_27$$52); + ZVAL_UNDEF(&_28$$52); + ZVAL_UNDEF(&_30$$52); + ZVAL_UNDEF(&_31$$52); + ZVAL_UNDEF(&_32$$57); + ZVAL_UNDEF(&_35$$59); + ZVAL_UNDEF(&_36$$60); + ZVAL_UNDEF(&_37$$60); + ZVAL_UNDEF(&_38$$60); + ZVAL_UNDEF(&_39$$60); + ZVAL_UNDEF(&_40$$60); + ZVAL_UNDEF(&_41$$60); ZVAL_UNDEF(&eventName); + ZVAL_UNDEF(&_16$$32); + ZVAL_UNDEF(&_29$$52); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) @@ -8214,7 +8755,7 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) } } if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { - ZEPHIR_CALL_METHOD(&_3$$8, this_ptr, "checkforeignkeysrestrict", NULL, 430); + ZEPHIR_CALL_METHOD(&_3$$8, this_ptr, "checkforeignkeysrestrict", NULL, 435); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&_3$$8)) { RETURN_MM_BOOL(0); @@ -8245,7 +8786,7 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_CALL_METHOD(&emptyStringValues, metaData, "getemptystringattributes", NULL, 0, this_ptr); zephir_check_call_status(); error = 0; - zephir_is_iterable(¬Null, 0, "phalcon/Mvc/Model.zep", 4825); + zephir_is_iterable(¬Null, 0, "phalcon/Mvc/Model.zep", 4887); if (Z_TYPE_P(¬Null) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(¬Null), _4$$11) { @@ -8258,10 +8799,12 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_INIT_NVAR(&_6$$19); object_init_ex(&_6$$19, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_7$$19); - ZEPHIR_CONCAT_SVS(&_7$$19, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_6$$19, "__construct", &_8, 29, &_7$$19); + zephir_get_class(&_7$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_8$$19); + ZEPHIR_CONCAT_SVSVS(&_8$$19, "Column '", &field, "' in '", &_7$$19, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_6$$19, "__construct", &_9, 32, &_8$$19); zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$19, "phalcon/Mvc/Model.zep", 4749); + zephir_throw_exception_debug(&_6$$19, "phalcon/Mvc/Model.zep", 4807); ZEPHIR_MM_RESTORE(); return; } @@ -8280,20 +8823,20 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) isNull = 1; } } else { - _9$$27 = Z_TYPE_P(&value) == IS_NULL; - if (!(_9$$27)) { - _10$$27 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); - if (_10$$27) { - _11$$27 = !(zephir_array_isset(&defaultValues, &field)); - if (!(_11$$27)) { - zephir_array_fetch(&_12$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4779); - _11$$27 = !ZEPHIR_IS_IDENTICAL(&value, &_12$$27); + _10$$27 = Z_TYPE_P(&value) == IS_NULL; + if (!(_10$$27)) { + _11$$27 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + if (_11$$27) { + _12$$27 = !(zephir_array_isset(&defaultValues, &field)); + if (!(_12$$27)) { + zephir_array_fetch(&_13$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4837); + _12$$27 = !ZEPHIR_IS_IDENTICAL(&value, &_13$$27); } - _10$$27 = _11$$27; + _11$$27 = _12$$27; } - _9$$27 = _10$$27; + _10$$27 = _11$$27; } - if (_9$$27) { + if (_10$$27) { isNull = 1; } } @@ -8315,15 +8858,21 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) continue; } } - ZEPHIR_INIT_NVAR(&_13$$32); - object_init_ex(&_13$$32, phalcon_messages_message_ce); ZEPHIR_INIT_NVAR(&_14$$32); - ZEPHIR_CONCAT_VS(&_14$$32, &attributeField, " is required"); + object_init_ex(&_14$$32, phalcon_messages_message_ce); ZEPHIR_INIT_NVAR(&_15$$32); - ZVAL_STRING(&_15$$32, "PresenceOf"); - ZEPHIR_CALL_METHOD(NULL, &_13$$32, "__construct", &_16, 6, &_14$$32, &attributeField, &_15$$32); + ZEPHIR_CONCAT_VS(&_15$$32, &attributeField, " is required"); + ZEPHIR_INIT_NVAR(&_16$$32); + zephir_create_array(&_16$$32, 1, 0); + ZEPHIR_INIT_NVAR(&_17$$32); + zephir_get_class(&_17$$32, this_ptr, 0); + zephir_array_update_string(&_16$$32, SL("model"), &_17$$32, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_17$$32); + ZVAL_STRING(&_17$$32, "PresenceOf"); + ZVAL_LONG(&_18$$32, 0); + ZEPHIR_CALL_METHOD(NULL, &_14$$32, "__construct", &_19, 6, &_15$$32, &attributeField, &_17$$32, &_18$$32, &_16$$32); zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_13$$32); + zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_14$$32); error = 1; } } @@ -8343,13 +8892,15 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_OBS_NVAR(&attributeField); if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { - ZEPHIR_INIT_NVAR(&_17$$39); - object_init_ex(&_17$$39, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_18$$39); - ZEPHIR_CONCAT_SVS(&_18$$39, "Column '", &field, "' isn't part of the column map"); - ZEPHIR_CALL_METHOD(NULL, &_17$$39, "__construct", &_8, 29, &_18$$39); + ZEPHIR_INIT_NVAR(&_20$$39); + object_init_ex(&_20$$39, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$39); + zephir_get_class(&_21$$39, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_22$$39); + ZEPHIR_CONCAT_SVSVS(&_22$$39, "Column '", &field, "' in '", &_21$$39, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_20$$39, "__construct", &_9, 32, &_22$$39); zephir_check_call_status(); - zephir_throw_exception_debug(&_17$$39, "phalcon/Mvc/Model.zep", 4749); + zephir_throw_exception_debug(&_20$$39, "phalcon/Mvc/Model.zep", 4807); ZEPHIR_MM_RESTORE(); return; } @@ -8368,20 +8919,20 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) isNull = 1; } } else { - _19$$47 = Z_TYPE_P(&value) == IS_NULL; - if (!(_19$$47)) { - _20$$47 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); - if (_20$$47) { - _21$$47 = !(zephir_array_isset(&defaultValues, &field)); - if (!(_21$$47)) { - zephir_array_fetch(&_22$$47, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4779); - _21$$47 = !ZEPHIR_IS_IDENTICAL(&value, &_22$$47); + _23$$47 = Z_TYPE_P(&value) == IS_NULL; + if (!(_23$$47)) { + _24$$47 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + if (_24$$47) { + _25$$47 = !(zephir_array_isset(&defaultValues, &field)); + if (!(_25$$47)) { + zephir_array_fetch(&_26$$47, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4837); + _25$$47 = !ZEPHIR_IS_IDENTICAL(&value, &_26$$47); } - _20$$47 = _21$$47; + _24$$47 = _25$$47; } - _19$$47 = _20$$47; + _23$$47 = _24$$47; } - if (_19$$47) { + if (_23$$47) { isNull = 1; } } @@ -8403,15 +8954,21 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) continue; } } - ZEPHIR_INIT_NVAR(&_23$$52); - object_init_ex(&_23$$52, phalcon_messages_message_ce); - ZEPHIR_INIT_NVAR(&_24$$52); - ZEPHIR_CONCAT_VS(&_24$$52, &attributeField, " is required"); - ZEPHIR_INIT_NVAR(&_25$$52); - ZVAL_STRING(&_25$$52, "PresenceOf"); - ZEPHIR_CALL_METHOD(NULL, &_23$$52, "__construct", &_16, 6, &_24$$52, &attributeField, &_25$$52); + ZEPHIR_INIT_NVAR(&_27$$52); + object_init_ex(&_27$$52, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_28$$52); + ZEPHIR_CONCAT_VS(&_28$$52, &attributeField, " is required"); + ZEPHIR_INIT_NVAR(&_29$$52); + zephir_create_array(&_29$$52, 1, 0); + ZEPHIR_INIT_NVAR(&_30$$52); + zephir_get_class(&_30$$52, this_ptr, 0); + zephir_array_update_string(&_29$$52, SL("model"), &_30$$52, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_30$$52); + ZVAL_STRING(&_30$$52, "PresenceOf"); + ZVAL_LONG(&_31$$52, 0); + ZEPHIR_CALL_METHOD(NULL, &_27$$52, "__construct", &_19, 6, &_28$$52, &attributeField, &_30$$52, &_31$$52, &_29$$52); zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_23$$52); + zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_27$$52); error = 1; } } @@ -8422,9 +8979,9 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_INIT_NVAR(&field); if (error) { if (ZEPHIR_GLOBAL(orm).events) { - ZEPHIR_INIT_VAR(&_26$$57); - ZVAL_STRING(&_26$$57, "onValidationFails"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_26$$57); + ZEPHIR_INIT_VAR(&_32$$57); + ZVAL_STRING(&_32$$57, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_32$$57); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); zephir_check_call_status(); @@ -8433,15 +8990,15 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) } } } - ZEPHIR_INIT_VAR(&_28); - ZVAL_STRING(&_28, "validation"); - ZEPHIR_CALL_METHOD(&_27, this_ptr, "fireeventcancel", NULL, 0, &_28); + ZEPHIR_INIT_VAR(&_34); + ZVAL_STRING(&_34, "validation"); + ZEPHIR_CALL_METHOD(&_33, this_ptr, "fireeventcancel", NULL, 0, &_34); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_27)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_33)) { if (ZEPHIR_GLOBAL(orm).events) { - ZEPHIR_INIT_VAR(&_29$$59); - ZVAL_STRING(&_29$$59, "onValidationFails"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_29$$59); + ZEPHIR_INIT_VAR(&_35$$59); + ZVAL_STRING(&_35$$59, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_35$$59); zephir_check_call_status(); } RETURN_MM_BOOL(0); @@ -8454,23 +9011,23 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_INIT_NVAR(&eventName); ZVAL_STRING(&eventName, "afterValidationOnCreate"); } - ZEPHIR_CALL_METHOD(&_30$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); + ZEPHIR_CALL_METHOD(&_36$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_30$$60)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_36$$60)) { RETURN_MM_BOOL(0); } - ZEPHIR_INIT_VAR(&_32$$60); - ZVAL_STRING(&_32$$60, "afterValidation"); - ZEPHIR_CALL_METHOD(&_31$$60, this_ptr, "fireeventcancel", NULL, 0, &_32$$60); + ZEPHIR_INIT_VAR(&_38$$60); + ZVAL_STRING(&_38$$60, "afterValidation"); + ZEPHIR_CALL_METHOD(&_37$$60, this_ptr, "fireeventcancel", NULL, 0, &_38$$60); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_31$$60)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_37$$60)) { RETURN_MM_BOOL(0); } - ZEPHIR_INIT_NVAR(&_32$$60); - ZVAL_STRING(&_32$$60, "beforeSave"); - ZEPHIR_CALL_METHOD(&_33$$60, this_ptr, "fireeventcancel", NULL, 0, &_32$$60); + ZEPHIR_INIT_NVAR(&_38$$60); + ZVAL_STRING(&_38$$60, "beforeSave"); + ZEPHIR_CALL_METHOD(&_39$$60, this_ptr, "fireeventcancel", NULL, 0, &_38$$60); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_33$$60)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_39$$60)) { RETURN_MM_BOOL(0); } if (0) { @@ -8485,13 +9042,13 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) ZEPHIR_INIT_NVAR(&eventName); ZVAL_STRING(&eventName, "beforeCreate"); } - ZEPHIR_CALL_METHOD(&_34$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); + ZEPHIR_CALL_METHOD(&_40$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_34$$60)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&_40$$60)) { RETURN_MM_BOOL(0); } - zephir_read_property(&_35$$60, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_35$$60)) { + zephir_read_property(&_41$$60, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_41$$60)) { RETURN_MM_BOOL(1); } } @@ -8506,14 +9063,13 @@ PHP_METHOD(Phalcon_Mvc_Model, preSave) */ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) { - zval _18$$10, _20$$12, _36$$20, _37$$22; zend_string *_5; zend_ulong _4; - zend_bool nesting = 0, _13$$5, _31$$15; + zend_bool nesting = 0, _20$$5, _39$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL, *_11 = NULL, *_19 = NULL, *_22 = NULL, *_25 = NULL, *_27 = NULL, *_29 = NULL, *_39 = NULL; + zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL, *_13 = NULL, *_15 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_34 = NULL, *_42 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, *related, related_sub, className, manager, type, relation, columns, referencedFields, message, name, record, _0, _1, *_2, _3, _6$$3, _8$$6, _10$$7, _12$$5, _14$$5, _23$$5, _15$$8, *_16$$8, _17$$8, _21$$8, _24$$13, _26$$16, _28$$17, _30$$15, _32$$15, _40$$15, _33$$18, *_34$$18, _35$$18, _38$$18; + zval *connection, connection_sub, *related, related_sub, className, manager, type, relation, columns, referencedFields, name, record, _0, _1, *_2, _3, _6$$3, _8$$6, _10$$6, _11$$6, _12$$6, _14$$7, _16$$7, _17$$7, _18$$7, _19$$5, _21$$5, _25$$5, _23$$8, _26$$9, _28$$12, _30$$12, _31$$12, _32$$12, _33$$13, _35$$13, _36$$13, _37$$13, _38$$11, _40$$11, _43$$11, _41$$14; zval *this_ptr = getThis(); ZVAL_UNDEF(&connection_sub); @@ -8524,7 +9080,6 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) ZVAL_UNDEF(&relation); ZVAL_UNDEF(&columns); ZVAL_UNDEF(&referencedFields); - ZVAL_UNDEF(&message); ZVAL_UNDEF(&name); ZVAL_UNDEF(&record); ZVAL_UNDEF(&_0); @@ -8532,26 +9087,30 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&_12$$5); - ZVAL_UNDEF(&_14$$5); - ZVAL_UNDEF(&_23$$5); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_21$$8); - ZVAL_UNDEF(&_24$$13); - ZVAL_UNDEF(&_26$$16); - ZVAL_UNDEF(&_28$$17); - ZVAL_UNDEF(&_30$$15); - ZVAL_UNDEF(&_32$$15); - ZVAL_UNDEF(&_40$$15); - ZVAL_UNDEF(&_33$$18); - ZVAL_UNDEF(&_35$$18); - ZVAL_UNDEF(&_38$$18); - ZVAL_UNDEF(&_18$$10); - ZVAL_UNDEF(&_20$$12); - ZVAL_UNDEF(&_36$$20); - ZVAL_UNDEF(&_37$$22); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$7); + ZVAL_UNDEF(&_16$$7); + ZVAL_UNDEF(&_17$$7); + ZVAL_UNDEF(&_18$$7); + ZVAL_UNDEF(&_19$$5); + ZVAL_UNDEF(&_21$$5); + ZVAL_UNDEF(&_25$$5); + ZVAL_UNDEF(&_23$$8); + ZVAL_UNDEF(&_26$$9); + ZVAL_UNDEF(&_28$$12); + ZVAL_UNDEF(&_30$$12); + ZVAL_UNDEF(&_31$$12); + ZVAL_UNDEF(&_32$$12); + ZVAL_UNDEF(&_33$$13); + ZVAL_UNDEF(&_35$$13); + ZVAL_UNDEF(&_36$$13); + ZVAL_UNDEF(&_37$$13); + ZVAL_UNDEF(&_38$$11); + ZVAL_UNDEF(&_40$$11); + ZVAL_UNDEF(&_43$$11); + ZVAL_UNDEF(&_41$$14); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -8578,7 +9137,7 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) ZEPHIR_CALL_METHOD(&_1, this_ptr, "getmodelsmanager", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&manager, &_1); - zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5005); + zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5050); if (Z_TYPE_P(related) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(related), _4, _5, _2) { @@ -8605,7 +9164,16 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) } ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_9, 0, &_8$$6); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects can be stored as part of belongs-to relations", "phalcon/Mvc/Model.zep", 4946); + ZEPHIR_INIT_NVAR(&_10$$6); + object_init_ex(&_10$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$6); + zephir_get_class(&_11$$6, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_12$$6); + ZEPHIR_CONCAT_SVSV(&_12$$6, "Only objects can be stored as part of belongs-to relations in '", &_11$$6, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_10$$6, "__construct", &_13, 32, &_12$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$6, "phalcon/Mvc/Model.zep", 5007); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); @@ -8614,78 +9182,46 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_10$$7, 1); + ZVAL_BOOL(&_14$$7, 1); } else { - ZVAL_BOOL(&_10$$7, 0); + ZVAL_BOOL(&_14$$7, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_11, 0, &_10$$7); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_15, 0, &_14$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_16$$7); + object_init_ex(&_16$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$7); + zephir_get_class(&_17$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_18$$7); + ZEPHIR_CONCAT_SVSV(&_18$$7, "Not implemented in '", &_17$$7, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_16$$7, "__construct", &_13, 32, &_18$$7); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/Mvc/Model.zep", 4958); + zephir_throw_exception_debug(&_16$$7, "phalcon/Mvc/Model.zep", 5019); + ZEPHIR_MM_RESTORE(); return; } - zephir_read_property(&_12$$5, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); - _13$$5 = !ZEPHIR_IS_LONG_IDENTICAL(&_12$$5, 0); - if (_13$$5) { - ZEPHIR_CALL_METHOD(&_14$$5, &record, "save", NULL, 0); + zephir_read_property(&_19$$5, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + _20$$5 = !ZEPHIR_IS_LONG_IDENTICAL(&_19$$5, 0); + if (_20$$5) { + ZEPHIR_CALL_METHOD(&_21$$5, &record, "save", NULL, 0); zephir_check_call_status(); - _13$$5 = !zephir_is_true(&_14$$5); + _20$$5 = !zephir_is_true(&_21$$5); } - if (_13$$5) { - ZEPHIR_CALL_METHOD(&_15$$8, &record, "getmessages", NULL, 0); + if (_20$$5) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_22, 0, &record); zephir_check_call_status(); - zephir_is_iterable(&_15$$8, 0, "phalcon/Mvc/Model.zep", 4991); - if (Z_TYPE_P(&_15$$8) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_15$$8), _16$$8) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _16$$8); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_18$$10); - zephir_create_array(&_18$$10, 1, 0); - zephir_array_update_string(&_18$$10, SL("model"), &record, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_18$$10); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_19, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_15$$8, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_17$$8, &_15$$8, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_17$$8)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_15$$8, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_20$$12); - zephir_create_array(&_20$$12, 1, 0); - zephir_array_update_string(&_20$$12, SL("model"), &record, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_20$$12); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_19, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_15$$8, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_21$$8, 1); + ZVAL_BOOL(&_23$$8, 1); } else { - ZVAL_BOOL(&_21$$8, 0); + ZVAL_BOOL(&_23$$8, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_22, 0, &_21$$8); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_24, 0, &_23$$8); zephir_check_call_status(); RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&_23$$5, &record, "readattribute", NULL, 0, &referencedFields); + ZEPHIR_CALL_METHOD(&_25$$5, &record, "readattribute", NULL, 0, &referencedFields); zephir_check_call_status(); - zephir_update_property_zval_zval(this_ptr, &columns, &_23$$5); + zephir_update_property_zval_zval(this_ptr, &columns, &_25$$5); } } } ZEND_HASH_FOREACH_END(); @@ -8702,22 +9238,31 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&record, related, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24$$13, &manager, "getrelationbyalias", &_25, 0, &className, &name); + ZEPHIR_CALL_METHOD(&_26$$9, &manager, "getrelationbyalias", &_27, 0, &className, &name); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&relation, &_24$$13); + ZEPHIR_CPY_WRT(&relation, &_26$$9); if (Z_TYPE_P(&relation) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&type, &relation, "gettype", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&type, 0)) { if (UNEXPECTED(Z_TYPE_P(&record) != IS_OBJECT)) { if (nesting) { - ZVAL_BOOL(&_26$$16, 1); + ZVAL_BOOL(&_28$$12, 1); } else { - ZVAL_BOOL(&_26$$16, 0); + ZVAL_BOOL(&_28$$12, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_27, 0, &_26$$16); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_29, 0, &_28$$12); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_30$$12); + object_init_ex(&_30$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_31$$12); + zephir_get_class(&_31$$12, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_32$$12); + ZEPHIR_CONCAT_SVSV(&_32$$12, "Only objects can be stored as part of belongs-to relations in '", &_31$$12, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_30$$12, "__construct", &_13, 32, &_32$$12); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects can be stored as part of belongs-to relations", "phalcon/Mvc/Model.zep", 4946); + zephir_throw_exception_debug(&_30$$12, "phalcon/Mvc/Model.zep", 5007); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); @@ -8726,78 +9271,46 @@ PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_28$$17, 1); + ZVAL_BOOL(&_33$$13, 1); } else { - ZVAL_BOOL(&_28$$17, 0); + ZVAL_BOOL(&_33$$13, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_29, 0, &_28$$17); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_34, 0, &_33$$13); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/Mvc/Model.zep", 4958); + ZEPHIR_INIT_NVAR(&_35$$13); + object_init_ex(&_35$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_36$$13); + zephir_get_class(&_36$$13, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_37$$13); + ZEPHIR_CONCAT_SVSV(&_37$$13, "Not implemented in '", &_36$$13, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_35$$13, "__construct", &_13, 32, &_37$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(&_35$$13, "phalcon/Mvc/Model.zep", 5019); + ZEPHIR_MM_RESTORE(); return; } - zephir_read_property(&_30$$15, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); - _31$$15 = !ZEPHIR_IS_LONG_IDENTICAL(&_30$$15, 0); - if (_31$$15) { - ZEPHIR_CALL_METHOD(&_32$$15, &record, "save", NULL, 0); + zephir_read_property(&_38$$11, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + _39$$11 = !ZEPHIR_IS_LONG_IDENTICAL(&_38$$11, 0); + if (_39$$11) { + ZEPHIR_CALL_METHOD(&_40$$11, &record, "save", NULL, 0); zephir_check_call_status(); - _31$$15 = !zephir_is_true(&_32$$15); + _39$$11 = !zephir_is_true(&_40$$11); } - if (_31$$15) { - ZEPHIR_CALL_METHOD(&_33$$18, &record, "getmessages", NULL, 0); + if (_39$$11) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_22, 0, &record); zephir_check_call_status(); - zephir_is_iterable(&_33$$18, 0, "phalcon/Mvc/Model.zep", 4991); - if (Z_TYPE_P(&_33$$18) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_33$$18), _34$$18) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _34$$18); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_36$$20); - zephir_create_array(&_36$$20, 1, 0); - zephir_array_update_string(&_36$$20, SL("model"), &record, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_36$$20); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_19, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_33$$18, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_35$$18, &_33$$18, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_35$$18)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_33$$18, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_37$$22); - zephir_create_array(&_37$$22, 1, 0); - zephir_array_update_string(&_37$$22, SL("model"), &record, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_37$$22); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_19, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_33$$18, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_38$$18, 1); + ZVAL_BOOL(&_41$$14, 1); } else { - ZVAL_BOOL(&_38$$18, 0); + ZVAL_BOOL(&_41$$14, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_39, 0, &_38$$18); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_42, 0, &_41$$14); zephir_check_call_status(); RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&_40$$15, &record, "readattribute", NULL, 0, &referencedFields); + ZEPHIR_CALL_METHOD(&_43$$11, &record, "readattribute", NULL, 0, &referencedFields); zephir_check_call_status(); - zephir_update_property_zval_zval(this_ptr, &columns, &_40$$15); + zephir_update_property_zval_zval(this_ptr, &columns, &_43$$11); } } ZEPHIR_CALL_METHOD(NULL, related, "next", NULL, 0); @@ -8863,14 +9376,14 @@ PHP_METHOD(Phalcon_Mvc_Model, postSave) */ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) { - zval _25$$16, _27$$18, _33$$20, _35$$20, _40$$24, _41$$26, _48$$31, _49$$33, _55$$35, _57$$35, _62$$39, _63$$41, _90$$57, _91$$59, _97$$61, _99$$61, _104$$65, _105$$67, _112$$72, _113$$74, _119$$76, _121$$76, _126$$80, _127$$82; + zval _32$$14, _34$$14, _44$$19, _46$$19, _88$$40, _90$$40, _100$$45, _102$$45; zend_string *_4; zend_ulong _3; - zend_bool nesting = 0, isThrough = 0, _8$$4, _73$$45; + zend_bool nesting = 0, isThrough = 0, _8$$4, _65$$30; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL, *_12 = NULL, *_14 = NULL, *_17 = NULL, *_26 = NULL, *_29 = NULL, *_31 = NULL, *_32 = NULL, *_43 = NULL, *_51 = NULL, *_53 = NULL, *_54 = NULL, *_65 = NULL, *_67 = NULL, *_71 = NULL, *_75 = NULL, *_77 = NULL, *_80 = NULL, *_93 = NULL, *_95 = NULL, *_96 = NULL, *_107 = NULL, *_115 = NULL, *_117 = NULL, *_118 = NULL, *_129 = NULL, *_131 = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL, *_13 = NULL, *_15 = NULL, *_19 = NULL, *_26 = NULL, *_28 = NULL, *_30 = NULL, *_31 = NULL, *_37 = NULL, *_40 = NULL, *_42 = NULL, *_43 = NULL, *_49 = NULL, *_54 = NULL, *_57 = NULL, *_59 = NULL, *_63 = NULL, *_67 = NULL, *_71 = NULL, *_76 = NULL, *_84 = NULL, *_86 = NULL, *_87 = NULL, *_93 = NULL, *_96 = NULL, *_98 = NULL, *_99 = NULL, *_105 = NULL, *_110 = NULL, *_113 = NULL, *_115 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, *related, related_sub, className, manager, relation, name, record, message, columns, referencedModel, referencedFields, relatedRecords, value, recordAfter, intermediateModel, intermediateFields, intermediateValue, intermediateModelName, intermediateReferencedFields, existingIntermediateModel, _0, *_1, _2, _134, _5$$3, _7$$4, _18$$4, *_19$$4, _20$$4, _9$$6, _11$$7, _13$$10, _15$$10, _16$$10, _21$$12, _22$$14, *_23$$14, _24$$14, _28$$14, _30$$19, _36$$19, _34$$20, _37$$22, *_38$$22, _39$$22, _42$$22, _44$$27, _45$$29, *_46$$29, _47$$29, _50$$29, _52$$34, _58$$34, _56$$35, _59$$37, *_60$$37, _61$$37, _64$$37, _66$$43, _68$$43, _69$$43, _70$$44, _72$$45, _83$$45, *_84$$45, _85$$45, _74$$47, _76$$48, _78$$49, _79$$51, _81$$51, _82$$51, _86$$53, _87$$55, *_88$$55, _89$$55, _92$$55, _94$$60, _100$$60, _98$$61, _101$$63, *_102$$63, _103$$63, _106$$63, _108$$68, _109$$70, *_110$$70, _111$$70, _114$$70, _116$$75, _122$$75, _120$$76, _123$$78, *_124$$78, _125$$78, _128$$78, _130$$84, _132$$84, _133$$84; + zval *connection, connection_sub, *related, related_sub, className, manager, relation, name, record, columns, referencedModel, referencedFields, relatedRecords, value, recordAfter, intermediateModel, intermediateFields, intermediateValue, intermediateModelName, intermediateReferencedFields, existingIntermediateModel, _0, *_1, _2, _118, _5$$3, _7$$4, _22$$4, _9$$6, _11$$6, _12$$6, _14$$7, _16$$7, _17$$7, _18$$10, _20$$10, _21$$10, *_23$$11, _24$$11, _25$$12, _29$$12, _35$$12, _27$$13, _33$$14, _36$$16, _38$$17, _41$$17, _47$$17, _39$$18, _45$$19, _48$$21, *_50$$22, _51$$22, _52$$23, _53$$24, _55$$25, _56$$26, _58$$28, _60$$28, _61$$28, _62$$29, _64$$30, _79$$30, _66$$32, _68$$32, _69$$32, _70$$33, _72$$33, _73$$33, _74$$34, _75$$36, _77$$36, _78$$36, *_80$$37, _81$$37, _82$$38, _85$$38, _91$$38, _83$$39, _89$$40, _92$$42, _94$$43, _97$$43, _103$$43, _95$$44, _101$$45, _104$$47, *_106$$48, _107$$48, _108$$49, _109$$50, _111$$51, _112$$52, _114$$54, _116$$54, _117$$54; zval *this_ptr = getThis(); ZVAL_UNDEF(&connection_sub); @@ -8880,7 +9393,6 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) ZVAL_UNDEF(&relation); ZVAL_UNDEF(&name); ZVAL_UNDEF(&record); - ZVAL_UNDEF(&message); ZVAL_UNDEF(&columns); ZVAL_UNDEF(&referencedModel); ZVAL_UNDEF(&referencedFields); @@ -8895,96 +9407,82 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) ZVAL_UNDEF(&existingIntermediateModel); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_134); + ZVAL_UNDEF(&_118); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_18$$4); - ZVAL_UNDEF(&_20$$4); + ZVAL_UNDEF(&_22$$4); ZVAL_UNDEF(&_9$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_13$$10); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$10); - ZVAL_UNDEF(&_21$$12); - ZVAL_UNDEF(&_22$$14); - ZVAL_UNDEF(&_24$$14); - ZVAL_UNDEF(&_28$$14); - ZVAL_UNDEF(&_30$$19); - ZVAL_UNDEF(&_36$$19); - ZVAL_UNDEF(&_34$$20); - ZVAL_UNDEF(&_37$$22); - ZVAL_UNDEF(&_39$$22); - ZVAL_UNDEF(&_42$$22); - ZVAL_UNDEF(&_44$$27); - ZVAL_UNDEF(&_45$$29); - ZVAL_UNDEF(&_47$$29); - ZVAL_UNDEF(&_50$$29); - ZVAL_UNDEF(&_52$$34); - ZVAL_UNDEF(&_58$$34); - ZVAL_UNDEF(&_56$$35); - ZVAL_UNDEF(&_59$$37); - ZVAL_UNDEF(&_61$$37); - ZVAL_UNDEF(&_64$$37); - ZVAL_UNDEF(&_66$$43); - ZVAL_UNDEF(&_68$$43); - ZVAL_UNDEF(&_69$$43); - ZVAL_UNDEF(&_70$$44); - ZVAL_UNDEF(&_72$$45); - ZVAL_UNDEF(&_83$$45); - ZVAL_UNDEF(&_85$$45); - ZVAL_UNDEF(&_74$$47); - ZVAL_UNDEF(&_76$$48); - ZVAL_UNDEF(&_78$$49); - ZVAL_UNDEF(&_79$$51); - ZVAL_UNDEF(&_81$$51); - ZVAL_UNDEF(&_82$$51); - ZVAL_UNDEF(&_86$$53); - ZVAL_UNDEF(&_87$$55); - ZVAL_UNDEF(&_89$$55); - ZVAL_UNDEF(&_92$$55); - ZVAL_UNDEF(&_94$$60); - ZVAL_UNDEF(&_100$$60); - ZVAL_UNDEF(&_98$$61); - ZVAL_UNDEF(&_101$$63); - ZVAL_UNDEF(&_103$$63); - ZVAL_UNDEF(&_106$$63); - ZVAL_UNDEF(&_108$$68); - ZVAL_UNDEF(&_109$$70); - ZVAL_UNDEF(&_111$$70); - ZVAL_UNDEF(&_114$$70); - ZVAL_UNDEF(&_116$$75); - ZVAL_UNDEF(&_122$$75); - ZVAL_UNDEF(&_120$$76); - ZVAL_UNDEF(&_123$$78); - ZVAL_UNDEF(&_125$$78); - ZVAL_UNDEF(&_128$$78); - ZVAL_UNDEF(&_130$$84); - ZVAL_UNDEF(&_132$$84); - ZVAL_UNDEF(&_133$$84); - ZVAL_UNDEF(&_25$$16); - ZVAL_UNDEF(&_27$$18); - ZVAL_UNDEF(&_33$$20); - ZVAL_UNDEF(&_35$$20); - ZVAL_UNDEF(&_40$$24); - ZVAL_UNDEF(&_41$$26); - ZVAL_UNDEF(&_48$$31); - ZVAL_UNDEF(&_49$$33); - ZVAL_UNDEF(&_55$$35); - ZVAL_UNDEF(&_57$$35); - ZVAL_UNDEF(&_62$$39); - ZVAL_UNDEF(&_63$$41); - ZVAL_UNDEF(&_90$$57); - ZVAL_UNDEF(&_91$$59); - ZVAL_UNDEF(&_97$$61); - ZVAL_UNDEF(&_99$$61); - ZVAL_UNDEF(&_104$$65); - ZVAL_UNDEF(&_105$$67); - ZVAL_UNDEF(&_112$$72); - ZVAL_UNDEF(&_113$$74); - ZVAL_UNDEF(&_119$$76); - ZVAL_UNDEF(&_121$$76); - ZVAL_UNDEF(&_126$$80); - ZVAL_UNDEF(&_127$$82); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$7); + ZVAL_UNDEF(&_16$$7); + ZVAL_UNDEF(&_17$$7); + ZVAL_UNDEF(&_18$$10); + ZVAL_UNDEF(&_20$$10); + ZVAL_UNDEF(&_21$$10); + ZVAL_UNDEF(&_24$$11); + ZVAL_UNDEF(&_25$$12); + ZVAL_UNDEF(&_29$$12); + ZVAL_UNDEF(&_35$$12); + ZVAL_UNDEF(&_27$$13); + ZVAL_UNDEF(&_33$$14); + ZVAL_UNDEF(&_36$$16); + ZVAL_UNDEF(&_38$$17); + ZVAL_UNDEF(&_41$$17); + ZVAL_UNDEF(&_47$$17); + ZVAL_UNDEF(&_39$$18); + ZVAL_UNDEF(&_45$$19); + ZVAL_UNDEF(&_48$$21); + ZVAL_UNDEF(&_51$$22); + ZVAL_UNDEF(&_52$$23); + ZVAL_UNDEF(&_53$$24); + ZVAL_UNDEF(&_55$$25); + ZVAL_UNDEF(&_56$$26); + ZVAL_UNDEF(&_58$$28); + ZVAL_UNDEF(&_60$$28); + ZVAL_UNDEF(&_61$$28); + ZVAL_UNDEF(&_62$$29); + ZVAL_UNDEF(&_64$$30); + ZVAL_UNDEF(&_79$$30); + ZVAL_UNDEF(&_66$$32); + ZVAL_UNDEF(&_68$$32); + ZVAL_UNDEF(&_69$$32); + ZVAL_UNDEF(&_70$$33); + ZVAL_UNDEF(&_72$$33); + ZVAL_UNDEF(&_73$$33); + ZVAL_UNDEF(&_74$$34); + ZVAL_UNDEF(&_75$$36); + ZVAL_UNDEF(&_77$$36); + ZVAL_UNDEF(&_78$$36); + ZVAL_UNDEF(&_81$$37); + ZVAL_UNDEF(&_82$$38); + ZVAL_UNDEF(&_85$$38); + ZVAL_UNDEF(&_91$$38); + ZVAL_UNDEF(&_83$$39); + ZVAL_UNDEF(&_89$$40); + ZVAL_UNDEF(&_92$$42); + ZVAL_UNDEF(&_94$$43); + ZVAL_UNDEF(&_97$$43); + ZVAL_UNDEF(&_103$$43); + ZVAL_UNDEF(&_95$$44); + ZVAL_UNDEF(&_101$$45); + ZVAL_UNDEF(&_104$$47); + ZVAL_UNDEF(&_107$$48); + ZVAL_UNDEF(&_108$$49); + ZVAL_UNDEF(&_109$$50); + ZVAL_UNDEF(&_111$$51); + ZVAL_UNDEF(&_112$$52); + ZVAL_UNDEF(&_114$$54); + ZVAL_UNDEF(&_116$$54); + ZVAL_UNDEF(&_117$$54); + ZVAL_UNDEF(&_32$$14); + ZVAL_UNDEF(&_34$$14); + ZVAL_UNDEF(&_44$$19); + ZVAL_UNDEF(&_46$$19); + ZVAL_UNDEF(&_88$$40); + ZVAL_UNDEF(&_90$$40); + ZVAL_UNDEF(&_100$$45); + ZVAL_UNDEF(&_102$$45); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -9004,7 +9502,7 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmodelsmanager", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&manager, &_0); - zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5254); + zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5277); if (Z_TYPE_P(related) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(related), _3, _4, _1) { @@ -9037,7 +9535,14 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) } ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_10, 0, &_9$$6); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations", "phalcon/Mvc/Model.zep", 5067); + ZEPHIR_INIT_NVAR(&_11$$6); + object_init_ex(&_11$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$6); + ZEPHIR_CONCAT_SVSV(&_12$$6, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations on model ", &className, " on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_11$$6, "__construct", &_13, 32, &_12$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$6, "phalcon/Mvc/Model.zep", 5112); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); @@ -9048,13 +9553,20 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_11$$7, 1); + ZVAL_BOOL(&_14$$7, 1); } else { - ZVAL_BOOL(&_11$$7, 0); + ZVAL_BOOL(&_14$$7, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_12, 0, &_11$$7); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_15, 0, &_14$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_16$$7); + object_init_ex(&_16$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$7); + ZEPHIR_CONCAT_SVSV(&_17$$7, "Not implemented in '", &className, "' on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_16$$7, "__construct", &_13, 32, &_17$$7); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/Mvc/Model.zep", 5077); + zephir_throw_exception_debug(&_16$$7, "phalcon/Mvc/Model.zep", 5122); + ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(&record) == IS_OBJECT) { @@ -9067,25 +9579,25 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) ZEPHIR_OBS_NVAR(&value); if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &columns, PH_SILENT_CC)))) { if (nesting) { - ZVAL_BOOL(&_13$$10, 1); + ZVAL_BOOL(&_18$$10, 1); } else { - ZVAL_BOOL(&_13$$10, 0); + ZVAL_BOOL(&_18$$10, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_14, 0, &_13$$10); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_19, 0, &_18$$10); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_15$$10); - object_init_ex(&_15$$10, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_16$$10); - ZEPHIR_CONCAT_SVS(&_16$$10, "The column '", &columns, "' needs to be present in the model"); - ZEPHIR_CALL_METHOD(NULL, &_15$$10, "__construct", &_17, 29, &_16$$10); + ZEPHIR_INIT_NVAR(&_20$$10); + object_init_ex(&_20$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$10); + ZEPHIR_CONCAT_SVSVS(&_21$$10, "The column '", &columns, "' needs to be present in the model '", &className, "'"); + ZEPHIR_CALL_METHOD(NULL, &_20$$10, "__construct", &_13, 32, &_21$$10); zephir_check_call_status(); - zephir_throw_exception_debug(&_15$$10, "phalcon/Mvc/Model.zep", 5094); + zephir_throw_exception_debug(&_20$$10, "phalcon/Mvc/Model.zep", 5139); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_18$$4, &relation, "isthrough", NULL, 0); + ZEPHIR_CALL_METHOD(&_22$$4, &relation, "isthrough", NULL, 0); zephir_check_call_status(); - isThrough = zephir_get_boolval(&_18$$4); + isThrough = zephir_get_boolval(&_22$$4); if (isThrough) { ZEPHIR_CALL_METHOD(&intermediateModelName, &relation, "getintermediatemodel", NULL, 0); zephir_check_call_status(); @@ -9093,89 +9605,42 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&intermediateReferencedFields, &relation, "getintermediatereferencedfields", NULL, 0); zephir_check_call_status(); - } - zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5240); - if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _19$$4) - { - ZEPHIR_INIT_NVAR(&recordAfter); - ZVAL_COPY(&recordAfter, _19$$4); - if (!(isThrough)) { - ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&_21$$12, &recordAfter, "save", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(&_21$$12))) { - ZEPHIR_CALL_METHOD(&_22$$14, &recordAfter, "getmessages", NULL, 0); + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5238); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _23$$11) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _23$$11); + ZEPHIR_CALL_METHOD(&_25$$12, &recordAfter, "save", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&_22$$14, 0, "phalcon/Mvc/Model.zep", 5153); - if (Z_TYPE_P(&_22$$14) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_22$$14), _23$$14) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _23$$14); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_25$$16); - zephir_create_array(&_25$$16, 1, 0); - zephir_array_update_string(&_25$$16, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_25$$16); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_22$$14, "rewind", NULL, 0); + if (!(zephir_is_true(&_25$$12))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_24$$14, &_22$$14, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_24$$14)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_22$$14, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_27$$18); - zephir_create_array(&_27$$18, 1, 0); - zephir_array_update_string(&_27$$18, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_27$$18); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_22$$14, "next", NULL, 0); - zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_27$$13, 1); + } else { + ZVAL_BOOL(&_27$$13, 0); } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_28, 0, &_27$$13); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_NVAR(&message); - if (nesting) { - ZVAL_BOOL(&_28$$14, 1); - } else { - ZVAL_BOOL(&_28$$14, 0); - } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_29, 0, &_28$$14); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - if (isThrough) { - ZEPHIR_CALL_METHOD(&_30$$19, &manager, "load", &_31, 0, &intermediateModelName); + ZEPHIR_CALL_METHOD(&_29$$12, &manager, "load", &_30, 0, &intermediateModelName); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&intermediateModel, &_30$$19); - ZEPHIR_CALL_METHOD(&_30$$19, &relation, "gettype", &_32, 0); + ZEPHIR_CPY_WRT(&intermediateModel, &_29$$12); + ZEPHIR_CALL_METHOD(&_29$$12, &relation, "gettype", &_31, 0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_30$$19, 3)) { - ZEPHIR_INIT_NVAR(&_33$$20); - zephir_create_array(&_33$$20, 2, 0); - ZEPHIR_INIT_NVAR(&_34$$20); - ZEPHIR_CONCAT_SVS(&_34$$20, "[", &intermediateFields, "] = ?0"); - zephir_array_fast_append(&_33$$20, &_34$$20); - ZEPHIR_INIT_NVAR(&_35$$20); - zephir_create_array(&_35$$20, 1, 0); - zephir_array_fast_append(&_35$$20, &value); - zephir_array_update_string(&_33$$20, SL("bind"), &_35$$20, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_33$$20); + if (ZEPHIR_IS_LONG(&_29$$12, 3)) { + ZEPHIR_INIT_NVAR(&_32$$14); + zephir_create_array(&_32$$14, 2, 0); + ZEPHIR_INIT_NVAR(&_33$$14); + ZEPHIR_CONCAT_SVS(&_33$$14, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_32$$14, &_33$$14); + ZEPHIR_INIT_NVAR(&_34$$14); + zephir_create_array(&_34$$14, 1, 0); + zephir_array_fast_append(&_34$$14, &value); + zephir_array_update_string(&_32$$14, SL("bind"), &_34$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_32$$14); zephir_check_call_status(); if (zephir_is_true(&existingIntermediateModel)) { ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); @@ -9187,150 +9652,62 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_36$$19, &intermediateModel, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&_35$$12, &intermediateModel, "save", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_36$$19))) { - ZEPHIR_CALL_METHOD(&_37$$22, &intermediateModel, "getmessages", NULL, 0); + if (!(zephir_is_true(&_35$$12))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); zephir_check_call_status(); - zephir_is_iterable(&_37$$22, 0, "phalcon/Mvc/Model.zep", 5234); - if (Z_TYPE_P(&_37$$22) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_37$$22), _38$$22) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _38$$22); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_40$$24); - zephir_create_array(&_40$$24, 1, 0); - zephir_array_update_string(&_40$$24, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_40$$24); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_37$$22, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_39$$22, &_37$$22, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_39$$22)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_37$$22, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_41$$26); - zephir_create_array(&_41$$26, 1, 0); - zephir_array_update_string(&_41$$26, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_41$$26); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_37$$22, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_42$$22, 1); + ZVAL_BOOL(&_36$$16, 1); } else { - ZVAL_BOOL(&_42$$22, 0); + ZVAL_BOOL(&_36$$16, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_43, 0, &_42$$22); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_37, 0, &_36$$16); zephir_check_call_status(); RETURN_MM_BOOL(0); } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_20$$4, &relatedRecords, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_20$$4)) { - break; - } - ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); zephir_check_call_status(); - if (!(isThrough)) { - ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); - zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_24$$11, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_24$$11)) { + break; } - ZEPHIR_CALL_METHOD(&_44$$27, &recordAfter, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_44$$27))) { - ZEPHIR_CALL_METHOD(&_45$$29, &recordAfter, "getmessages", NULL, 0); + ZEPHIR_CALL_METHOD(&_38$$17, &recordAfter, "save", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&_45$$29, 0, "phalcon/Mvc/Model.zep", 5153); - if (Z_TYPE_P(&_45$$29) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_45$$29), _46$$29) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _46$$29); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_48$$31); - zephir_create_array(&_48$$31, 1, 0); - zephir_array_update_string(&_48$$31, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_48$$31); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_45$$29, "rewind", NULL, 0); + if (!(zephir_is_true(&_38$$17))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_47$$29, &_45$$29, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_47$$29)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_45$$29, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_49$$33); - zephir_create_array(&_49$$33, 1, 0); - zephir_array_update_string(&_49$$33, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_49$$33); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_45$$29, "next", NULL, 0); - zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_39$$18, 1); + } else { + ZVAL_BOOL(&_39$$18, 0); } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_40, 0, &_39$$18); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_NVAR(&message); - if (nesting) { - ZVAL_BOOL(&_50$$29, 1); - } else { - ZVAL_BOOL(&_50$$29, 0); - } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_51, 0, &_50$$29); + ZEPHIR_CALL_METHOD(&_41$$17, &manager, "load", &_42, 0, &intermediateModelName); zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - if (isThrough) { - ZEPHIR_CALL_METHOD(&_52$$34, &manager, "load", &_53, 0, &intermediateModelName); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&intermediateModel, &_52$$34); - ZEPHIR_CALL_METHOD(&_52$$34, &relation, "gettype", &_54, 0); + ZEPHIR_CPY_WRT(&intermediateModel, &_41$$17); + ZEPHIR_CALL_METHOD(&_41$$17, &relation, "gettype", &_43, 0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_52$$34, 3)) { - ZEPHIR_INIT_NVAR(&_55$$35); - zephir_create_array(&_55$$35, 2, 0); - ZEPHIR_INIT_NVAR(&_56$$35); - ZEPHIR_CONCAT_SVS(&_56$$35, "[", &intermediateFields, "] = ?0"); - zephir_array_fast_append(&_55$$35, &_56$$35); - ZEPHIR_INIT_NVAR(&_57$$35); - zephir_create_array(&_57$$35, 1, 0); - zephir_array_fast_append(&_57$$35, &value); - zephir_array_update_string(&_55$$35, SL("bind"), &_57$$35, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_55$$35); + if (ZEPHIR_IS_LONG(&_41$$17, 3)) { + ZEPHIR_INIT_NVAR(&_44$$19); + zephir_create_array(&_44$$19, 2, 0); + ZEPHIR_INIT_NVAR(&_45$$19); + ZEPHIR_CONCAT_SVS(&_45$$19, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_44$$19, &_45$$19); + ZEPHIR_INIT_NVAR(&_46$$19); + zephir_create_array(&_46$$19, 1, 0); + zephir_array_fast_append(&_46$$19, &value); + zephir_array_update_string(&_44$$19, SL("bind"), &_46$$19, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_44$$19); zephir_check_call_status(); if (zephir_is_true(&existingIntermediateModel)) { ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); @@ -9342,83 +9719,98 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_58$$34, &intermediateModel, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&_47$$17, &intermediateModel, "save", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_58$$34))) { - ZEPHIR_CALL_METHOD(&_59$$37, &intermediateModel, "getmessages", NULL, 0); + if (!(zephir_is_true(&_47$$17))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); zephir_check_call_status(); - zephir_is_iterable(&_59$$37, 0, "phalcon/Mvc/Model.zep", 5234); - if (Z_TYPE_P(&_59$$37) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_59$$37), _60$$37) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _60$$37); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_62$$39); - zephir_create_array(&_62$$39, 1, 0); - zephir_array_update_string(&_62$$39, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_62$$39); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_59$$37, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_61$$37, &_59$$37, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_61$$37)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_59$$37, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_63$$41); - zephir_create_array(&_63$$41, 1, 0); - zephir_array_update_string(&_63$$41, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_63$$41); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_59$$37, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_64$$37, 1); + ZVAL_BOOL(&_48$$21, 1); } else { - ZVAL_BOOL(&_64$$37, 0); + ZVAL_BOOL(&_48$$21, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_65, 0, &_64$$37); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_49, 0, &_48$$21); zephir_check_call_status(); RETURN_MM_BOOL(0); } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } else { + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5262); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _50$$22) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _50$$22); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_52$$23, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_52$$23))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_53$$24, 1); + } else { + ZVAL_BOOL(&_53$$24, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_54, 0, &_53$$24); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_51$$22, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_51$$22)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_55$$25, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_55$$25))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_56$$26, 1); + } else { + ZVAL_BOOL(&_56$$26, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_57, 0, &_56$$26); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&recordAfter); } - ZEPHIR_INIT_NVAR(&recordAfter); } else { if (UNEXPECTED(Z_TYPE_P(&record) != IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_66$$43, 1); + ZVAL_BOOL(&_58$$28, 1); } else { - ZVAL_BOOL(&_66$$43, 0); + ZVAL_BOOL(&_58$$28, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_67, 0, &_66$$43); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_59, 0, &_58$$28); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_68$$43); - object_init_ex(&_68$$43, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_69$$43); - ZEPHIR_CONCAT_SVSVS(&_69$$43, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_68$$43, "__construct", &_17, 29, &_69$$43); + ZEPHIR_INIT_NVAR(&_60$$28); + object_init_ex(&_60$$28, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_61$$28); + ZEPHIR_CONCAT_SVSVS(&_61$$28, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_60$$28, "__construct", &_13, 32, &_61$$28); zephir_check_call_status(); - zephir_throw_exception_debug(&_68$$43, "phalcon/Mvc/Model.zep", 5246); + zephir_throw_exception_debug(&_60$$28, "phalcon/Mvc/Model.zep", 5269); ZEPHIR_MM_RESTORE(); return; } @@ -9437,28 +9829,35 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&record, related, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_70$$44, &manager, "getrelationbyalias", &_71, 0, &className, &name); + ZEPHIR_CALL_METHOD(&_62$$29, &manager, "getrelationbyalias", &_63, 0, &className, &name); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&relation, &_70$$44); + ZEPHIR_CPY_WRT(&relation, &_62$$29); if (Z_TYPE_P(&relation) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&_72$$45, &relation, "gettype", NULL, 0); + ZEPHIR_CALL_METHOD(&_64$$30, &relation, "gettype", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_72$$45, 0)) { + if (ZEPHIR_IS_LONG(&_64$$30, 0)) { continue; } - _73$$45 = Z_TYPE_P(&record) != IS_OBJECT; - if (_73$$45) { - _73$$45 = Z_TYPE_P(&record) != IS_ARRAY; + _65$$30 = Z_TYPE_P(&record) != IS_OBJECT; + if (_65$$30) { + _65$$30 = Z_TYPE_P(&record) != IS_ARRAY; } - if (UNEXPECTED(_73$$45)) { + if (UNEXPECTED(_65$$30)) { if (nesting) { - ZVAL_BOOL(&_74$$47, 1); + ZVAL_BOOL(&_66$$32, 1); } else { - ZVAL_BOOL(&_74$$47, 0); + ZVAL_BOOL(&_66$$32, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_75, 0, &_74$$47); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_67, 0, &_66$$32); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations", "phalcon/Mvc/Model.zep", 5067); + ZEPHIR_INIT_NVAR(&_68$$32); + object_init_ex(&_68$$32, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_69$$32); + ZEPHIR_CONCAT_SVSV(&_69$$32, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations on model ", &className, " on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_68$$32, "__construct", &_13, 32, &_69$$32); + zephir_check_call_status(); + zephir_throw_exception_debug(&_68$$32, "phalcon/Mvc/Model.zep", 5112); + ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); @@ -9469,45 +9868,52 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_76$$48, 1); + ZVAL_BOOL(&_70$$33, 1); } else { - ZVAL_BOOL(&_76$$48, 0); + ZVAL_BOOL(&_70$$33, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_77, 0, &_76$$48); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_71, 0, &_70$$33); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_72$$33); + object_init_ex(&_72$$33, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_73$$33); + ZEPHIR_CONCAT_SVSV(&_73$$33, "Not implemented in '", &className, "' on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_72$$33, "__construct", &_13, 32, &_73$$33); zephir_check_call_status(); - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/Mvc/Model.zep", 5077); + zephir_throw_exception_debug(&_72$$33, "phalcon/Mvc/Model.zep", 5122); + ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(&record) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_78$$49); - zephir_create_array(&_78$$49, 1, 0); - zephir_array_fast_append(&_78$$49, &record); - ZEPHIR_CPY_WRT(&relatedRecords, &_78$$49); + ZEPHIR_INIT_NVAR(&_74$$34); + zephir_create_array(&_74$$34, 1, 0); + zephir_array_fast_append(&_74$$34, &record); + ZEPHIR_CPY_WRT(&relatedRecords, &_74$$34); } else { ZEPHIR_CPY_WRT(&relatedRecords, &record); } ZEPHIR_OBS_NVAR(&value); if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &columns, PH_SILENT_CC)))) { if (nesting) { - ZVAL_BOOL(&_79$$51, 1); + ZVAL_BOOL(&_75$$36, 1); } else { - ZVAL_BOOL(&_79$$51, 0); + ZVAL_BOOL(&_75$$36, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_80, 0, &_79$$51); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_76, 0, &_75$$36); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_81$$51); - object_init_ex(&_81$$51, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_82$$51); - ZEPHIR_CONCAT_SVS(&_82$$51, "The column '", &columns, "' needs to be present in the model"); - ZEPHIR_CALL_METHOD(NULL, &_81$$51, "__construct", &_17, 29, &_82$$51); + ZEPHIR_INIT_NVAR(&_77$$36); + object_init_ex(&_77$$36, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_78$$36); + ZEPHIR_CONCAT_SVSVS(&_78$$36, "The column '", &columns, "' needs to be present in the model '", &className, "'"); + ZEPHIR_CALL_METHOD(NULL, &_77$$36, "__construct", &_13, 32, &_78$$36); zephir_check_call_status(); - zephir_throw_exception_debug(&_81$$51, "phalcon/Mvc/Model.zep", 5094); + zephir_throw_exception_debug(&_77$$36, "phalcon/Mvc/Model.zep", 5139); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_83$$45, &relation, "isthrough", NULL, 0); + ZEPHIR_CALL_METHOD(&_79$$30, &relation, "isthrough", NULL, 0); zephir_check_call_status(); - isThrough = zephir_get_boolval(&_83$$45); + isThrough = zephir_get_boolval(&_79$$30); if (isThrough) { ZEPHIR_CALL_METHOD(&intermediateModelName, &relation, "getintermediatemodel", NULL, 0); zephir_check_call_status(); @@ -9515,89 +9921,42 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&intermediateReferencedFields, &relation, "getintermediatereferencedfields", NULL, 0); zephir_check_call_status(); - } - zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5240); - if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _84$$45) - { - ZEPHIR_INIT_NVAR(&recordAfter); - ZVAL_COPY(&recordAfter, _84$$45); - if (!(isThrough)) { - ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&_86$$53, &recordAfter, "save", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(&_86$$53))) { - ZEPHIR_CALL_METHOD(&_87$$55, &recordAfter, "getmessages", NULL, 0); + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5238); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _80$$37) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _80$$37); + ZEPHIR_CALL_METHOD(&_82$$38, &recordAfter, "save", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&_87$$55, 0, "phalcon/Mvc/Model.zep", 5153); - if (Z_TYPE_P(&_87$$55) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_87$$55), _88$$55) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _88$$55); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_90$$57); - zephir_create_array(&_90$$57, 1, 0); - zephir_array_update_string(&_90$$57, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_90$$57); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_87$$55, "rewind", NULL, 0); + if (!(zephir_is_true(&_82$$38))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_89$$55, &_87$$55, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_89$$55)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_87$$55, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_91$$59); - zephir_create_array(&_91$$59, 1, 0); - zephir_array_update_string(&_91$$59, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_91$$59); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_87$$55, "next", NULL, 0); - zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_83$$39, 1); + } else { + ZVAL_BOOL(&_83$$39, 0); } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_84, 0, &_83$$39); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_NVAR(&message); - if (nesting) { - ZVAL_BOOL(&_92$$55, 1); - } else { - ZVAL_BOOL(&_92$$55, 0); - } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_93, 0, &_92$$55); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - if (isThrough) { - ZEPHIR_CALL_METHOD(&_94$$60, &manager, "load", &_95, 0, &intermediateModelName); + ZEPHIR_CALL_METHOD(&_85$$38, &manager, "load", &_86, 0, &intermediateModelName); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&intermediateModel, &_94$$60); - ZEPHIR_CALL_METHOD(&_94$$60, &relation, "gettype", &_96, 0); + ZEPHIR_CPY_WRT(&intermediateModel, &_85$$38); + ZEPHIR_CALL_METHOD(&_85$$38, &relation, "gettype", &_87, 0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_94$$60, 3)) { - ZEPHIR_INIT_NVAR(&_97$$61); - zephir_create_array(&_97$$61, 2, 0); - ZEPHIR_INIT_NVAR(&_98$$61); - ZEPHIR_CONCAT_SVS(&_98$$61, "[", &intermediateFields, "] = ?0"); - zephir_array_fast_append(&_97$$61, &_98$$61); - ZEPHIR_INIT_NVAR(&_99$$61); - zephir_create_array(&_99$$61, 1, 0); - zephir_array_fast_append(&_99$$61, &value); - zephir_array_update_string(&_97$$61, SL("bind"), &_99$$61, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_97$$61); + if (ZEPHIR_IS_LONG(&_85$$38, 3)) { + ZEPHIR_INIT_NVAR(&_88$$40); + zephir_create_array(&_88$$40, 2, 0); + ZEPHIR_INIT_NVAR(&_89$$40); + ZEPHIR_CONCAT_SVS(&_89$$40, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_88$$40, &_89$$40); + ZEPHIR_INIT_NVAR(&_90$$40); + zephir_create_array(&_90$$40, 1, 0); + zephir_array_fast_append(&_90$$40, &value); + zephir_array_update_string(&_88$$40, SL("bind"), &_90$$40, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_88$$40); zephir_check_call_status(); if (zephir_is_true(&existingIntermediateModel)) { ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); @@ -9609,150 +9968,62 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_100$$60, &intermediateModel, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&_91$$38, &intermediateModel, "save", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_100$$60))) { - ZEPHIR_CALL_METHOD(&_101$$63, &intermediateModel, "getmessages", NULL, 0); + if (!(zephir_is_true(&_91$$38))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); zephir_check_call_status(); - zephir_is_iterable(&_101$$63, 0, "phalcon/Mvc/Model.zep", 5234); - if (Z_TYPE_P(&_101$$63) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_101$$63), _102$$63) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _102$$63); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_104$$65); - zephir_create_array(&_104$$65, 1, 0); - zephir_array_update_string(&_104$$65, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_104$$65); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_101$$63, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_103$$63, &_101$$63, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_103$$63)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_101$$63, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_105$$67); - zephir_create_array(&_105$$67, 1, 0); - zephir_array_update_string(&_105$$67, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_105$$67); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_101$$63, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_106$$63, 1); + ZVAL_BOOL(&_92$$42, 1); } else { - ZVAL_BOOL(&_106$$63, 0); + ZVAL_BOOL(&_92$$42, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_107, 0, &_106$$63); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_93, 0, &_92$$42); zephir_check_call_status(); RETURN_MM_BOOL(0); } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_85$$45, &relatedRecords, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_85$$45)) { - break; - } - ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); zephir_check_call_status(); - if (!(isThrough)) { - ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); - zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_81$$37, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_81$$37)) { + break; } - ZEPHIR_CALL_METHOD(&_108$$68, &recordAfter, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_108$$68))) { - ZEPHIR_CALL_METHOD(&_109$$70, &recordAfter, "getmessages", NULL, 0); + ZEPHIR_CALL_METHOD(&_94$$43, &recordAfter, "save", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&_109$$70, 0, "phalcon/Mvc/Model.zep", 5153); - if (Z_TYPE_P(&_109$$70) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_109$$70), _110$$70) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _110$$70); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_112$$72); - zephir_create_array(&_112$$72, 1, 0); - zephir_array_update_string(&_112$$72, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_112$$72); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_109$$70, "rewind", NULL, 0); + if (!(zephir_is_true(&_94$$43))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_111$$70, &_109$$70, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_111$$70)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_109$$70, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_113$$74); - zephir_create_array(&_113$$74, 1, 0); - zephir_array_update_string(&_113$$74, SL("model"), &recordAfter, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_113$$74); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_109$$70, "next", NULL, 0); - zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_95$$44, 1); + } else { + ZVAL_BOOL(&_95$$44, 0); } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_96, 0, &_95$$44); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_NVAR(&message); - if (nesting) { - ZVAL_BOOL(&_114$$70, 1); - } else { - ZVAL_BOOL(&_114$$70, 0); - } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_115, 0, &_114$$70); - zephir_check_call_status(); - RETURN_MM_BOOL(0); - } - if (isThrough) { - ZEPHIR_CALL_METHOD(&_116$$75, &manager, "load", &_117, 0, &intermediateModelName); + ZEPHIR_CALL_METHOD(&_97$$43, &manager, "load", &_98, 0, &intermediateModelName); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&intermediateModel, &_116$$75); - ZEPHIR_CALL_METHOD(&_116$$75, &relation, "gettype", &_118, 0); + ZEPHIR_CPY_WRT(&intermediateModel, &_97$$43); + ZEPHIR_CALL_METHOD(&_97$$43, &relation, "gettype", &_99, 0); zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_116$$75, 3)) { - ZEPHIR_INIT_NVAR(&_119$$76); - zephir_create_array(&_119$$76, 2, 0); - ZEPHIR_INIT_NVAR(&_120$$76); - ZEPHIR_CONCAT_SVS(&_120$$76, "[", &intermediateFields, "] = ?0"); - zephir_array_fast_append(&_119$$76, &_120$$76); - ZEPHIR_INIT_NVAR(&_121$$76); - zephir_create_array(&_121$$76, 1, 0); - zephir_array_fast_append(&_121$$76, &value); - zephir_array_update_string(&_119$$76, SL("bind"), &_121$$76, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_119$$76); + if (ZEPHIR_IS_LONG(&_97$$43, 3)) { + ZEPHIR_INIT_NVAR(&_100$$45); + zephir_create_array(&_100$$45, 2, 0); + ZEPHIR_INIT_NVAR(&_101$$45); + ZEPHIR_CONCAT_SVS(&_101$$45, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_100$$45, &_101$$45); + ZEPHIR_INIT_NVAR(&_102$$45); + zephir_create_array(&_102$$45, 1, 0); + zephir_array_fast_append(&_102$$45, &value); + zephir_array_update_string(&_100$$45, SL("bind"), &_102$$45, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_100$$45); zephir_check_call_status(); if (zephir_is_true(&existingIntermediateModel)) { ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); @@ -9764,83 +10035,98 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_122$$75, &intermediateModel, "save", NULL, 0); + ZEPHIR_CALL_METHOD(&_103$$43, &intermediateModel, "save", NULL, 0); zephir_check_call_status(); - if (!(zephir_is_true(&_122$$75))) { - ZEPHIR_CALL_METHOD(&_123$$78, &intermediateModel, "getmessages", NULL, 0); + if (!(zephir_is_true(&_103$$43))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); zephir_check_call_status(); - zephir_is_iterable(&_123$$78, 0, "phalcon/Mvc/Model.zep", 5234); - if (Z_TYPE_P(&_123$$78) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_123$$78), _124$$78) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _124$$78); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_126$$80); - zephir_create_array(&_126$$80, 1, 0); - zephir_array_update_string(&_126$$80, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_126$$80); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_123$$78, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_125$$78, &_123$$78, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_125$$78)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_123$$78, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&message) == IS_OBJECT) { - ZEPHIR_INIT_NVAR(&_127$$82); - zephir_create_array(&_127$$82, 1, 0); - zephir_array_update_string(&_127$$82, SL("model"), &intermediateModel, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_127$$82); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_123$$78, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); if (nesting) { - ZVAL_BOOL(&_128$$78, 1); + ZVAL_BOOL(&_104$$47, 1); } else { - ZVAL_BOOL(&_128$$78, 0); + ZVAL_BOOL(&_104$$47, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_129, 0, &_128$$78); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_105, 0, &_104$$47); zephir_check_call_status(); RETURN_MM_BOOL(0); } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } else { + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5262); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _106$$48) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _106$$48); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_108$$49, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_108$$49))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_109$$50, 1); + } else { + ZVAL_BOOL(&_109$$50, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_110, 0, &_109$$50); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_107$$48, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_107$$48)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_111$$51, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_111$$51))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_112$$52, 1); + } else { + ZVAL_BOOL(&_112$$52, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_113, 0, &_112$$52); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&recordAfter); } - ZEPHIR_INIT_NVAR(&recordAfter); } else { if (UNEXPECTED(Z_TYPE_P(&record) != IS_ARRAY)) { if (nesting) { - ZVAL_BOOL(&_130$$84, 1); + ZVAL_BOOL(&_114$$54, 1); } else { - ZVAL_BOOL(&_130$$84, 0); + ZVAL_BOOL(&_114$$54, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_131, 0, &_130$$84); + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_115, 0, &_114$$54); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_132$$84); - object_init_ex(&_132$$84, phalcon_mvc_model_exception_ce); - ZEPHIR_INIT_NVAR(&_133$$84); - ZEPHIR_CONCAT_SVSVS(&_133$$84, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_132$$84, "__construct", &_17, 29, &_133$$84); + ZEPHIR_INIT_NVAR(&_116$$54); + object_init_ex(&_116$$54, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_117$$54); + ZEPHIR_CONCAT_SVSVS(&_117$$54, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_116$$54, "__construct", &_13, 32, &_117$$54); zephir_check_call_status(); - zephir_throw_exception_debug(&_132$$84, "phalcon/Mvc/Model.zep", 5246); + zephir_throw_exception_debug(&_116$$54, "phalcon/Mvc/Model.zep", 5269); ZEPHIR_MM_RESTORE(); return; } @@ -9852,11 +10138,11 @@ PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) ZEPHIR_INIT_NVAR(&record); ZEPHIR_INIT_NVAR(&name); if (nesting) { - ZVAL_BOOL(&_134, 1); + ZVAL_BOOL(&_118, 1); } else { - ZVAL_BOOL(&_134, 0); + ZVAL_BOOL(&_118, 0); } - ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0, &_134); + ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0, &_118); zephir_check_call_status(); RETURN_MM_BOOL(1); } @@ -9908,7 +10194,7 @@ PHP_METHOD(Phalcon_Mvc_Model, allowEmptyStringValues) ZEPHIR_INIT_VAR(&keysAttributes); array_init(&keysAttributes); - zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5287); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5310); if (Z_TYPE_P(&attributes) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) { @@ -10791,7 +11077,7 @@ PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnCreate) ZEPHIR_INIT_VAR(&keysAttributes); array_init(&keysAttributes); - zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5746); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5769); if (Z_TYPE_P(&attributes) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) { @@ -10870,7 +11156,7 @@ PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnUpdate) ZEPHIR_INIT_VAR(&keysAttributes); array_init(&keysAttributes); - zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5781); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5804); if (Z_TYPE_P(&attributes) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) { @@ -10986,9 +11272,9 @@ PHP_METHOD(Phalcon_Mvc_Model, validate) { zend_object_iterator *_1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL, *_8 = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_9 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *validator, validator_sub, messages, message, _0, _2$$4, _3$$4, _4$$4, _5$$4, _6$$4; + zval *validator, validator_sub, messages, message, _0, _2$$4, _3$$4, _4$$4, _5$$4, _6$$4, _7$$4; zval *this_ptr = getThis(); ZVAL_UNDEF(&validator_sub); @@ -11000,6 +11286,7 @@ PHP_METHOD(Phalcon_Mvc_Model, validate) ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_5$$4); ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -11034,9 +11321,11 @@ PHP_METHOD(Phalcon_Mvc_Model, validate) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_6$$4, &message, "getcode", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", &_7, 6, &_3$$4, &_4$$4, &_5$$4, &_6$$4); + ZEPHIR_CALL_METHOD(&_7$$4, &message, "getmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", &_8, 6, &_3$$4, &_4$$4, &_5$$4, &_6$$4, &_7$$4); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_8, 0, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_9, 0, &_2$$4); zephir_check_call_status(); } zend_iterator_dtor(_1); @@ -11121,7 +11410,7 @@ PHP_METHOD(Phalcon_Mvc_Model, caseInsensitiveColumnMap) ZEPHIR_INIT_VAR(&_0); zephir_array_keys(&_0, columnMap); - zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 5917); + zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 5941); if (Z_TYPE_P(&_0) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) { @@ -11162,6 +11451,84 @@ PHP_METHOD(Phalcon_Mvc_Model, caseInsensitiveColumnMap) RETURN_MM(); } +/*** + * Append messages to this model from another Model. + */ +PHP_METHOD(Phalcon_Mvc_Model, appendMessagesFrom) +{ + zval _2$$5, _4$$7; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_3 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, messages, message, *_0$$3, _1$$3; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_4$$7); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(model) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); + + + ZEPHIR_CALL_METHOD(&messages, model, "getmessages", NULL, 0); + zephir_check_call_status(); + if (0 == ZEPHIR_IS_EMPTY(&messages)) { + zephir_is_iterable(&messages, 0, "phalcon/Mvc/Model.zep", 5965); + if (Z_TYPE_P(&messages) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&messages), _0$$3) + { + ZEPHIR_INIT_NVAR(&message); + ZVAL_COPY(&message, _0$$3); + if (Z_TYPE_P(&message) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_2$$5); + zephir_create_array(&_2$$5, 1, 0); + zephir_array_update_string(&_2$$5, SL("model"), model, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_2$$5); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_3, 0, &message); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &messages, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&message, &messages, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&message) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_4$$7); + zephir_create_array(&_4$$7, 1, 0); + zephir_array_update_string(&_4$$7, SL("model"), model, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_4$$7); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_3, 0, &message); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &messages, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&message); + } + ZEPHIR_MM_RESTORE(); +} + zend_object *zephir_init_properties_Phalcon_Mvc_Model(zend_class_entry *class_type) { zval _0, _2, _4, _6, _8, _10, _12, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8, _13$$9; diff --git a/ext/phalcon/mvc/model.zep.h b/ext/phalcon/mvc/model.zep.h index 3c03fe8b9d7..123cbcc58ba 100644 --- a/ext/phalcon/mvc/model.zep.h +++ b/ext/phalcon/mvc/model.zep.h @@ -104,6 +104,7 @@ PHP_METHOD(Phalcon_Mvc_Model, useDynamicUpdate); PHP_METHOD(Phalcon_Mvc_Model, validate); PHP_METHOD(Phalcon_Mvc_Model, validationHasFailed); PHP_METHOD(Phalcon_Mvc_Model, caseInsensitiveColumnMap); +PHP_METHOD(Phalcon_Mvc_Model, appendMessagesFrom); zend_object *zephir_init_properties_Phalcon_Mvc_Model(zend_class_entry *class_type); ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model___construct, 0, 0, 0) @@ -584,6 +585,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_caseinsensitiv ZEND_ARG_INFO(0, key) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_appendmessagesfrom, 0, 1, IS_VOID, 0) + + ZEND_ARG_INFO(0, model) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_zephir_init_properties_phalcon_mvc_model, 0, 0, 0) ZEND_END_ARG_INFO() @@ -693,5 +699,6 @@ ZEPHIR_INIT_FUNCS(phalcon_mvc_model_method_entry) { PHP_ME(Phalcon_Mvc_Model, validate, arginfo_phalcon_mvc_model_validate, ZEND_ACC_PROTECTED) PHP_ME(Phalcon_Mvc_Model, validationHasFailed, arginfo_phalcon_mvc_model_validationhasfailed, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Mvc_Model, caseInsensitiveColumnMap, arginfo_phalcon_mvc_model_caseinsensitivecolumnmap, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) + PHP_ME(Phalcon_Mvc_Model, appendMessagesFrom, arginfo_phalcon_mvc_model_appendmessagesfrom, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/phalcon/mvc/model/behavior/timestampable.zep.c b/ext/phalcon/mvc/model/behavior/timestampable.zep.c index 791e34d207e..1f1262deea1 100644 --- a/ext/phalcon/mvc/model/behavior/timestampable.zep.c +++ b/ext/phalcon/mvc/model/behavior/timestampable.zep.c @@ -101,7 +101,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, notify) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'field' is required", "phalcon/Mvc/Model/Behavior/Timestampable.zep", 50); return; } - ZEPHIR_CALL_METHOD(×tamp, this_ptr, "gettimestamp", NULL, 431, &options); + ZEPHIR_CALL_METHOD(×tamp, this_ptr, "gettimestamp", NULL, 436, &options); zephir_check_call_status(); if (UNEXPECTED(Z_TYPE_P(&field) == IS_ARRAY)) { zephir_is_iterable(&field, 0, "phalcon/Mvc/Model/Behavior/Timestampable.zep", 63); @@ -165,7 +165,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, getTimestamp) ZEPHIR_OBS_VAR(&format); if (zephir_array_isset_string_fetch(&format, &options, SL("format"), 0)) { - ZEPHIR_RETURN_CALL_FUNCTION("date", NULL, 432, &format); + ZEPHIR_RETURN_CALL_FUNCTION("date", NULL, 437, &format); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/mvc/model/binder.zep.c b/ext/phalcon/mvc/model/binder.zep.c index 39d5d5588f0..3c663798953 100644 --- a/ext/phalcon/mvc/model/binder.zep.c +++ b/ext/phalcon/mvc/model/binder.zep.c @@ -435,16 +435,16 @@ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) ZEPHIR_INIT_VAR(&reflection); if (!ZEPHIR_IS_NULL(&methodName)) { object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionmethod"))); - ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 433, handler, &methodName); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 438, handler, &methodName); zephir_check_call_status(); } else { object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionfunction"))); - ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 147, handler); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 150, handler); zephir_check_call_status(); } zephir_read_property(&_0, this_ptr, ZEND_STRL("cache"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&cache, &_0); - ZEPHIR_CALL_METHOD(&methodParams, &reflection, "getparameters", NULL, 148); + ZEPHIR_CALL_METHOD(&methodParams, &reflection, "getparameters", NULL, 151); zephir_check_call_status(); ZEPHIR_INIT_VAR(¶msKeys); zephir_array_keys(¶msKeys, ¶ms); @@ -477,7 +477,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 199); ZEPHIR_INIT_NVAR(&_6$$5); ZVAL_STRING(&_6$$5, "Phalcon\\Mvc\\Model"); - ZEPHIR_CALL_FUNCTION(&_7$$5, "is_subclass_of", &_8, 434, &className, &_6$$5); + ZEPHIR_CALL_FUNCTION(&_7$$5, "is_subclass_of", &_8, 439, &className, &_6$$5); zephir_check_call_status(); if (ZEPHIR_IS_STRING(&className, "Phalcon\\Mvc\\Model")) { if (Z_TYPE_P(&realClasses) == IS_NULL) { @@ -502,7 +502,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) object_init_ex(&_10$$14, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_11$$14); ZEPHIR_CONCAT_SVS(&_11$$14, "You should provide model class name for ", ¶mKey, " parameter"); - ZEPHIR_CALL_METHOD(NULL, &_10$$14, "__construct", &_12, 29, &_11$$14); + ZEPHIR_CALL_METHOD(NULL, &_10$$14, "__construct", &_12, 32, &_11$$14); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$14, "phalcon/Mvc/Model/Binder.zep", 219); ZEPHIR_MM_RESTORE(); @@ -559,7 +559,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 199); ZEPHIR_INIT_NVAR(&_15$$19); ZVAL_STRING(&_15$$19, "Phalcon\\Mvc\\Model"); - ZEPHIR_CALL_FUNCTION(&_16$$19, "is_subclass_of", &_8, 434, &className, &_15$$19); + ZEPHIR_CALL_FUNCTION(&_16$$19, "is_subclass_of", &_8, 439, &className, &_15$$19); zephir_check_call_status(); if (ZEPHIR_IS_STRING(&className, "Phalcon\\Mvc\\Model")) { if (Z_TYPE_P(&realClasses) == IS_NULL) { @@ -584,7 +584,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) object_init_ex(&_18$$28, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_NVAR(&_19$$28); ZEPHIR_CONCAT_SVS(&_19$$28, "You should provide model class name for ", ¶mKey, " parameter"); - ZEPHIR_CALL_METHOD(NULL, &_18$$28, "__construct", &_12, 29, &_19$$28); + ZEPHIR_CALL_METHOD(NULL, &_18$$28, "__construct", &_12, 32, &_19$$28); zephir_check_call_status(); zephir_throw_exception_debug(&_18$$28, "phalcon/Mvc/Model/Binder.zep", 219); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/mvc/model/criteria.zep.c b/ext/phalcon/mvc/model/criteria.zep.c index e1d8f95f4c7..d6c071a38fa 100644 --- a/ext/phalcon/mvc/model/criteria.zep.c +++ b/ext/phalcon/mvc/model/criteria.zep.c @@ -783,19 +783,19 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 426, container); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 431, container); zephir_check_call_status(); if (zephir_fast_count_int(&conditions)) { ZEPHIR_INIT_VAR(&_16$$16); ZEPHIR_INIT_VAR(&_17$$16); ZEPHIR_CONCAT_SVS(&_17$$16, " ", &operator, " "); zephir_fast_join(&_16$$16, &_17$$16, &conditions); - ZEPHIR_CALL_METHOD(NULL, &criteria, "where", NULL, 435, &_16$$16); + ZEPHIR_CALL_METHOD(NULL, &criteria, "where", NULL, 440, &_16$$16); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &criteria, "bind", NULL, 436, &bind); + ZEPHIR_CALL_METHOD(NULL, &criteria, "bind", NULL, 441, &bind); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 427, &modelName); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 432, &modelName); zephir_check_call_status(); RETURN_CCTOR(&criteria); } @@ -1459,11 +1459,11 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit) ZVAL_LONG(&_0, limit); - ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 280, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 283, &_0); zephir_check_call_status(); limit = zephir_get_numberval(&_1); ZVAL_LONG(&_0, offset); - ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 280, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 283, &_0); zephir_check_call_status(); offset = zephir_get_numberval(&_2); if (UNEXPECTED(limit == 0)) { diff --git a/ext/phalcon/mvc/model/manager.zep.c b/ext/phalcon/mvc/model/manager.zep.c index 21f3a6226d4..f83cb9856c7 100644 --- a/ext/phalcon/mvc/model/manager.zep.c +++ b/ext/phalcon/mvc/model/manager.zep.c @@ -366,7 +366,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, addBelongsTo) ZEPHIR_INIT_VAR(&relation); object_init_ex(&relation, phalcon_mvc_model_relation_ce); ZVAL_LONG(&_2, 0); - ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 437, &_2, &referencedModel, fields, referencedFields, &options); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_2, &referencedModel, fields, referencedFields, &options); zephir_check_call_status(); ZEPHIR_OBS_VAR(&alias); if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { @@ -487,7 +487,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasMany) ZEPHIR_INIT_VAR(&relation); object_init_ex(&relation, phalcon_mvc_model_relation_ce); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 437, &_1, &referencedModel, fields, referencedFields, &options); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); zephir_check_call_status(); ZEPHIR_OBS_VAR(&alias); if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { @@ -635,9 +635,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasManyToMany) ZEPHIR_INIT_VAR(&relation); object_init_ex(&relation, phalcon_mvc_model_relation_ce); ZVAL_LONG(&_1, 4); - ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 437, &_1, &referencedModel, fields, referencedFields, &options); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 438, intermediateFields, &intermediateModel, intermediateReferencedFields); + ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 443, intermediateFields, &intermediateModel, intermediateReferencedFields); zephir_check_call_status(); ZEPHIR_OBS_VAR(&alias); if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { @@ -757,7 +757,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOne) ZEPHIR_INIT_VAR(&relation); object_init_ex(&relation, phalcon_mvc_model_relation_ce); ZVAL_LONG(&_2, 1); - ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 437, &_2, &referencedModel, fields, referencedFields, &options); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_2, &referencedModel, fields, referencedFields, &options); zephir_check_call_status(); ZEPHIR_OBS_VAR(&alias); if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { @@ -905,9 +905,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOneThrough) ZEPHIR_INIT_VAR(&relation); object_init_ex(&relation, phalcon_mvc_model_relation_ce); ZVAL_LONG(&_1, 3); - ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 437, &_1, &referencedModel, fields, referencedFields, &options); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 438, intermediateFields, &intermediateModel, intermediateReferencedFields); + ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 443, intermediateFields, &intermediateModel, intermediateReferencedFields); zephir_check_call_status(); ZEPHIR_OBS_VAR(&alias); if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { @@ -2402,7 +2402,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SVSVSVSVS(&_4$$3, "[", &intermediateModel, "].[", &intermediateFields, "] = [", &referencedModel, "].[", &_3$$3, "]"); zephir_array_append(&joinConditions, &_4$$3, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 1401); - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "mergefindparameters", NULL, 439, &extraParameters, parameters); + ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "mergefindparameters", NULL, 444, &extraParameters, parameters); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&builder, this_ptr, "createbuilder", NULL, 0, &_5$$3); zephir_check_call_status(); @@ -2533,10 +2533,10 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords) ZEPHIR_CALL_METHOD(&_32, record, "getdi", NULL, 0); zephir_check_call_status(); zephir_array_update_string(&findParams, SL("di"), &_32, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "mergefindparameters", NULL, 439, &findParams, parameters); + ZEPHIR_CALL_METHOD(&findArguments, this_ptr, "mergefindparameters", NULL, 444, &findParams, parameters); zephir_check_call_status(); if (Z_TYPE_P(&extraParameters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&findParams, this_ptr, "mergefindparameters", NULL, 439, &extraParameters, &findArguments); + ZEPHIR_CALL_METHOD(&findParams, this_ptr, "mergefindparameters", NULL, 444, &extraParameters, &findArguments); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&findParams, &findArguments); @@ -3073,7 +3073,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, hasBelongsTo) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "belongsTo"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 440, &_0, &modelName, &modelRelation); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 445, &_0, &modelName, &modelRelation); zephir_check_call_status(); RETURN_MM(); } @@ -3130,7 +3130,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, hasHasMany) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hasMany"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 440, &_0, &modelName, &modelRelation); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 445, &_0, &modelName, &modelRelation); zephir_check_call_status(); RETURN_MM(); } @@ -3187,7 +3187,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, hasHasManyToMany) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hasManyToMany"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 440, &_0, &modelName, &modelRelation); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 445, &_0, &modelName, &modelRelation); zephir_check_call_status(); RETURN_MM(); } @@ -3244,7 +3244,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, hasHasOne) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hasOne"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 440, &_0, &modelName, &modelRelation); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 445, &_0, &modelName, &modelRelation); zephir_check_call_status(); RETURN_MM(); } @@ -3301,7 +3301,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, hasHasOneThrough) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hasOneThrough"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 440, &_0, &modelName, &modelRelation); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "checkhasrelationship", NULL, 445, &_0, &modelName, &modelRelation); zephir_check_call_status(); RETURN_MM(); } @@ -3435,6 +3435,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isKeepingSnapshots) zephir_fetch_params(1, 1, 0, &model); + if (ZEPHIR_GLOBAL(orm).dynamic_update) { + RETURN_MM_BOOL(1); + } zephir_read_property(&_0, this_ptr, ZEND_STRL("keepSnapshots"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); zephir_get_class(&_1, model, 1); @@ -3473,6 +3476,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isUsingDynamicUpdate) zephir_fetch_params(1, 1, 0, &model); + if (ZEPHIR_GLOBAL(orm).dynamic_update) { + RETURN_MM_BOOL(1); + } zephir_read_property(&_0, this_ptr, ZEND_STRL("dynamicUpdate"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); zephir_get_class(&_1, model, 1); @@ -3542,12 +3548,12 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isVisibleModelProperty) array_init(&publicProperties); ZEPHIR_INIT_VAR(&classReflection); object_init_ex(&classReflection, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &classReflection, "__construct", NULL, 150, &className); + ZEPHIR_CALL_METHOD(NULL, &classReflection, "__construct", NULL, 153, &className); zephir_check_call_status(); ZVAL_LONG(&_1$$3, 1); - ZEPHIR_CALL_METHOD(&reflectionProperties, &classReflection, "getproperties", NULL, 161, &_1$$3); + ZEPHIR_CALL_METHOD(&reflectionProperties, &classReflection, "getproperties", NULL, 164, &_1$$3); zephir_check_call_status(); - zephir_is_iterable(&reflectionProperties, 0, "phalcon/Mvc/Model/Manager.zep", 1905); + zephir_is_iterable(&reflectionProperties, 0, "phalcon/Mvc/Model/Manager.zep", 1913); if (Z_TYPE_P(&reflectionProperties) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&reflectionProperties), _2$$3) { @@ -3580,7 +3586,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isVisibleModelProperty) } zephir_read_property(&_6, this_ptr, ZEND_STRL("modelVisibility"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&properties); - zephir_array_fetch(&properties, &_6, &className, PH_NOISY, "phalcon/Mvc/Model/Manager.zep", 1908); + zephir_array_fetch(&properties, &_6, &className, PH_NOISY, "phalcon/Mvc/Model/Manager.zep", 1916); RETURN_MM_BOOL(zephir_array_key_exists(&properties, &property)); } @@ -3673,9 +3679,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, load) object_init_ex(&_0$$3, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZEPHIR_CONCAT_SVS(&_1$$3, "Model '", &modelName, "' could not be loaded"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &_1$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/Model/Manager.zep", 1943); + zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/Model/Manager.zep", 1951); ZEPHIR_MM_RESTORE(); return; } @@ -3751,7 +3757,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, notifyEvent) ZEPHIR_INIT_VAR(&_1); zephir_get_class(&_1, model, 1); if (zephir_array_isset_fetch(&modelsBehaviors, &_0, &_1, 0)) { - zephir_is_iterable(&modelsBehaviors, 0, "phalcon/Mvc/Model/Manager.zep", 1990); + zephir_is_iterable(&modelsBehaviors, 0, "phalcon/Mvc/Model/Manager.zep", 1998); if (Z_TYPE_P(&modelsBehaviors) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&modelsBehaviors), _2$$3) { @@ -3869,7 +3875,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, missingMethod) ZEPHIR_INIT_VAR(&_1); zephir_get_class(&_1, model, 1); if (zephir_array_isset_fetch(&modelsBehaviors, &_0, &_1, 0)) { - zephir_is_iterable(&modelsBehaviors, 0, "phalcon/Mvc/Model/Manager.zep", 2052); + zephir_is_iterable(&modelsBehaviors, 0, "phalcon/Mvc/Model/Manager.zep", 2060); if (Z_TYPE_P(&modelsBehaviors) == IS_ARRAY) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&modelsBehaviors), _2$$3) { @@ -4437,14 +4443,14 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getConnection) zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&container, &_0); if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ORM", "phalcon/Mvc/Model/Manager.zep", 2257); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ORM", "phalcon/Mvc/Model/Manager.zep", 2265); return; } ZEPHIR_CALL_METHOD(&_1, &container, "getshared", NULL, 0, &service); zephir_check_call_status(); ZEPHIR_CPY_WRT(&connection, &_1); if (UNEXPECTED(Z_TYPE_P(&connection) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid injected connection service", "phalcon/Mvc/Model/Manager.zep", 2266); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid injected connection service", "phalcon/Mvc/Model/Manager.zep", 2274); return; } RETURN_CCTOR(&connection); @@ -4520,7 +4526,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) ZEPHIR_CPY_WRT(findParamsTwo, &_1$$4); } if (Z_TYPE_P(findParamsOne) == IS_ARRAY) { - zephir_is_iterable(findParamsOne, 0, "phalcon/Mvc/Model/Manager.zep", 2311); + zephir_is_iterable(findParamsOne, 0, "phalcon/Mvc/Model/Manager.zep", 2319); if (Z_TYPE_P(findParamsOne) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(findParamsOne), _4$$5, _5$$5, _2$$5) { @@ -4540,7 +4546,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) if (!(zephir_array_isset_long(&findParams, 0))) { zephir_array_update_long(&findParams, 0, &value, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); } else { - zephir_array_fetch_long(&_7$$9, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2305); + zephir_array_fetch_long(&_7$$9, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2313); ZEPHIR_INIT_NVAR(&_8$$9); ZEPHIR_CONCAT_SVSVS(&_8$$9, "(", &_7$$9, ") AND (", &value, ")"); zephir_array_update_long(&findParams, 0, &_8$$9, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -4570,7 +4576,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) if (!(zephir_array_isset_long(&findParams, 0))) { zephir_array_update_long(&findParams, 0, &value, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); } else { - zephir_array_fetch_long(&_10$$14, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2305); + zephir_array_fetch_long(&_10$$14, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2313); ZEPHIR_INIT_NVAR(&_11$$14); ZEPHIR_CONCAT_SVSVS(&_11$$14, "(", &_10$$14, ") AND (", &value, ")"); zephir_array_update_long(&findParams, 0, &_11$$14, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -4586,7 +4592,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) ZEPHIR_INIT_NVAR(&key); } if (Z_TYPE_P(findParamsTwo) == IS_ARRAY) { - zephir_is_iterable(findParamsTwo, 0, "phalcon/Mvc/Model/Manager.zep", 2336); + zephir_is_iterable(findParamsTwo, 0, "phalcon/Mvc/Model/Manager.zep", 2344); if (Z_TYPE_P(findParamsTwo) == IS_ARRAY) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(findParamsTwo), _14$$16, _15$$16, _12$$16) { @@ -4610,7 +4616,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) if (!(zephir_array_isset_long(&findParams, 0))) { zephir_array_update_long(&findParams, 0, &value, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); } else { - zephir_array_fetch_long(&_18$$20, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2319); + zephir_array_fetch_long(&_18$$20, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2327); ZEPHIR_INIT_NVAR(&_19$$20); ZEPHIR_CONCAT_SVSVS(&_19$$20, "(", &_18$$20, ") AND (", &value, ")"); zephir_array_update_long(&findParams, 0, &_19$$20, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -4621,7 +4627,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) zephir_array_update_zval(&findParams, &key, &value, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(&_20$$24); - zephir_array_fetch(&_21$$24, &findParams, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2327); + zephir_array_fetch(&_21$$24, &findParams, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2335); zephir_fast_array_merge(&_20$$24, &_21$$24, &value); zephir_array_update_zval(&findParams, &key, &_20$$24, PH_COPY | PH_SEPARATE); } @@ -4655,7 +4661,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) if (!(zephir_array_isset_long(&findParams, 0))) { zephir_array_update_long(&findParams, 0, &value, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); } else { - zephir_array_fetch_long(&_24$$29, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2319); + zephir_array_fetch_long(&_24$$29, &findParams, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2327); ZEPHIR_INIT_NVAR(&_25$$29); ZEPHIR_CONCAT_SVSVS(&_25$$29, "(", &_24$$29, ") AND (", &value, ")"); zephir_array_update_long(&findParams, 0, &_25$$29, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -4666,7 +4672,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, mergeFindParameters) zephir_array_update_zval(&findParams, &key, &value, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(&_26$$33); - zephir_array_fetch(&_27$$33, &findParams, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2327); + zephir_array_fetch(&_27$$33, &findParams, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 2335); zephir_fast_array_merge(&_26$$33, &_27$$33, &value); zephir_array_update_zval(&findParams, &key, &_26$$33, PH_COPY | PH_SEPARATE); } diff --git a/ext/phalcon/mvc/model/metadata.zep.c b/ext/phalcon/mvc/model/metadata.zep.c index 302ccf7d596..85304eda532 100644 --- a/ext/phalcon/mvc/model/metadata.zep.c +++ b/ext/phalcon/mvc/model/metadata.zep.c @@ -20,7 +20,6 @@ #include "kernel/array.h" #include "ext/spl/spl_exceptions.h" #include "kernel/concat.h" -#include "kernel/string.h" /** @@ -913,16 +912,13 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, keyName, data, _0, _1$$4, _2$$4, _3$$4; + zval *model, model_sub, keyName, _0$$4, _1$$4; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -938,21 +934,14 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap) if (!(ZEPHIR_GLOBAL(orm).column_renaming)) { RETURN_MM_NULL(); } - ZEPHIR_INIT_VAR(&keyName); - zephir_get_class(&keyName, model, 1); - ZEPHIR_OBS_VAR(&data); - zephir_read_property(&_0, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&data, &_0, &keyName, 0))) { - ZVAL_NULL(&_1$$4); - ZVAL_NULL(&_2$$4); - ZVAL_NULL(&_3$$4); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 26, model, &_1$$4, &_2$$4, &_3$$4); - zephir_check_call_status(); - zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_NVAR(&data); - zephir_array_fetch(&data, &_1$$4, &keyName, PH_NOISY, "phalcon/Mvc/Model/MetaData.zep", 539); + ZEPHIR_CALL_METHOD(&keyName, this_ptr, "getcolumnmapuniquekey", NULL, 26, model); + zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(&keyName) != IS_NULL)) { + zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1$$4, &_0$$4, &keyName, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 535); + RETURN_CTOR(&_1$$4); } - RETURN_CCTOR(&data); + RETURN_MM_NULL(); } /** @@ -971,17 +960,14 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMapIndex) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long index, ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, *index_param = NULL, keyName, columnMapModel, map, _0, _1$$4, _2$$4, _3$$4; + zval *model, model_sub, *index_param = NULL, keyName, _0$$4, _1$$4, _2$$4; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&columnMapModel); - ZVAL_UNDEF(&map); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -999,22 +985,15 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMapIndex) if (!(ZEPHIR_GLOBAL(orm).column_renaming)) { RETURN_MM_NULL(); } - ZEPHIR_INIT_VAR(&keyName); - zephir_get_class(&keyName, model, 1); - ZEPHIR_OBS_VAR(&columnMapModel); - zephir_read_property(&_0, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&columnMapModel, &_0, &keyName, 0))) { - ZVAL_NULL(&_1$$4); - ZVAL_NULL(&_2$$4); - ZVAL_NULL(&_3$$4); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 26, model, &_1$$4, &_2$$4, &_3$$4); - zephir_check_call_status(); - zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_NVAR(&columnMapModel); - zephir_array_fetch(&columnMapModel, &_1$$4, &keyName, PH_NOISY, "phalcon/Mvc/Model/MetaData.zep", 570); + ZEPHIR_CALL_METHOD(&keyName, this_ptr, "getcolumnmapuniquekey", NULL, 26, model); + zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(&keyName) != IS_NULL)) { + zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1$$4, &_0$$4, &keyName, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 561); + zephir_array_fetch_long(&_2$$4, &_1$$4, index, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 561); + RETURN_CTOR(&_2$$4); } - zephir_array_isset_long_fetch(&map, &columnMapModel, index, 1); - RETURN_CTOR(&map); + RETURN_MM_NULL(); } /** @@ -1030,21 +1009,15 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMapIndex) */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaData) { - zval key; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, source, schema, _0, _1, _2, _3, _4; + zval *model, model_sub, key, _0$$3, _1$$3; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); - ZVAL_UNDEF(&source); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -1057,23 +1030,14 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaData) zephir_fetch_params(1, 1, 0, &model); - ZEPHIR_CALL_METHOD(&source, model, "getsource", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&schema, model, "getschema", NULL, 0); + ZEPHIR_CALL_METHOD(&key, this_ptr, "getmetadatauniquekey", NULL, 27, model); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_get_class(&_0, model, 1); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_VSVV(&_1, &_0, "-", &schema, &source); - zephir_get_strval(&key, &_1); - zephir_read_property(&_2, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset(&_2, &key))) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 26, model, &key, &source, &schema); - zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(&key) != IS_NULL)) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1$$3, &_0$$3, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 582); + RETURN_CTOR(&_1$$3); } - zephir_read_property(&_3, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4, &_3, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 606); - RETURN_CTOR(&_4); + RETURN_MM_NULL(); } /** @@ -1090,23 +1054,16 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaData) */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex) { - zval key; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long index, ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, *index_param = NULL, source, schema, _0, _1, _2, _3, _4, _5, _6; + zval *model, model_sub, *index_param = NULL, key, _0$$3, _1$$3, _2$$3; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); - ZVAL_UNDEF(&source); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -1121,25 +1078,15 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex) index = zephir_get_intval(index_param); - ZEPHIR_CALL_METHOD(&source, model, "getsource", NULL, 0); + ZEPHIR_CALL_METHOD(&key, this_ptr, "getmetadatauniquekey", NULL, 27, model); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&schema, model, "getschema", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_get_class(&_0, model, 1); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_VSVV(&_1, &_0, "-", &schema, &source); - zephir_get_strval(&key, &_1); - zephir_read_property(&_2, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_3, &_2, &key, PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 634); - if (!(zephir_array_isset_long(&_3, index))) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 26, model, &key, &source, &schema); - zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(&key) != IS_NULL)) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1$$3, &_0$$3, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 604); + zephir_array_fetch_long(&_2$$3, &_1$$3, index, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 604); + RETURN_CTOR(&_2$$3); } - zephir_read_property(&_4, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_5, &_4, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 638); - zephir_array_fetch_long(&_6, &_5, index, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/MetaData.zep", 638); - RETURN_CTOR(&_6); + RETURN_MM_NULL(); } /** @@ -1208,7 +1155,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, setAutomaticCreateAttributes) ZVAL_LONG(&_0, 10); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 27, model, &_0, &attributes); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 28, model, &_0, &attributes); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -1251,7 +1198,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, setAutomaticUpdateAttributes) ZVAL_LONG(&_0, 11); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 27, model, &_0, &attributes); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 28, model, &_0, &attributes); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -1294,7 +1241,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, setEmptyStringAttributes) ZVAL_LONG(&_0, 13); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 27, model, &_0, &attributes); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "writemetadataindex", NULL, 28, model, &_0, &attributes); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -1396,7 +1343,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, write) ZEPHIR_CALL_METHOD(&result, &_0$$3, "set", NULL, 0, &key, &data); zephir_check_call_status_or_jump(try_end_1); if (ZEPHIR_IS_FALSE_IDENTICAL(&result)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwwriteexception", NULL, 28, &option); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwwriteexception", NULL, 29, &option); zephir_check_call_status_or_jump(try_end_1); } @@ -1410,7 +1357,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, write) if (zephir_is_instance_of(&_1, SL("Exception"))) { zend_clear_exception(); ZEPHIR_CPY_WRT(&_2, &_1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwwriteexception", NULL, 28, &option); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwwriteexception", NULL, 29, &option); zephir_check_call_status(); } } @@ -1434,20 +1381,13 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, write) */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, writeMetaDataIndex) { - zend_bool _0, _1; - zval key; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long index, ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, *index_param = NULL, *data, data_sub, source, schema, _2, _3, _4; + zval *model, model_sub, *index_param = NULL, *data, data_sub, key; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&source); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); ZVAL_UNDEF(&key); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -1464,89 +1404,93 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, writeMetaDataIndex) index = zephir_get_intval(index_param); - _0 = Z_TYPE_P(data) != IS_ARRAY; - if (_0) { - _0 = Z_TYPE_P(data) != IS_STRING; - } - _1 = _0; - if (_1) { - _1 = ((Z_TYPE_P(data) == IS_TRUE || Z_TYPE_P(data) == IS_FALSE) != 1); - } - if (UNEXPECTED(_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid data for index", "phalcon/Mvc/Model/MetaData.zep", 773); - return; - } - ZEPHIR_CALL_METHOD(&source, model, "getsource", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&schema, model, "getschema", NULL, 0); + ZEPHIR_CALL_METHOD(&key, this_ptr, "getmetadatauniquekey", NULL, 27, model); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - zephir_get_class(&_2, model, 1); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_VSVV(&_3, &_2, "-", &schema, &source); - zephir_get_strval(&key, &_3); - zephir_read_property(&_4, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset(&_4, &key))) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 26, model, &key, &source, &schema); - zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(&key) != IS_NULL)) { + zephir_update_property_array_multi(this_ptr, SL("metaData"), data, SL("zl"), 2, &key, index); } - zephir_update_property_array_multi(this_ptr, SL("metaData"), data, SL("zl"), 2, &key, index); ZEPHIR_MM_RESTORE(); } /** - * Initialize the metadata for certain table + * Initialize old behaviour for compatability */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, initialize) { - zval prefixKey; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *model, model_sub, *key, key_sub, *table, table_sub, *schema, schema_sub, strategy, className, metaData, data, modelMetadata, modelColumnMap, container, keyName, _4, _5, _0$$3, _1$$4, _2$$8, _3$$8; + zval *model, model_sub, *key, key_sub, *table, table_sub, *schema, schema_sub; zval *this_ptr = getThis(); ZVAL_UNDEF(&model_sub); ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&table_sub); ZVAL_UNDEF(&schema_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(key) + Z_PARAM_ZVAL(table) + Z_PARAM_ZVAL(schema) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 4, 0, &model, &key, &table, &schema); + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initializemetadata", NULL, 30, model, key); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initializecolumnmap", NULL, 31, model, key); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); +} + +/** + * Initialize the metadata for certain table + */ +PHP_METHOD(Phalcon_Mvc_Model_MetaData, initializeMetaData) +{ + zval prefixKey; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, *key, key_sub, strategy, metaData, data, modelMetadata, container, _0$$3, _1$$4, _2$$8, _3$$8, _4$$8; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&strategy); - ZVAL_UNDEF(&className); ZVAL_UNDEF(&metaData); ZVAL_UNDEF(&data); ZVAL_UNDEF(&modelMetadata); - ZVAL_UNDEF(&modelColumnMap); ZVAL_UNDEF(&container); - ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$8); ZVAL_UNDEF(&_3$$8); + ZVAL_UNDEF(&_4$$8); ZVAL_UNDEF(&prefixKey); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(4, 4) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) Z_PARAM_ZVAL(key) - Z_PARAM_ZVAL(table) - Z_PARAM_ZVAL(schema) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 4, 0, &model, &key, &table, &schema); + zephir_fetch_params(1, 2, 0, &model, &key); ZEPHIR_INIT_VAR(&strategy); ZVAL_NULL(&strategy); - ZEPHIR_INIT_VAR(&className); - zephir_get_class(&className, model, 0); - if (Z_TYPE_P(key) != IS_NULL) { + if (EXPECTED(Z_TYPE_P(key) != IS_NULL)) { zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&metaData, &_0$$3); - if (!(zephir_array_isset(&metaData, key))) { + if (0 == zephir_array_isset(&metaData, key)) { ZEPHIR_INIT_VAR(&_1$$4); ZEPHIR_CONCAT_SV(&_1$$4, "meta-", key); zephir_get_strval(&prefixKey, &_1$$4); @@ -1562,10 +1506,12 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, initialize) ZEPHIR_INIT_VAR(&_2$$8); object_init_ex(&_2$$8, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_3$$8); - ZEPHIR_CONCAT_SV(&_3$$8, "Invalid meta-data for model ", &className); - ZEPHIR_CALL_METHOD(NULL, &_2$$8, "__construct", NULL, 29, &_3$$8); + zephir_get_class(&_3$$8, model, 0); + ZEPHIR_INIT_VAR(&_4$$8); + ZEPHIR_CONCAT_SV(&_4$$8, "Invalid meta-data for model ", &_3$$8); + ZEPHIR_CALL_METHOD(NULL, &_2$$8, "__construct", NULL, 32, &_4$$8); zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$8, "phalcon/Mvc/Model/MetaData.zep", 825); + zephir_throw_exception_debug(&_2$$8, "phalcon/Mvc/Model/MetaData.zep", 785); ZEPHIR_MM_RESTORE(); return; } @@ -1582,37 +1528,73 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, initialize) zephir_check_call_status(); } } + RETURN_MM_BOOL(1); + } + RETURN_MM_BOOL(0); +} + +/** + * Initialize ColumnMap for a certain table + */ +PHP_METHOD(Phalcon_Mvc_Model_MetaData, initializeColumnMap) +{ + zval prefixKey; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, *key, key_sub, strategy, data, modelColumnMap, container, _0, _1; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&key_sub); + ZVAL_UNDEF(&strategy); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&modelColumnMap); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&prefixKey); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(key) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &model, &key); + + + if (UNEXPECTED(Z_TYPE_P(key) == IS_NULL)) { + RETURN_MM_BOOL(0); } if (!(ZEPHIR_GLOBAL(orm).column_renaming)) { - RETURN_MM_NULL(); + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_VAR(&keyName); - zephir_fast_strtolower(&keyName, &className); - zephir_read_property(&_4, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_4, &keyName)) { - RETURN_MM_NULL(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); + if (1 == zephir_array_isset(&_0, key)) { + RETURN_MM_BOOL(0); } - ZEPHIR_INIT_VAR(&_5); - ZEPHIR_CONCAT_SV(&_5, "map-", &keyName); - zephir_get_strval(&prefixKey, &_5); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_CONCAT_SV(&_1, "map-", key); + zephir_get_strval(&prefixKey, &_1); ZEPHIR_CALL_METHOD(&data, this_ptr, "read", NULL, 0, &prefixKey); zephir_check_call_status(); if (Z_TYPE_P(&data) != IS_NULL) { - zephir_update_property_array(this_ptr, SL("columnMap"), &keyName, &data); - RETURN_MM_NULL(); - } - if (Z_TYPE_P(&strategy) != IS_OBJECT) { - ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&strategy, this_ptr, "getstrategy", NULL, 0); - zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("columnMap"), key, &data); + RETURN_MM_BOOL(0); } + ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&strategy, this_ptr, "getstrategy", NULL, 0); + zephir_check_call_status(); ZEPHIR_CALL_METHOD(&modelColumnMap, &strategy, "getcolumnmaps", NULL, 0, model, &container); zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("columnMap"), &keyName, &modelColumnMap); + zephir_update_property_array(this_ptr, SL("columnMap"), key, &modelColumnMap); ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, &prefixKey, &modelColumnMap); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM_BOOL(1); } /** @@ -1646,9 +1628,9 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, throwWriteException) if (zephir_is_true(option)) { ZEPHIR_INIT_VAR(&_0$$3); object_init_ex(&_0$$3, phalcon_mvc_model_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &message); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 32, &message); zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/Model/MetaData.zep", 909); + zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/Model/MetaData.zep", 882); ZEPHIR_MM_RESTORE(); return; } else { @@ -1700,6 +1682,90 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getArrVal) RETURN_CTOR(&value); } +/** + * Returns a MetaData Unique key for meta-data is created using className + * + * @return string + */ +PHP_METHOD(Phalcon_Mvc_Model_MetaData, getMetaDataUniqueKey) +{ + zval key; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, _0, _1$$3; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&key); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); + + + ZEPHIR_INIT_VAR(&key); + zephir_get_class(&key, model, 1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("metaData"), PH_NOISY_CC | PH_READONLY); + if (0 == zephir_array_isset(&_0, &key)) { + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "initializemetadata", NULL, 30, model, &key); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { + RETURN_MM_NULL(); + } + } + RETURN_CTOR(&key); +} + +/** + * Returns a ColumnMap Unique key for meta-data is created using className + * + * @return string + */ +PHP_METHOD(Phalcon_Mvc_Model_MetaData, getColumnMapUniqueKey) +{ + zval key; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, _0, _1$$3; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&key); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); + + + ZEPHIR_INIT_VAR(&key); + zephir_get_class(&key, model, 1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("columnMap"), PH_NOISY_CC | PH_READONLY); + if (0 == zephir_array_isset(&_0, &key)) { + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "initializecolumnmap", NULL, 31, model, &key); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { + RETURN_MM_NULL(); + } + } + RETURN_CTOR(&key); +} + zend_object *zephir_init_properties_Phalcon_Mvc_Model_MetaData(zend_class_entry *class_type) { zval _0, _2, _1$$3, _3$$4; diff --git a/ext/phalcon/mvc/model/metadata.zep.h b/ext/phalcon/mvc/model/metadata.zep.h index deb68b7c120..1ca0d8d8901 100644 --- a/ext/phalcon/mvc/model/metadata.zep.h +++ b/ext/phalcon/mvc/model/metadata.zep.h @@ -36,8 +36,12 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, setStrategy); PHP_METHOD(Phalcon_Mvc_Model_MetaData, write); PHP_METHOD(Phalcon_Mvc_Model_MetaData, writeMetaDataIndex); PHP_METHOD(Phalcon_Mvc_Model_MetaData, initialize); +PHP_METHOD(Phalcon_Mvc_Model_MetaData, initializeMetaData); +PHP_METHOD(Phalcon_Mvc_Model_MetaData, initializeColumnMap); PHP_METHOD(Phalcon_Mvc_Model_MetaData, throwWriteException); PHP_METHOD(Phalcon_Mvc_Model_MetaData, getArrVal); +PHP_METHOD(Phalcon_Mvc_Model_MetaData, getMetaDataUniqueKey); +PHP_METHOD(Phalcon_Mvc_Model_MetaData, getColumnMapUniqueKey); zend_object *zephir_init_properties_Phalcon_Mvc_Model_MetaData(zend_class_entry *class_type); ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_mvc_model_metadata_getadapter, 0, 0, Phalcon\\Cache\\Adapter\\AdapterInterface, 1) @@ -121,16 +125,16 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_readc ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_readcolumnmapindex, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_readcolumnmapindex, 0, 2, IS_ARRAY, 1) ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_readmetadata, 0, 1, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_readmetadata, 0, 1, IS_ARRAY, 1) ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_readmetadataindex, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_readmetadataindex, 0, 2, IS_ARRAY, 1) ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -186,6 +190,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_initialize, 0, 0, 4) ZEND_ARG_INFO(0, schema) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_initializemetadata, 0, 2, _IS_BOOL, 0) + ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) + ZEND_ARG_INFO(0, key) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_initializecolumnmap, 0, 2, _IS_BOOL, 0) + ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) + ZEND_ARG_INFO(0, key) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_throwwriteexception, 0, 1, IS_VOID, 0) ZEND_ARG_INFO(0, option) @@ -197,6 +211,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_getarrval, 0, 0, 2) ZEND_ARG_INFO(0, defaultValue) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_getmetadatauniquekey, 0, 1, IS_STRING, 1) + ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_model_metadata_getcolumnmapuniquekey, 0, 1, IS_STRING, 1) + ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\ModelInterface, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_metadata_zephir_init_properties_phalcon_mvc_model_metadata, 0, 0, 0) ZEND_END_ARG_INFO() @@ -234,7 +256,11 @@ ZEPHIR_INIT_FUNCS(phalcon_mvc_model_metadata_method_entry) { PHP_ME(Phalcon_Mvc_Model_MetaData, write, arginfo_phalcon_mvc_model_metadata_write, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Mvc_Model_MetaData, writeMetaDataIndex, arginfo_phalcon_mvc_model_metadata_writemetadataindex, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Mvc_Model_MetaData, initialize, arginfo_phalcon_mvc_model_metadata_initialize, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) + PHP_ME(Phalcon_Mvc_Model_MetaData, initializeMetaData, arginfo_phalcon_mvc_model_metadata_initializemetadata, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) + PHP_ME(Phalcon_Mvc_Model_MetaData, initializeColumnMap, arginfo_phalcon_mvc_model_metadata_initializecolumnmap, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) PHP_ME(Phalcon_Mvc_Model_MetaData, throwWriteException, arginfo_phalcon_mvc_model_metadata_throwwriteexception, ZEND_ACC_PRIVATE) PHP_ME(Phalcon_Mvc_Model_MetaData, getArrVal, arginfo_phalcon_mvc_model_metadata_getarrval, ZEND_ACC_PROTECTED) + PHP_ME(Phalcon_Mvc_Model_MetaData, getMetaDataUniqueKey, arginfo_phalcon_mvc_model_metadata_getmetadatauniquekey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + PHP_ME(Phalcon_Mvc_Model_MetaData, getColumnMapUniqueKey, arginfo_phalcon_mvc_model_metadata_getcolumnmapuniquekey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/phalcon/mvc/model/metadata/strategy/annotations.zep.c b/ext/phalcon/mvc/model/metadata/strategy/annotations.zep.c index d5a21d567a5..f8361a67184 100644 --- a/ext/phalcon/mvc/model/metadata/strategy/annotations.zep.c +++ b/ext/phalcon/mvc/model/metadata/strategy/annotations.zep.c @@ -104,7 +104,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Annotations, getColumnMaps) object_init_ex(&_1$$4, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_2$$4); ZEPHIR_CONCAT_SV(&_2$$4, "No annotations were found in class ", &className); - ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 29, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_2$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep", 43); ZEPHIR_MM_RESTORE(); @@ -117,7 +117,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Annotations, getColumnMaps) object_init_ex(&_3$$5, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_4$$5); ZEPHIR_CONCAT_SV(&_4$$5, "No properties with annotations were found in class ", &className); - ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 29, &_4$$5); + ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 32, &_4$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$5, "phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep", 54); ZEPHIR_MM_RESTORE(); @@ -426,7 +426,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Annotations, getMetaData) object_init_ex(&_1$$4, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_2$$4); ZEPHIR_CONCAT_SV(&_2$$4, "No annotations were found in class ", &className); - ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 29, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_2$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep", 124); ZEPHIR_MM_RESTORE(); @@ -439,7 +439,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Annotations, getMetaData) object_init_ex(&_3$$5, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(&_4$$5); ZEPHIR_CONCAT_SV(&_4$$5, "No properties with annotations were found in class ", &className); - ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 29, &_4$$5); + ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 32, &_4$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$5, "phalcon/Mvc/Model/MetaData/Strategy/Annotations.zep", 135); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/mvc/model/metadata/strategy/introspection.zep.c b/ext/phalcon/mvc/model/metadata/strategy/introspection.zep.c index 2c56a0c12d2..63f0e69119f 100644 --- a/ext/phalcon/mvc/model/metadata/strategy/introspection.zep.c +++ b/ext/phalcon/mvc/model/metadata/strategy/introspection.zep.c @@ -225,7 +225,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getMetaData) zephir_get_class(&_3$$3, model, 0); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SVSV(&_4$$3, "Table '", &completeTable, "' doesn't exist in database when dumping meta-data for ", &_3$$3); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 29, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 32, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$3, "phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep", 92); ZEPHIR_MM_RESTORE(); @@ -247,7 +247,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getMetaData) zephir_get_class(&_7$$6, model, 0); ZEPHIR_INIT_VAR(&_8$$6); ZEPHIR_CONCAT_SVSV(&_8$$6, "Cannot obtain table columns for the mapped source '", &completeTable, "' used in model ", &_7$$6); - ZEPHIR_CALL_METHOD(NULL, &_6$$6, "__construct", NULL, 29, &_8$$6); + ZEPHIR_CALL_METHOD(NULL, &_6$$6, "__construct", NULL, 32, &_8$$6); zephir_check_call_status(); zephir_throw_exception_debug(&_6$$6, "phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep", 112); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/mvc/model/metadata/stream.zep.c b/ext/phalcon/mvc/model/metadata/stream.zep.c index 19f049a7391..af1ad511ef7 100644 --- a/ext/phalcon/mvc/model/metadata/stream.zep.c +++ b/ext/phalcon/mvc/model/metadata/stream.zep.c @@ -217,7 +217,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Stream, write) ZEPHIR_CONCAT_SVS(&_5$$3, ""); RETURN_MM(); @@ -889,7 +889,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_engine_volt_exception_ce, "Corrupted statement", "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 592); return; } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, ""); RETURN_MM(); @@ -941,21 +941,21 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileEcho) object_init_ex(&_0$$3, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "Corrupt statement"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 500, &_1$$3, &statement); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 505, &_1$$3, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 616); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); zephir_array_fetch_string(&_2, &expr, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 624); if (ZEPHIR_IS_LONG(&_2, 350)) { - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "istagfactory", NULL, 502, &expr); + ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "istagfactory", NULL, 507, &expr); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_3$$4)) { ZVAL_BOOL(&_4$$5, 1); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 499, &expr, &_4$$5); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 504, &expr, &_4$$5); zephir_check_call_status(); } zephir_array_fetch_string(&name, &expr, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 629); @@ -1015,13 +1015,13 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf) object_init_ex(&_0$$3, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "Corrupt statement"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 500, &_1$$3, &statement); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 505, &_1$$3, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 666); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, ""); RETURN_MM(); @@ -1111,7 +1111,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) object_init_ex(&_0$$4, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_1$$4); ZEPHIR_CONCAT_SVS(&_1$$4, "Template file ", &path, " does not exist"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 500, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 505, &_1$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$4, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 706); ZEPHIR_MM_RESTORE(); @@ -1124,7 +1124,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileFile) object_init_ex(&_2$$5, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_3$$5); ZEPHIR_CONCAT_SVS(&_3$$5, "Template file ", &path, " could not be opened"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 500, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 505, &_3$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$5, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 718); ZEPHIR_MM_RESTORE(); @@ -1249,7 +1249,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) ZEPHIR_CONCAT_VV(&prefixLevel, &prefix, &level); ZEPHIR_OBS_VAR(&expr); zephir_array_fetch_string(&expr, &statement, SL("expr"), PH_NOISY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 782); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); ZEPHIR_OBS_VAR(&blockStatements); zephir_array_fetch_string(&blockStatements, &statement, SL("block_statements"), PH_NOISY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 788); @@ -1309,7 +1309,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) } else { ZVAL_BOOL(&_4, 0); } - ZEPHIR_CALL_METHOD(&code, this_ptr, "statementlist", NULL, 501, &blockStatements, &_4); + ZEPHIR_CALL_METHOD(&code, this_ptr, "statementlist", NULL, 506, &blockStatements, &_4); zephir_check_call_status(); ZEPHIR_OBS_VAR(&loopContext); zephir_read_property(&loopContext, this_ptr, ZEND_STRL("loopPointers"), PH_NOISY_CC); @@ -1360,7 +1360,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileForeach) } ZEPHIR_OBS_VAR(&ifExpr); if (zephir_array_isset_string_fetch(&ifExpr, &statement, SL("if_expr"), 0)) { - ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "expression", NULL, 499, &ifExpr); + ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "expression", NULL, 504, &ifExpr); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_17$$15); ZEPHIR_CONCAT_SVS(&_17$$15, "if (", &_16$$15, ") { ?>"); @@ -1502,13 +1502,13 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) object_init_ex(&_0$$3, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "Corrupt statement"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 500, &_1$$3, &statement); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 505, &_1$$3, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 941); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); zephir_array_fetch_string(&_4, &statement, SL("true_statements"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 947); if (extendsMode) { @@ -1516,7 +1516,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) } else { ZVAL_BOOL(&_5, 0); } - ZEPHIR_CALL_METHOD(&_3, this_ptr, "statementlist", NULL, 501, &_4, &_5); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "statementlist", NULL, 506, &_4, &_5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_6); ZEPHIR_CONCAT_SVSV(&_6, "", &_3); @@ -1528,7 +1528,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf) } else { ZVAL_BOOL(&_8$$4, 0); } - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "statementlist", NULL, 501, &blockStatements, &_8$$4); + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "statementlist", NULL, 506, &blockStatements, &_8$$4); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$4); ZEPHIR_CONCAT_SV(&_9$$4, "", &_7$$4); @@ -1606,14 +1606,14 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude) RETURN_CCTOR(&compilation); } } - ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", NULL, 499, &pathExpr); + ZEPHIR_CALL_METHOD(&path, this_ptr, "expression", NULL, 504, &pathExpr); zephir_check_call_status(); ZEPHIR_OBS_VAR(¶ms); if (!(zephir_array_isset_string_fetch(¶ms, &statement, SL("params"), 0))) { ZEPHIR_CONCAT_SVS(return_value, "partial(", &path, "); ?>"); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&_3, this_ptr, "expression", NULL, 499, ¶ms); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "expression", NULL, 504, ¶ms); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "partial(", &path, ", ", &_3, "); ?>"); RETURN_MM(); @@ -1701,7 +1701,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) object_init_ex(&_1$$4, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_2$$4); ZEPHIR_CONCAT_SVS(&_2$$4, "Macro '", &name, "' is already defined"); - ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 500, &_2$$4); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 505, &_2$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1063); ZEPHIR_MM_RESTORE(); @@ -1752,7 +1752,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) zephir_concat_self_str(&code, " } else { ", sizeof(" } else { ") - 1); ZEPHIR_OBS_NVAR(&defaultValue); if (EXPECTED(zephir_array_isset_string_fetch(&defaultValue, ¶meter, SL("default"), 0))) { - ZEPHIR_CALL_METHOD(&_14$$8, this_ptr, "expression", &_15, 499, &defaultValue); + ZEPHIR_CALL_METHOD(&_14$$8, this_ptr, "expression", &_15, 504, &defaultValue); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_16$$8); ZEPHIR_CONCAT_SVSVS(&_16$$8, "$", &variableName, " = ", &_14$$8, ";"); @@ -1795,7 +1795,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) zephir_concat_self_str(&code, " } else { ", sizeof(" } else { ") - 1); ZEPHIR_OBS_NVAR(&defaultValue); if (EXPECTED(zephir_array_isset_string_fetch(&defaultValue, ¶meter, SL("default"), 0))) { - ZEPHIR_CALL_METHOD(&_22$$11, this_ptr, "expression", &_15, 499, &defaultValue); + ZEPHIR_CALL_METHOD(&_22$$11, this_ptr, "expression", &_15, 504, &defaultValue); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_23$$11); ZEPHIR_CONCAT_SVSVS(&_23$$11, "$", &variableName, " = ", &_22$$11, ";"); @@ -1821,7 +1821,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileMacro) } else { ZVAL_BOOL(&_26$$13, 0); } - ZEPHIR_CALL_METHOD(&_25$$13, this_ptr, "statementlist", NULL, 501, &blockStatements, &_26$$13); + ZEPHIR_CALL_METHOD(&_25$$13, this_ptr, "statementlist", NULL, 506, &blockStatements, &_26$$13); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_27$$13); ZEPHIR_CONCAT_VS(&_27$$13, &_25$$13, ""); RETURN_MM(); @@ -1944,10 +1944,10 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) ZEPHIR_INIT_NVAR(&assignment); ZVAL_COPY(&assignment, _0); zephir_array_fetch_string(&_2$$4, &assignment, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1174); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_3, 499, &_2$$4); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_3, 504, &_2$$4); zephir_check_call_status(); zephir_array_fetch_string(&_4$$4, &assignment, SL("variable"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1181); - ZEPHIR_CALL_METHOD(&target, this_ptr, "expression", &_3, 499, &_4$$4); + ZEPHIR_CALL_METHOD(&target, this_ptr, "expression", &_3, 504, &_4$$4); zephir_check_call_status(); zephir_array_fetch_string(&_5$$4, &assignment, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1187); do { @@ -1994,10 +1994,10 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet) ZEPHIR_CALL_METHOD(&assignment, &assignments, "current", NULL, 0); zephir_check_call_status(); zephir_array_fetch_string(&_11$$10, &assignment, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1174); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_3, 499, &_11$$10); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "expression", &_3, 504, &_11$$10); zephir_check_call_status(); zephir_array_fetch_string(&_12$$10, &assignment, SL("variable"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1181); - ZEPHIR_CALL_METHOD(&target, this_ptr, "expression", &_3, 499, &_12$$10); + ZEPHIR_CALL_METHOD(&target, this_ptr, "expression", &_3, 504, &_12$$10); zephir_check_call_status(); zephir_array_fetch_string(&_13$$10, &assignment, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1187); do { @@ -2162,13 +2162,13 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSwitch) object_init_ex(&_0$$3, phalcon_mvc_view_engine_volt_exception_ce); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "Corrupt statement"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 500, &_1$$3, &statement); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 505, &_1$$3, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$3, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1253); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 499, &expr); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "expression", NULL, 504, &expr); zephir_check_call_status(); ZEPHIR_INIT_VAR(&compilation); ZEPHIR_CONCAT_SVS(&compilation, ""); @@ -2179,14 +2179,14 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSwitch) } else { ZVAL_BOOL(&_3$$4, 0); } - ZEPHIR_CALL_METHOD(&lines, this_ptr, "statementlist", NULL, 501, &caseClauses, &_3$$4); + ZEPHIR_CALL_METHOD(&lines, this_ptr, "statementlist", NULL, 506, &caseClauses, &_3$$4); zephir_check_call_status(); if (zephir_fast_strlen_ev(&lines) != 0) { ZEPHIR_INIT_VAR(&_4$$5); ZVAL_STRING(&_4$$5, "/(*ANYCRLF)^\\h+|\\h+$|(\\h){2,}/mu"); ZEPHIR_INIT_VAR(&_5$$5); ZVAL_STRING(&_5$$5, ""); - ZEPHIR_CALL_FUNCTION(&_6$$5, "preg_replace", NULL, 37, &_4$$5, &_5$$5, &lines); + ZEPHIR_CALL_FUNCTION(&_6$$5, "preg_replace", NULL, 40, &_4$$5, &_5$$5, &lines); zephir_check_call_status(); ZEPHIR_CPY_WRT(&lines, &_6$$5); } @@ -2292,7 +2292,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) zephir_array_fast_append(&_1$$4, &expr); ZEPHIR_INIT_NVAR(&_2$$4); ZVAL_STRING(&_2$$4, "resolveExpression"); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_3, 503, &_2$$4, &_1$$4); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "fireextensionevent", &_3, 508, &_2$$4, &_1$$4); zephir_check_call_status(); if (Z_TYPE_P(&exprCode) == IS_STRING) { break; @@ -2314,7 +2314,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_7$$7, 0); } - ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_8, 499, &_6$$7, &_7$$7); + ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_8, 504, &_6$$7, &_7$$7); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&name); if (zephir_array_isset_string_fetch(&name, &singleExpr, SL("name"), 0)) { @@ -2342,7 +2342,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_11$$10, 0); } - ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_8, 499, &_10$$10, &_11$$10); + ZEPHIR_CALL_METHOD(&singleExprCode, this_ptr, "expression", &_8, 504, &_10$$10, &_11$$10); zephir_check_call_status(); ZEPHIR_OBS_NVAR(&name); if (zephir_array_isset_string_fetch(&name, &singleExpr, SL("name"), 0)) { @@ -2373,7 +2373,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_14$$14, 0); } - ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_8, 499, &left, &_14$$14); + ZEPHIR_CALL_METHOD(&leftCode, this_ptr, "expression", &_8, 504, &left, &_14$$14); zephir_check_call_status(); } if (ZEPHIR_IS_LONG(&type, 311)) { @@ -2384,7 +2384,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } if (ZEPHIR_IS_LONG(&type, 124)) { zephir_array_fetch_string(&_17$$16, &expr, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1390); - ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_18, 504, &_17$$16, &leftCode); + ZEPHIR_CALL_METHOD(&exprCode, this_ptr, "resolvefilter", &_18, 509, &_17$$16, &leftCode); zephir_check_call_status(); break; } @@ -2395,7 +2395,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_19$$17, 0); } - ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_8, 499, &right, &_19$$17); + ZEPHIR_CALL_METHOD(&rightCode, this_ptr, "expression", &_8, 504, &right, &_19$$17); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(&exprCode); @@ -2586,7 +2586,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_28$$54, 0); } - ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_8, 499, &start, &_28$$54); + ZEPHIR_CALL_METHOD(&startCode, this_ptr, "expression", &_8, 504, &start, &_28$$54); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&startCode); @@ -2599,7 +2599,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_29$$56, 0); } - ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_8, 499, &end, &_29$$56); + ZEPHIR_CALL_METHOD(&endCode, this_ptr, "expression", &_8, 504, &end, &_29$$56); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&endCode); @@ -2696,7 +2696,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) } else { ZVAL_BOOL(&_32$$74, 0); } - ZEPHIR_CALL_METHOD(&_30$$74, this_ptr, "expression", &_8, 499, &_31$$74, &_32$$74); + ZEPHIR_CALL_METHOD(&_30$$74, this_ptr, "expression", &_8, 504, &_31$$74, &_32$$74); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&exprCode); ZEPHIR_CONCAT_SVSVSVS(&exprCode, "(", &_30$$74, " ? ", &leftCode, " : ", &rightCode, ")"); @@ -2723,7 +2723,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, expression) zephir_array_fetch_string(&_35$$78, &expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1646); ZEPHIR_INIT_NVAR(&_36$$78); ZEPHIR_CONCAT_SVSVSV(&_36$$78, "Unknown expression ", &type, " in ", &_34$$78, " on line ", &_35$$78); - ZEPHIR_CALL_METHOD(NULL, &_33$$78, "__construct", &_37, 500, &_36$$78); + ZEPHIR_CALL_METHOD(NULL, &_33$$78, "__construct", &_37, 505, &_36$$78); zephir_check_call_status(); zephir_throw_exception_debug(&_33$$78, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1646); ZEPHIR_MM_RESTORE(); @@ -2960,7 +2960,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) } else { ZVAL_BOOL(&_0$$3, 0); } - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 499, &funcArguments, &_0$$3); + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 504, &funcArguments, &_0$$3); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&arguments); @@ -2979,7 +2979,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) zephir_array_fast_append(&_2$$6, &funcArguments); ZEPHIR_INIT_VAR(&_3$$6); ZVAL_STRING(&_3$$6, "compileFunction"); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 503, &_3$$6, &_2$$6); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 508, &_3$$6, &_2$$6); zephir_check_call_status(); if (Z_TYPE_P(&code) == IS_STRING) { RETURN_CCTOR(&code); @@ -3011,7 +3011,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) zephir_array_fetch_string(&_7$$9, &expr, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1782); ZEPHIR_INIT_VAR(&_8$$9); ZEPHIR_CONCAT_SVSVSV(&_8$$9, "Invalid definition for user function '", &name, "' in ", &_6$$9, " on line ", &_7$$9); - ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", NULL, 500, &_8$$9); + ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", NULL, 505, &_8$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$9, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 1782); ZEPHIR_MM_RESTORE(); @@ -3040,7 +3040,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) zephir_read_property(&_12$$17, this_ptr, ZEND_STRL("exprLevel"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&exprLevel, &_12$$17); if (Z_TYPE_P(&block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&code, this_ptr, "statementlistorextends", NULL, 505, &block); + ZEPHIR_CALL_METHOD(&code, this_ptr, "statementlistorextends", NULL, 510, &block); zephir_check_call_status(); if (ZEPHIR_IS_LONG(&exprLevel, 1)) { ZEPHIR_CPY_WRT(&escapedCode, &code); @@ -3071,7 +3071,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) } ZEPHIR_INIT_VAR(&_13$$5); zephir_camelize(&_13$$5, &name, NULL ); - ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 73, &_13$$5); + ZEPHIR_CALL_FUNCTION(&method, "lcfirst", NULL, 76, &_13$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&arrayHelpers); zephir_create_array(&arrayHelpers, 16, 0); @@ -3125,7 +3125,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) ZEPHIR_OBS_NVAR(&funcArguments); if (zephir_array_isset_string_fetch(&funcArguments, &expr, SL("arguments"), 0)) { ZVAL_BOOL(&_22$$30, 1); - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 499, &funcArguments, &_22$$30); + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 504, &funcArguments, &_22$$30); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&arguments); @@ -3176,7 +3176,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall) } else { ZVAL_BOOL(&_24, 0); } - ZEPHIR_CALL_METHOD(&_23, this_ptr, "expression", NULL, 499, &nameExpr, &_24); + ZEPHIR_CALL_METHOD(&_23, this_ptr, "expression", NULL, 504, &nameExpr, &_24); zephir_check_call_status(); ZEPHIR_CONCAT_VSVS(return_value, &_23, "(", &arguments, ")"); RETURN_MM(); @@ -3515,21 +3515,21 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) do { if (ZEPHIR_IS_STRING(&name, "divisibleby")) { zephir_array_fetch_string(&_1$$12, &test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2144); - ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", NULL, 499, &_1$$12); + ZEPHIR_CALL_METHOD(&_0$$12, this_ptr, "expression", NULL, 504, &_1$$12); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "(((", &left, ") % (", &_0$$12, ")) == 0)"); RETURN_MM(); } if (ZEPHIR_IS_STRING(&name, "sameas")) { zephir_array_fetch_string(&_3$$13, &test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2146); - ZEPHIR_CALL_METHOD(&_2$$13, this_ptr, "expression", NULL, 499, &_3$$13); + ZEPHIR_CALL_METHOD(&_2$$13, this_ptr, "expression", NULL, 504, &_3$$13); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "(", &left, ") === (", &_2$$13, ")"); RETURN_MM(); } if (ZEPHIR_IS_STRING(&name, "type")) { zephir_array_fetch_string(&_5$$14, &test, SL("arguments"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2148); - ZEPHIR_CALL_METHOD(&_4$$14, this_ptr, "expression", NULL, 499, &_5$$14); + ZEPHIR_CALL_METHOD(&_4$$14, this_ptr, "expression", NULL, 504, &_5$$14); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(return_value, "gettype(", &left, ") === (", &_4$$14, ")"); RETURN_MM(); @@ -3538,7 +3538,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest) } } - ZEPHIR_CALL_METHOD(&_6, this_ptr, "expression", NULL, 499, &test); + ZEPHIR_CALL_METHOD(&_6, this_ptr, "expression", NULL, 504, &test); zephir_check_call_status(); ZEPHIR_CONCAT_VSV(return_value, &left, " == ", &_6); RETURN_MM(); @@ -3757,7 +3757,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSource) } else { ZVAL_BOOL(&_0, 0); } - ZEPHIR_CALL_METHOD(&compilation, this_ptr, "statementlist", NULL, 501, &intermediate, &_0); + ZEPHIR_CALL_METHOD(&compilation, this_ptr, "statementlist", NULL, 506, &intermediate, &_0); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("extended"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&extended, &_1); @@ -3793,11 +3793,11 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSource) ZEPHIR_INIT_NVAR(&localBlock); array_init(&localBlock); } - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 501, &localBlock); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 506, &localBlock); zephir_check_call_status(); } else { if (Z_TYPE_P(&block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 501, &block); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 506, &block); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&blockCompilation, &block); @@ -3838,11 +3838,11 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSource) ZEPHIR_INIT_NVAR(&localBlock); array_init(&localBlock); } - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 501, &localBlock); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 506, &localBlock); zephir_check_call_status(); } else { if (Z_TYPE_P(&block) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 501, &block); + ZEPHIR_CALL_METHOD(&blockCompilation, this_ptr, "statementlist", NULL, 506, &block); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&blockCompilation, &block); @@ -4036,7 +4036,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) zephir_array_fetch_string(&_2$$5, &filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2368); ZEPHIR_INIT_VAR(&_3$$5); ZEPHIR_CONCAT_SVSV(&_3$$5, "Unknown filter type in ", &_1$$5, " on line ", &_2$$5); - ZEPHIR_CALL_METHOD(NULL, &_0$$5, "__construct", NULL, 500, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_0$$5, "__construct", NULL, 505, &_3$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$5, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2368); ZEPHIR_MM_RESTORE(); @@ -4070,11 +4070,11 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) zephir_array_update_string(&_4$$7, SL("file"), &file, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_4$$7, SL("line"), &line, PH_COPY | PH_SEPARATE); ZEPHIR_MAKE_REF(&funcArguments); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 266, &funcArguments, &_4$$7); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 269, &funcArguments, &_4$$7); ZEPHIR_UNREF(&funcArguments); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 499, &funcArguments); + ZEPHIR_CALL_METHOD(&arguments, this_ptr, "expression", NULL, 504, &funcArguments); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&arguments, &left); @@ -4089,7 +4089,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) zephir_array_fast_append(&_7$$9, &funcArguments); ZEPHIR_INIT_VAR(&_8$$9); ZVAL_STRING(&_8$$9, "compileFilter"); - ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 503, &_8$$9, &_7$$9); + ZEPHIR_CALL_METHOD(&code, this_ptr, "fireextensionevent", NULL, 508, &_8$$9, &_7$$9); zephir_check_call_status(); if (Z_TYPE_P(&code) == IS_STRING) { RETURN_CCTOR(&code); @@ -4120,7 +4120,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) zephir_array_fetch_string(&_12$$11, &filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2462); ZEPHIR_INIT_VAR(&_13$$11); ZEPHIR_CONCAT_SVSVSV(&_13$$11, "Invalid definition for user filter '", &name, "' in ", &_11$$11, " on line ", &_12$$11); - ZEPHIR_CALL_METHOD(NULL, &_10$$11, "__construct", NULL, 500, &_13$$11); + ZEPHIR_CALL_METHOD(NULL, &_10$$11, "__construct", NULL, 505, &_13$$11); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$11, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2462); ZEPHIR_MM_RESTORE(); @@ -4245,7 +4245,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter) zephir_array_fetch_string(&_22, &filter, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2529); ZEPHIR_INIT_VAR(&_23); ZEPHIR_CONCAT_SVSVSV(&_23, "Unknown filter \"", &name, "\" in ", &_21, " on line ", &_22); - ZEPHIR_CALL_METHOD(NULL, &_20, "__construct", NULL, 500, &_23); + ZEPHIR_CALL_METHOD(NULL, &_20, "__construct", NULL, 505, &_23); zephir_check_call_status(); zephir_throw_exception_debug(&_20, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2529); ZEPHIR_MM_RESTORE(); @@ -4416,7 +4416,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fetch_string(&_6$$7, &statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2577); ZEPHIR_INIT_NVAR(&_7$$7); ZEPHIR_CONCAT_SVSV(&_7$$7, "Invalid statement in ", &_5$$7, " on line ", &_6$$7); - ZEPHIR_CALL_METHOD(NULL, &_4$$7, "__construct", &_8, 500, &_7$$7, &statement); + ZEPHIR_CALL_METHOD(NULL, &_4$$7, "__construct", &_8, 505, &_7$$7, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$7, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2579); ZEPHIR_MM_RESTORE(); @@ -4428,7 +4428,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fast_append(&_9$$8, &statement); ZEPHIR_INIT_NVAR(&_10$$8); ZVAL_STRING(&_10$$8, "compileStatement"); - ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 503, &_10$$8, &_9$$8); + ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 508, &_10$$8, &_9$$8); zephir_check_call_status(); if (Z_TYPE_P(&tempCompilation) == IS_STRING) { zephir_concat_self(&compilation, &tempCompilation); @@ -4533,7 +4533,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) } else { ZVAL_BOOL(&_34$$24, 0); } - ZEPHIR_CALL_METHOD(&_33$$24, this_ptr, "statementlist", &_35, 501, &blockStatements, &_34$$24); + ZEPHIR_CALL_METHOD(&_33$$24, this_ptr, "statementlist", &_35, 506, &blockStatements, &_34$$24); zephir_check_call_status(); zephir_concat_self(&compilation, &_33$$24); } @@ -4643,7 +4643,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fetch_string(&_58$$37, &statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2807); ZEPHIR_INIT_NVAR(&_59$$37); ZEPHIR_CONCAT_SVSVSV(&_59$$37, "Unknown statement ", &type, " in ", &_57$$37, " on line ", &_58$$37); - ZEPHIR_CALL_METHOD(NULL, &_56$$37, "__construct", &_8, 500, &_59$$37); + ZEPHIR_CALL_METHOD(NULL, &_56$$37, "__construct", &_8, 505, &_59$$37); zephir_check_call_status(); zephir_throw_exception_debug(&_56$$37, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2807); ZEPHIR_MM_RESTORE(); @@ -4673,7 +4673,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fetch_string(&_62$$40, &statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2577); ZEPHIR_INIT_NVAR(&_63$$40); ZEPHIR_CONCAT_SVSV(&_63$$40, "Invalid statement in ", &_61$$40, " on line ", &_62$$40); - ZEPHIR_CALL_METHOD(NULL, &_60$$40, "__construct", &_8, 500, &_63$$40, &statement); + ZEPHIR_CALL_METHOD(NULL, &_60$$40, "__construct", &_8, 505, &_63$$40, &statement); zephir_check_call_status(); zephir_throw_exception_debug(&_60$$40, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2579); ZEPHIR_MM_RESTORE(); @@ -4685,7 +4685,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fast_append(&_64$$41, &statement); ZEPHIR_INIT_NVAR(&_65$$41); ZVAL_STRING(&_65$$41, "compileStatement"); - ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 503, &_65$$41, &_64$$41); + ZEPHIR_CALL_METHOD(&tempCompilation, this_ptr, "fireextensionevent", &_11, 508, &_65$$41, &_64$$41); zephir_check_call_status(); if (Z_TYPE_P(&tempCompilation) == IS_STRING) { zephir_concat_self(&compilation, &tempCompilation); @@ -4790,7 +4790,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) } else { ZVAL_BOOL(&_81$$57, 0); } - ZEPHIR_CALL_METHOD(&_80$$57, this_ptr, "statementlist", &_35, 501, &blockStatements, &_81$$57); + ZEPHIR_CALL_METHOD(&_80$$57, this_ptr, "statementlist", &_35, 506, &blockStatements, &_81$$57); zephir_check_call_status(); zephir_concat_self(&compilation, &_80$$57); } @@ -4900,7 +4900,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementList) zephir_array_fetch_string(&_96$$70, &statement, SL("line"), PH_NOISY | PH_READONLY, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2807); ZEPHIR_INIT_NVAR(&_97$$70); ZEPHIR_CONCAT_SVSVSV(&_97$$70, "Unknown statement ", &type, " in ", &_95$$70, " on line ", &_96$$70); - ZEPHIR_CALL_METHOD(NULL, &_94$$70, "__construct", &_8, 500, &_97$$70); + ZEPHIR_CALL_METHOD(NULL, &_94$$70, "__construct", &_8, 505, &_97$$70); zephir_check_call_status(); zephir_throw_exception_debug(&_94$$70, "phalcon/Mvc/View/Engine/Volt/Compiler.zep", 2807); ZEPHIR_MM_RESTORE(); @@ -4993,7 +4993,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, statementListOrExtends) ZEPHIR_INIT_NVAR(&statement); } if (isStatementList) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "statementlist", NULL, 501, statements); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "statementlist", NULL, 506, statements); zephir_check_call_status(); RETURN_MM(); } @@ -5043,7 +5043,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, isTagFactory) _0$$6 = Z_TYPE_P(&_1$$6) == IS_ARRAY; } if (_0$$6) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "istagfactory", NULL, 502, &left); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "istagfactory", NULL, 507, &left); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/mvc/view/simple.zep.c b/ext/phalcon/mvc/view/simple.zep.c index 66b678a1172..477af5d9695 100644 --- a/ext/phalcon/mvc/view/simple.zep.c +++ b/ext/phalcon/mvc/view/simple.zep.c @@ -418,7 +418,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, partial) } - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 384); + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 389); zephir_check_call_status(); if (Z_TYPE_P(params) == IS_ARRAY) { zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); @@ -431,12 +431,12 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, partial) } else { ZEPHIR_CPY_WRT(&mergedParams, params); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "internalrender", NULL, 506, &partialPath, &mergedParams); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "internalrender", NULL, 511, &partialPath, &mergedParams); zephir_check_call_status(); if (Z_TYPE_P(params) == IS_ARRAY) { zephir_update_property_zval(this_ptr, ZEND_STRL("viewParams"), &viewParams); } - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 485); + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 490); zephir_check_call_status(); zephir_read_property(&_2, this_ptr, ZEND_STRL("content"), PH_NOISY_CC | PH_READONLY); zend_print_zval(&_2, 0); @@ -535,15 +535,15 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, render) ZEPHIR_INIT_VAR(&_0); ZEPHIR_CREATE_SYMBOL_TABLE(); - ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 384); + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 389); zephir_check_call_status(); zephir_read_property(&_1, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&viewParams, &_1); ZEPHIR_INIT_VAR(&mergedParams); zephir_fast_array_merge(&mergedParams, &viewParams, ¶ms); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "internalrender", NULL, 506, &path, &mergedParams); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "internalrender", NULL, 511, &path, &mergedParams); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 485); + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 490); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); } @@ -795,7 +795,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, setViewsDir) } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdirseparator", NULL, 507, &viewsDir); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdirseparator", NULL, 0, &viewsDir); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("viewsDir"), &_0); ZEPHIR_MM_RESTORE(); @@ -854,7 +854,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, loadTemplateEngines) if (ZEPHIR_IS_EMPTY(®isteredEngines)) { ZEPHIR_INIT_VAR(&_2$$4); object_init_ex(&_2$$4, phalcon_mvc_view_engine_php_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 488, this_ptr, &di); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 493, this_ptr, &di); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_2$$4, PH_COPY | PH_SEPARATE); } else { @@ -880,7 +880,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, loadTemplateEngines) ZEPHIR_CALL_CE_STATIC(&_7$$9, _8$$9, "bind", &_9, 0, &engineService, &di); zephir_check_call_status(); ZEPHIR_CPY_WRT(&engineService, &_7$$9); - ZEPHIR_CALL_FUNCTION(&engineObject, "call_user_func", &_10, 184, &engineService, this_ptr); + ZEPHIR_CALL_FUNCTION(&engineObject, "call_user_func", &_10, 187, &engineService, this_ptr); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&engineObject, &engineService); @@ -896,7 +896,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, loadTemplateEngines) object_init_ex(&_12$$12, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_NVAR(&_13$$12); ZEPHIR_CONCAT_SV(&_13$$12, "Invalid template engine registration for extension: ", &extension); - ZEPHIR_CALL_METHOD(NULL, &_12$$12, "__construct", &_14, 29, &_13$$12); + ZEPHIR_CALL_METHOD(NULL, &_12$$12, "__construct", &_14, 32, &_13$$12); zephir_check_call_status(); zephir_throw_exception_debug(&_12$$12, "phalcon/Mvc/View/Simple.zep", 485); ZEPHIR_MM_RESTORE(); @@ -923,7 +923,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, loadTemplateEngines) ZEPHIR_CALL_CE_STATIC(&_15$$15, _16$$15, "bind", &_9, 0, &engineService, &di); zephir_check_call_status(); ZEPHIR_CPY_WRT(&engineService, &_15$$15); - ZEPHIR_CALL_FUNCTION(&engineObject, "call_user_func", &_10, 184, &engineService, this_ptr); + ZEPHIR_CALL_FUNCTION(&engineObject, "call_user_func", &_10, 187, &engineService, this_ptr); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(&engineObject, &engineService); @@ -939,7 +939,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, loadTemplateEngines) object_init_ex(&_18$$18, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_NVAR(&_19$$18); ZEPHIR_CONCAT_SV(&_19$$18, "Invalid template engine registration for extension: ", &extension); - ZEPHIR_CALL_METHOD(NULL, &_18$$18, "__construct", &_14, 29, &_19$$18); + ZEPHIR_CALL_METHOD(NULL, &_18$$18, "__construct", &_14, 32, &_19$$18); zephir_check_call_status(); zephir_throw_exception_debug(&_18$$18, "phalcon/Mvc/View/Simple.zep", 485); ZEPHIR_MM_RESTORE(); @@ -1178,7 +1178,7 @@ PHP_METHOD(Phalcon_Mvc_View_Simple, internalRender) object_init_ex(&_30$$20, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_VAR(&_31$$20); ZEPHIR_CONCAT_SVS(&_31$$20, "View '", &viewsDirPath, "' was not found in the views directory"); - ZEPHIR_CALL_METHOD(NULL, &_30$$20, "__construct", NULL, 29, &_31$$20); + ZEPHIR_CALL_METHOD(NULL, &_30$$20, "__construct", NULL, 32, &_31$$20); zephir_check_call_status(); zephir_throw_exception_debug(&_30$$20, "phalcon/Mvc/View/Simple.zep", 584); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/paginator/adapter/model.zep.c b/ext/phalcon/paginator/adapter/model.zep.c index 1e9e85aa410..fe42a4619c7 100644 --- a/ext/phalcon/paginator/adapter/model.zep.c +++ b/ext/phalcon/paginator/adapter/model.zep.c @@ -166,7 +166,7 @@ PHP_METHOD(Phalcon_Paginator_Adapter_Model, paginate) ZEPHIR_INIT_VAR(&_6); ZVAL_STRING(&_6, "count"); zephir_array_fast_append(&_5, &_6); - ZEPHIR_CALL_FUNCTION(&rowCountResult, "call_user_func", NULL, 184, &_5, ¶meters); + ZEPHIR_CALL_FUNCTION(&rowCountResult, "call_user_func", NULL, 187, &_5, ¶meters); zephir_check_call_status(); if (Z_TYPE_P(&rowCountResult) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_7$$6, &rowCountResult, "count", NULL, 0); @@ -193,7 +193,7 @@ PHP_METHOD(Phalcon_Paginator_Adapter_Model, paginate) ZEPHIR_INIT_VAR(&_11$$10); ZVAL_STRING(&_11$$10, "find"); zephir_array_fast_append(&_10$$10, &_11$$10); - ZEPHIR_CALL_FUNCTION(&_12$$10, "call_user_func", NULL, 184, &_10$$10, ¶meters); + ZEPHIR_CALL_FUNCTION(&_12$$10, "call_user_func", NULL, 187, &_10$$10, ¶meters); zephir_check_call_status(); ZEPHIR_CPY_WRT(&pageItems, &_12$$10); } diff --git a/ext/phalcon/paginator/adapter/nativearray.zep.c b/ext/phalcon/paginator/adapter/nativearray.zep.c index e010644292e..b9133bcc5f9 100644 --- a/ext/phalcon/paginator/adapter/nativearray.zep.c +++ b/ext/phalcon/paginator/adapter/nativearray.zep.c @@ -113,7 +113,7 @@ PHP_METHOD(Phalcon_Paginator_Adapter_NativeArray, paginate) } ZVAL_LONG(&_0, (show * ((pageNumber - 1)))); ZVAL_LONG(&_4, show); - ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 497, &items, &_0, &_4); + ZEPHIR_CALL_FUNCTION(&_5, "array_slice", NULL, 502, &items, &_0, &_4); zephir_check_call_status(); ZEPHIR_CPY_WRT(&items, &_5); if (pageNumber < totalPages) { diff --git a/ext/phalcon/paginator/adapter/querybuilder.zep.c b/ext/phalcon/paginator/adapter/querybuilder.zep.c index 7259d47c2a8..0b16eae5f2a 100644 --- a/ext/phalcon/paginator/adapter/querybuilder.zep.c +++ b/ext/phalcon/paginator/adapter/querybuilder.zep.c @@ -123,7 +123,7 @@ PHP_METHOD(Phalcon_Paginator_Adapter_QueryBuilder, __construct) object_init_ex(&_0$$5, phalcon_paginator_exception_ce); ZEPHIR_INIT_VAR(&_1$$5); ZEPHIR_CONCAT_SS(&_1$$5, "Parameter 'builder' must be an instance ", "of Phalcon\\Mvc\\Model\\Query\\Builder"); - ZEPHIR_CALL_METHOD(NULL, &_0$$5, "__construct", NULL, 29, &_1$$5); + ZEPHIR_CALL_METHOD(NULL, &_0$$5, "__construct", NULL, 32, &_1$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_0$$5, "phalcon/Paginator/Adapter/QueryBuilder.zep", 80); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/session/adapter/stream.zep.c b/ext/phalcon/session/adapter/stream.zep.c index 1674498fb36..0bb972878af 100644 --- a/ext/phalcon/session/adapter/stream.zep.c +++ b/ext/phalcon/session/adapter/stream.zep.c @@ -133,13 +133,13 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, __construct) object_init_ex(&_4$$4, phalcon_session_exception_ce); ZEPHIR_INIT_VAR(&_5$$4); ZEPHIR_CONCAT_SVS(&_5$$4, "The session save path [", &path, "] is not writable"); - ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 29, &_5$$4); + ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 32, &_5$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$4, "phalcon/Session/Adapter/Stream.zep", 71); ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_METHOD(&_6, this_ptr, "getdirseparator", NULL, 508, &path); + ZEPHIR_CALL_METHOD(&_6, this_ptr, "getdirseparator", NULL, 0, &path); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("path"), &_6); ZEPHIR_MM_RESTORE(); @@ -177,12 +177,12 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, destroy) ZEPHIR_CONCAT_VV(&file, &_0, &_1); _2 = (zephir_file_exists(&file) == SUCCESS); if (_2) { - ZEPHIR_CALL_FUNCTION(&_3, "is_file", NULL, 509, &file); + ZEPHIR_CALL_FUNCTION(&_3, "is_file", NULL, 0, &file); zephir_check_call_status(); _2 = zephir_is_true(&_3); } if (_2) { - ZEPHIR_CALL_FUNCTION(NULL, "unlink", NULL, 119, &file); + ZEPHIR_CALL_FUNCTION(NULL, "unlink", NULL, 122, &file); zephir_check_call_status(); } RETURN_MM_BOOL(1); @@ -236,7 +236,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, gc) zephir_time(&_2); ZEPHIR_INIT_VAR(&time); ZVAL_LONG(&time, (zephir_get_numberval(&_2) - maxlifetime)); - ZEPHIR_CALL_FUNCTION(&_3, "glob", NULL, 510, &pattern); + ZEPHIR_CALL_FUNCTION(&_3, "glob", NULL, 0, &pattern); zephir_check_call_status(); zephir_is_iterable(&_3, 0, "phalcon/Session/Adapter/Stream.zep", 111); if (Z_TYPE_P(&_3) == IS_ARRAY) { @@ -246,7 +246,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, gc) ZVAL_COPY(&file, _4); _6$$3 = 1 == (zephir_file_exists(&file) == SUCCESS); if (_6$$3) { - ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 509, &file); + ZEPHIR_CALL_FUNCTION(&_7$$3, "is_file", &_8, 0, &file); zephir_check_call_status(); _6$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_7$$3); } @@ -257,7 +257,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, gc) _9$$3 = ZEPHIR_LT(&_10$$3, &time); } if (_9$$3) { - ZEPHIR_CALL_FUNCTION(NULL, "unlink", &_11, 119, &file); + ZEPHIR_CALL_FUNCTION(NULL, "unlink", &_11, 122, &file); zephir_check_call_status(); } } ZEND_HASH_FOREACH_END(); @@ -274,7 +274,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, gc) zephir_check_call_status(); _12$$5 = 1 == (zephir_file_exists(&file) == SUCCESS); if (_12$$5) { - ZEPHIR_CALL_FUNCTION(&_13$$5, "is_file", &_8, 509, &file); + ZEPHIR_CALL_FUNCTION(&_13$$5, "is_file", &_8, 0, &file); zephir_check_call_status(); _12$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_13$$5); } @@ -285,7 +285,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, gc) _14$$5 = ZEPHIR_LT(&_15$$5, &time); } if (_14$$5) { - ZEPHIR_CALL_FUNCTION(NULL, "unlink", &_11, 119, &file); + ZEPHIR_CALL_FUNCTION(NULL, "unlink", &_11, 122, &file); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); @@ -370,7 +370,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, read) ZEPHIR_CALL_METHOD(&pointer, this_ptr, "phpfopen", NULL, 0, &name, &_3$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, 1); - ZEPHIR_CALL_FUNCTION(&_5$$3, "flock", NULL, 128, &pointer, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "flock", NULL, 131, &pointer, &_4$$3); zephir_check_call_status(); if (zephir_is_true(&_5$$3)) { ZEPHIR_CALL_METHOD(&data, this_ptr, "phpfilegetcontents", NULL, 0, &name); @@ -640,7 +640,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, phpFilePutContents) ZVAL_LONG(&_0, flags); - ZEPHIR_RETURN_CALL_FUNCTION("file_put_contents", NULL, 135, &filename, data, &_0, context); + ZEPHIR_RETURN_CALL_FUNCTION("file_put_contents", NULL, 138, &filename, data, &_0, context); zephir_check_call_status(); RETURN_MM(); } @@ -678,7 +678,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, phpFopen) zephir_get_strval(&mode, mode_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); + ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 139, &filename, &mode); zephir_check_call_status(); RETURN_MM(); } @@ -715,7 +715,7 @@ PHP_METHOD(Phalcon_Session_Adapter_Stream, phpIniGet) zephir_get_strval(&varname, varname_param); - ZEPHIR_RETURN_CALL_FUNCTION("ini_get", NULL, 511, &varname); + ZEPHIR_RETURN_CALL_FUNCTION("ini_get", NULL, 0, &varname); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/session/manager.zep.c b/ext/phalcon/session/manager.zep.c index a8521d592f6..75ad39f6f18 100644 --- a/ext/phalcon/session/manager.zep.c +++ b/ext/phalcon/session/manager.zep.c @@ -646,7 +646,7 @@ PHP_METHOD(Phalcon_Session_Manager, setId) object_init_ex(&_1$$3, phalcon_session_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SS(&_2$$3, "The session has already been started. ", "To change the id, use regenerateId()"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Session/Manager.zep", 271); ZEPHIR_MM_RESTORE(); @@ -853,7 +853,7 @@ PHP_METHOD(Phalcon_Session_Manager, phpHeadersSent) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_FUNCTION("headers_sent", NULL, 356); + ZEPHIR_RETURN_CALL_FUNCTION("headers_sent", NULL, 361); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/storage/adapter/apcu.zep.c b/ext/phalcon/storage/adapter/apcu.zep.c index b41ad327db0..9e52523808a 100644 --- a/ext/phalcon/storage/adapter/apcu.zep.c +++ b/ext/phalcon/storage/adapter/apcu.zep.c @@ -658,7 +658,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuDec) ZVAL_LONG(&_0, step); ZVAL_LONG(&_1, ttl); ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_dec", NULL, 99, key, &_0, success, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_dec", NULL, 102, key, &_0, success, &_1); ZEPHIR_UNREF(success); zephir_check_call_status(); RETURN_MM(); @@ -684,7 +684,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuDelete) zephir_fetch_params(1, 1, 0, &key); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_delete", NULL, 100, key); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_delete", NULL, 103, key); zephir_check_call_status(); RETURN_MM(); } @@ -709,7 +709,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuExists) zephir_fetch_params(1, 1, 0, &key); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_exists", NULL, 101, key); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_exists", NULL, 104, key); zephir_check_call_status(); RETURN_MM(); } @@ -759,7 +759,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuInc) ZVAL_LONG(&_0, step); ZVAL_LONG(&_1, ttl); ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_inc", NULL, 102, key, &_0, success, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_inc", NULL, 105, key, &_0, success, &_1); ZEPHIR_UNREF(success); zephir_check_call_status(); RETURN_MM(); @@ -794,7 +794,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuFetch) ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 103, key, success); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 106, key, success); ZEPHIR_UNREF(success); zephir_check_call_status(); RETURN_MM(); @@ -859,7 +859,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuStore) ZVAL_LONG(&_0, ttl); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 104, key, payload, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 107, key, payload, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/storage/adapter/libmemcached.zep.c b/ext/phalcon/storage/adapter/libmemcached.zep.c index 6ad4c7ddff0..3dc54ea4b24 100644 --- a/ext/phalcon/storage/adapter/libmemcached.zep.c +++ b/ext/phalcon/storage/adapter/libmemcached.zep.c @@ -331,14 +331,14 @@ PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, getAdapter) ZEPHIR_INIT_NVAR(&_7$$4); zephir_fast_array_merge(&_7$$4, &failover, &client); ZEPHIR_CPY_WRT(&client, &_7$$4); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "setoptions", NULL, 105, &connection, &client); + ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "setoptions", NULL, 108, &connection, &client); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10$$4, &_9$$4, "setservers", NULL, 106, &connection, &servers); + ZEPHIR_CALL_METHOD(&_10$$4, &_9$$4, "setservers", NULL, 109, &connection, &servers); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_10$$4, "setsasl", NULL, 107, &connection, &saslUser, &saslPass); + ZEPHIR_CALL_METHOD(NULL, &_10$$4, "setsasl", NULL, 110, &connection, &saslUser, &saslPass); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 108, &connection); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 111, &connection); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), &connection); } diff --git a/ext/phalcon/storage/adapter/redis.zep.c b/ext/phalcon/storage/adapter/redis.zep.c index 05b7f084656..4aef833e277 100644 --- a/ext/phalcon/storage/adapter/redis.zep.c +++ b/ext/phalcon/storage/adapter/redis.zep.c @@ -352,17 +352,17 @@ PHP_METHOD(Phalcon_Storage_Adapter_Redis, getAdapter) object_init_ex(&connection, zephir_get_internal_ce(SL("redis"))); ZEPHIR_CALL_METHOD(NULL, &connection, "__construct", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkconnect", NULL, 109, &connection); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkconnect", NULL, 112, &connection); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2$$3, &_1$$3, "checkauth", NULL, 110, &connection); + ZEPHIR_CALL_METHOD(&_2$$3, &_1$$3, "checkauth", NULL, 113, &connection); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "checkindex", NULL, 111, &connection); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "checkindex", NULL, 114, &connection); zephir_check_call_status(); zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_4$$3, 2); ZEPHIR_CALL_METHOD(NULL, &connection, "setoption", NULL, 0, &_4$$3, &_3$$3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 112, &connection); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 115, &connection); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), &connection); } @@ -822,9 +822,9 @@ PHP_METHOD(Phalcon_Storage_Adapter_Redis, checkConnect) object_init_ex(&_4$$5, phalcon_storage_exception_ce); ZEPHIR_INIT_VAR(&_5$$5); ZVAL_STRING(&_5$$5, "Could not connect to the Redisd server [%s:%s]"); - ZEPHIR_CALL_FUNCTION(&_6$$5, "sprintf", NULL, 113, &_5$$5, &host, &port); + ZEPHIR_CALL_FUNCTION(&_6$$5, "sprintf", NULL, 116, &_5$$5, &host, &port); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_4$$5, "__construct", NULL, 29, &_6$$5); + ZEPHIR_CALL_METHOD(NULL, &_4$$5, "__construct", NULL, 32, &_6$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$5, "phalcon/Storage/Adapter/Redis.zep", 303); ZEPHIR_MM_RESTORE(); @@ -928,34 +928,34 @@ PHP_METHOD(Phalcon_Storage_Adapter_Redis, setSerializer) add_assoc_long_ex(&map, SL("redis_php"), 1); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "\\Redis::SERIALIZER_IGBINARY"); - ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 114, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 117, &_0); zephir_check_call_status(); if (zephir_is_true(&_1)) { ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "\\Redis::SERIALIZER_IGBINARY"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "constant", NULL, 115, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "constant", NULL, 118, &_2$$3); zephir_check_call_status(); zephir_array_update_string(&map, SL("redis_igbinary"), &_3$$3, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "\\Redis::SERIALIZER_MSGPACK"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 114, &_0); + ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 117, &_0); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_VAR(&_5$$4); ZVAL_STRING(&_5$$4, "\\Redis::SERIALIZER_MSGPACK"); - ZEPHIR_CALL_FUNCTION(&_6$$4, "constant", NULL, 115, &_5$$4); + ZEPHIR_CALL_FUNCTION(&_6$$4, "constant", NULL, 118, &_5$$4); zephir_check_call_status(); zephir_array_update_string(&map, SL("redis_msgpack"), &_6$$4, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "\\Redis::SERIALIZER_JSON"); - ZEPHIR_CALL_FUNCTION(&_7, "defined", NULL, 114, &_0); + ZEPHIR_CALL_FUNCTION(&_7, "defined", NULL, 117, &_0); zephir_check_call_status(); if (zephir_is_true(&_7)) { ZEPHIR_INIT_VAR(&_8$$5); ZVAL_STRING(&_8$$5, "\\Redis::SERIALIZER_JSON"); - ZEPHIR_CALL_FUNCTION(&_9$$5, "constant", NULL, 115, &_8$$5); + ZEPHIR_CALL_FUNCTION(&_9$$5, "constant", NULL, 118, &_8$$5); zephir_check_call_status(); zephir_array_update_string(&map, SL("redis_json"), &_9$$5, PH_COPY | PH_SEPARATE); } diff --git a/ext/phalcon/storage/adapter/stream.zep.c b/ext/phalcon/storage/adapter/stream.zep.c index d18a9ce061b..cde18a12970 100644 --- a/ext/phalcon/storage/adapter/stream.zep.c +++ b/ext/phalcon/storage/adapter/stream.zep.c @@ -114,7 +114,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, __construct) ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "The 'storageDir' must be specified in the options", "phalcon/Storage/Adapter/Stream.zep", 60); return; } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getdirseparator", NULL, 116, &storageDir); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getdirseparator", NULL, 119, &storageDir); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("storageDir"), &_2); ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_stream_ce, getThis(), "__construct", &_3, 0, factory, &options); @@ -153,9 +153,9 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, clear) result = 1; zephir_read_property(&_0, this_ptr, ZEND_STRL("storageDir"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdirseparator", NULL, 116, &_0); + ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdirseparator", NULL, 119, &_0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 117, &directory); + ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 120, &directory); zephir_check_call_status(); zephir_is_iterable(&iterator, 0, "phalcon/Storage/Adapter/Stream.zep", 91); if (Z_TYPE_P(&iterator) == IS_ARRAY) { @@ -319,9 +319,9 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, delete) if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); + ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 121, &key); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 119, &filepath); + ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 122, &filepath); zephir_check_call_status(); RETURN_MM(); } @@ -378,17 +378,17 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, get) } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); + ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 121, &key); zephir_check_call_status(); if (1 != (zephir_file_exists(&filepath) == SUCCESS)) { RETVAL_ZVAL(defaultValue, 1, 0); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 120, &filepath); + ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 123, &filepath); zephir_check_call_status(); _0 = ZEPHIR_IS_EMPTY(&payload); if (!(_0)) { - ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 121, &payload); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 124, &payload); zephir_check_call_status(); _0 = zephir_is_true(&_1); } @@ -465,7 +465,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getKeys) ZEPHIR_INIT_VAR(&files); array_init(&files); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 122); + ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 125); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpfileexists", NULL, 0, &directory); zephir_check_call_status(); @@ -473,7 +473,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getKeys) array_init(return_value); RETURN_MM(); } - ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 117, &directory); + ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 120, &directory); zephir_check_call_status(); zephir_is_iterable(&iterator, 0, "phalcon/Storage/Adapter/Stream.zep", 197); if (Z_TYPE_P(&iterator) == IS_ARRAY) { @@ -564,19 +564,19 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, has) } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); + ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 121, &key); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpfileexists", NULL, 0, &filepath); zephir_check_call_status(); if (UNEXPECTED(!ZEPHIR_IS_TRUE_IDENTICAL(&_0))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 120, &filepath); + ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 123, &filepath); zephir_check_call_status(); if (UNEXPECTED(ZEPHIR_IS_EMPTY(&payload))) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 121, &payload); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 124, &payload); zephir_check_call_status(); RETURN_MM_BOOL(!zephir_is_true(&_1)); } @@ -725,7 +725,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, set) ZEPHIR_CALL_METHOD(&_2, this_ptr, "getserializeddata", NULL, 0, value); zephir_check_call_status(); zephir_array_update_string(&payload, SL("content"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 123, &payload, &key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 126, &payload, &key); zephir_check_call_status(); RETURN_MM(); } @@ -784,7 +784,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, setForever) ZEPHIR_CALL_METHOD(&_1, this_ptr, "getserializeddata", NULL, 0, value); zephir_check_call_status(); zephir_array_update_string(&payload, SL("content"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 123, &payload, &key); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 126, &payload, &key); zephir_check_call_status(); RETURN_MM(); } @@ -843,15 +843,15 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDir) zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_VV(&_2, &_0, &_1); - ZEPHIR_CALL_METHOD(&dirPrefix, this_ptr, "getdirseparator", NULL, 116, &_2); + ZEPHIR_CALL_METHOD(&dirPrefix, this_ptr, "getdirseparator", NULL, 119, &_2); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getkeywithoutprefix", NULL, 124, &key); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getkeywithoutprefix", NULL, 127, &key); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&dirFromFile, this_ptr, "getdirfromfile", NULL, 125, &_3); + ZEPHIR_CALL_METHOD(&dirFromFile, this_ptr, "getdirfromfile", NULL, 128, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZEPHIR_CONCAT_VV(&_4, &dirPrefix, &dirFromFile); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getdirseparator", NULL, 116, &_4); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getdirseparator", NULL, 119, &_4); zephir_check_call_status(); RETURN_MM(); } @@ -887,9 +887,9 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getFilepath) zephir_get_strval(&key, key_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdir", NULL, 122, &key); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdir", NULL, 125, &key); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkeywithoutprefix", NULL, 124, &key); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkeywithoutprefix", NULL, 127, &key); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, &_0, &_1); RETURN_MM(); @@ -980,10 +980,10 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getIterator) ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, spl_ce_RecursiveDirectoryIterator); ZVAL_LONG(&_1, 4096); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 126, &dir, &_1); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 129, &dir, &_1); zephir_check_call_status(); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 127, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 130, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -1044,7 +1044,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getPayload) RETURN_MM(); } ZVAL_LONG(&_1, 1); - ZEPHIR_CALL_FUNCTION(&_2, "flock", NULL, 128, &pointer, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "flock", NULL, 131, &pointer, &_1); zephir_check_call_status(); if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&_2))) { ZEPHIR_CALL_METHOD(&payload, this_ptr, "phpfilegetcontents", NULL, 0, &filepath); @@ -1055,34 +1055,34 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getPayload) array_init(return_value); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); + ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 132); zephir_check_call_status(); ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "8.0"); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, ">="); - ZEPHIR_CALL_FUNCTION(&_4, "version_compare", NULL, 130, &version, &_0, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "version_compare", NULL, 133, &version, &_0, &_3); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_VAR(&_5$$6); ZEPHIR_INIT_NVAR(&_5$$6); zephir_create_closure_ex(&_5$$6, NULL, phalcon_1__closure_ce, SL("__invoke")); ZVAL_LONG(&_6$$6, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_5$$6, &_6$$6); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_5$$6, &_6$$6); zephir_check_call_status(); } else { ZEPHIR_INIT_VAR(&_7$$7); ZEPHIR_INIT_NVAR(&_7$$7); zephir_create_closure_ex(&_7$$7, NULL, phalcon_2__closure_ce, SL("__invoke")); ZVAL_LONG(&_8$$7, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_7$$7, &_8$$7); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_7$$7, &_8$$7); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_9, "unserialize", NULL, 16, &payload); zephir_check_call_status(); ZEPHIR_CPY_WRT(&payload, &_9); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 135); zephir_check_call_status(); _10 = ZEPHIR_GLOBAL(warning).enable; if (!(_10)) { @@ -1197,13 +1197,13 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, storePayload) ZEPHIR_CALL_FUNCTION(&_0, "serialize", NULL, 15, &payload); zephir_check_call_status(); ZEPHIR_CPY_WRT(&payload, &_0); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 122, &key); + ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 125, &key); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "is_dir", NULL, 133, &directory); + ZEPHIR_CALL_FUNCTION(&_0, "is_dir", NULL, 136, &directory); zephir_check_call_status(); if (!(zephir_is_true(&_0))) { ZVAL_LONG(&_1$$3, 0777); - ZEPHIR_CALL_FUNCTION(NULL, "mkdir", NULL, 134, &directory, &_1$$3, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "mkdir", NULL, 137, &directory, &_1$$3, &__$true); zephir_check_call_status(); } ZEPHIR_INIT_VAR(&_3); @@ -1306,7 +1306,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFilePutContents) ZVAL_LONG(&_0, flags); - ZEPHIR_RETURN_CALL_FUNCTION("file_put_contents", NULL, 135, &filename, data, &_0, context); + ZEPHIR_RETURN_CALL_FUNCTION("file_put_contents", NULL, 138, &filename, data, &_0, context); zephir_check_call_status(); RETURN_MM(); } @@ -1336,7 +1336,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFopen) zephir_get_strval(&mode, mode_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); + ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 139, &filename, &mode); zephir_check_call_status(); RETURN_MM(); } @@ -1363,7 +1363,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpUnlink) zephir_get_strval(&filename, filename_param); - ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 119, &filename); + ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 122, &filename); zephir_check_call_status(); RETURN_MM(); } @@ -1411,7 +1411,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDirFromFile) ZVAL_LONG(&_0, 8); - ZEPHIR_CALL_FUNCTION(&name, "pathinfo", NULL, 85, &file, &_0); + ZEPHIR_CALL_FUNCTION(&name, "pathinfo", NULL, 88, &file, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, -2); @@ -1434,7 +1434,7 @@ PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDirFromFile) } ZEPHIR_INIT_VAR(&_7); ZVAL_LONG(&_8, 2); - ZEPHIR_CALL_FUNCTION(&_9, "str_split", NULL, 84, &start, &_8); + ZEPHIR_CALL_FUNCTION(&_9, "str_split", NULL, 87, &start, &_8); zephir_check_call_status(); zephir_fast_join_str(&_7, SL("/"), &_9); ZEPHIR_CONCAT_VS(return_value, &_7, "/"); diff --git a/ext/phalcon/storage/serializer/base64.zep.c b/ext/phalcon/storage/serializer/base64.zep.c index 29f7dd14322..fe2d85693ce 100644 --- a/ext/phalcon/storage/serializer/base64.zep.c +++ b/ext/phalcon/storage/serializer/base64.zep.c @@ -60,7 +60,7 @@ PHP_METHOD(Phalcon_Storage_Serializer_Base64, serialize) return; } zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 227, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 230, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -166,7 +166,7 @@ PHP_METHOD(Phalcon_Storage_Serializer_Base64, phpBase64Decode) ZVAL_BOOL(&_0, (strict ? 1 : 0)); - ZEPHIR_RETURN_CALL_FUNCTION("base64_decode", NULL, 226, &input, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("base64_decode", NULL, 229, &input, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/storage/serializer/igbinary.zep.c b/ext/phalcon/storage/serializer/igbinary.zep.c index 69ed1d67a63..6e530fc3b31 100644 --- a/ext/phalcon/storage/serializer/igbinary.zep.c +++ b/ext/phalcon/storage/serializer/igbinary.zep.c @@ -128,33 +128,33 @@ PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, unserialize) if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); } else { - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); + ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 132); zephir_check_call_status(); ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "8.0"); ZEPHIR_INIT_VAR(&_2$$4); ZVAL_STRING(&_2$$4, ">="); - ZEPHIR_CALL_FUNCTION(&_3$$4, "version_compare", NULL, 130, &version, &_1$$4, &_2$$4); + ZEPHIR_CALL_FUNCTION(&_3$$4, "version_compare", NULL, 133, &version, &_1$$4, &_2$$4); zephir_check_call_status(); if (zephir_is_true(&_3$$4)) { ZEPHIR_INIT_VAR(&_4$$5); ZEPHIR_INIT_NVAR(&_4$$5); zephir_create_closure_ex(&_4$$5, NULL, phalcon_3__closure_ce, SL("__invoke")); ZVAL_LONG(&_5$$5, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_4$$5, &_5$$5); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_4$$5, &_5$$5); zephir_check_call_status(); } else { ZEPHIR_INIT_VAR(&_6$$6); ZEPHIR_INIT_NVAR(&_6$$6); zephir_create_closure_ex(&_6$$6, NULL, phalcon_4__closure_ce, SL("__invoke")); ZVAL_LONG(&_7$$6, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_6$$6, &_7$$6); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_6$$6, &_7$$6); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&result, this_ptr, "dounserialize", NULL, 0, data); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 135); zephir_check_call_status(); _8$$4 = ZEPHIR_GLOBAL(warning).enable; if (!(_8$$4)) { @@ -207,7 +207,7 @@ PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, phpIgbinarySerialize) zephir_fetch_params(1, 1, 0, &value); - ZEPHIR_RETURN_CALL_FUNCTION("igbinary_serialize", NULL, 137, value); + ZEPHIR_RETURN_CALL_FUNCTION("igbinary_serialize", NULL, 140, value); zephir_check_call_status(); RETURN_MM(); } @@ -271,7 +271,7 @@ PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, doUnserialize) zephir_fetch_params(1, 1, 0, &value); - ZEPHIR_RETURN_CALL_FUNCTION("igbinary_unserialize", NULL, 138, value); + ZEPHIR_RETURN_CALL_FUNCTION("igbinary_unserialize", NULL, 141, value); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/storage/serializer/json.zep.c b/ext/phalcon/storage/serializer/json.zep.c index ea54e24e989..18da4b9e578 100644 --- a/ext/phalcon/storage/serializer/json.zep.c +++ b/ext/phalcon/storage/serializer/json.zep.c @@ -138,7 +138,7 @@ PHP_METHOD(Phalcon_Storage_Serializer_Json, serialize) object_init_ex(&_3$$3, spl_ce_InvalidArgumentException); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SS(&_4$$3, "Data for the JSON serializer cannot be of type 'object' ", "without implementing 'JsonSerializable'"); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 196, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 199, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$3, "phalcon/Storage/Serializer/Json.zep", 54); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/storage/serializer/php.zep.c b/ext/phalcon/storage/serializer/php.zep.c index 180df33a07f..65b7d83c071 100644 --- a/ext/phalcon/storage/serializer/php.zep.c +++ b/ext/phalcon/storage/serializer/php.zep.c @@ -109,33 +109,33 @@ PHP_METHOD(Phalcon_Storage_Serializer_Php, unserialize) zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); + ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 132); zephir_check_call_status(); ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "8.0"); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, ">="); - ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 130, &version, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 133, &version, &_1, &_2); zephir_check_call_status(); if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_4$$4); ZEPHIR_INIT_NVAR(&_4$$4); zephir_create_closure_ex(&_4$$4, NULL, phalcon_11__closure_ce, SL("__invoke")); ZVAL_LONG(&_5$$4, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_4$$4, &_5$$4); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_4$$4, &_5$$4); zephir_check_call_status(); } else { ZEPHIR_INIT_VAR(&_6$$5); ZEPHIR_INIT_NVAR(&_6$$5); zephir_create_closure_ex(&_6$$5, NULL, phalcon_12__closure_ce, SL("__invoke")); ZVAL_LONG(&_7$$5, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_6$$5, &_7$$5); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_6$$5, &_7$$5); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&result, this_ptr, "phpunserialize", NULL, 0, data); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 135); zephir_check_call_status(); _8 = ZEPHIR_GLOBAL(warning).enable; if (!(_8)) { diff --git a/ext/phalcon/support/debug.zep.c b/ext/phalcon/support/debug.zep.c index 992a971afd1..e2ded4b6243 100644 --- a/ext/phalcon/support/debug.zep.c +++ b/ext/phalcon/support/debug.zep.c @@ -362,7 +362,7 @@ PHP_METHOD(Phalcon_Support_Debug, listenLowSeverity) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "onUncaughtLowSeverity"); zephir_array_fast_append(&_0, &_1); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_2); zephir_create_array(&_2, 2, 0); @@ -407,7 +407,7 @@ PHP_METHOD(Phalcon_Support_Debug, onUncaughtException) ZEPHIR_CALL_FUNCTION(&obLevel, "ob_get_level", NULL, 0); zephir_check_call_status(); if (ZEPHIR_GT_LONG(&obLevel, 0)) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 485); + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 490); zephir_check_call_status(); } zephir_read_static_property_ce(&_0, phalcon_support_debug_ce, SL("isActive"), PH_NOISY_CC | PH_READONLY); @@ -1582,7 +1582,7 @@ PHP_METHOD(Phalcon_Support_Debug, showTraceItem) } else { ZEPHIR_INIT_VAR(&classReflection); object_init_ex(&classReflection, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &classReflection, "__construct", NULL, 150, &className); + ZEPHIR_CALL_METHOD(NULL, &classReflection, "__construct", NULL, 153, &className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_11$$5, &classReflection, "isinternal", NULL, 0); zephir_check_call_status(); @@ -1615,7 +1615,7 @@ PHP_METHOD(Phalcon_Support_Debug, showTraceItem) if ((zephir_function_exists(&functionName) == SUCCESS)) { ZEPHIR_INIT_VAR(&functionReflection); object_init_ex(&functionReflection, zephir_get_internal_ce(SL("reflectionfunction"))); - ZEPHIR_CALL_METHOD(NULL, &functionReflection, "__construct", NULL, 147, &functionName); + ZEPHIR_CALL_METHOD(NULL, &functionReflection, "__construct", NULL, 150, &functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_17$$10, &functionReflection, "isinternal", NULL, 0); zephir_check_call_status(); diff --git a/ext/phalcon/support/debug/dump.zep.c b/ext/phalcon/support/debug/dump.zep.c index 961270d22ff..e0bb664477c 100644 --- a/ext/phalcon/support/debug/dump.zep.c +++ b/ext/phalcon/support/debug/dump.zep.c @@ -900,7 +900,7 @@ PHP_METHOD(Phalcon_Support_Debug_Dump, output) ZEPHIR_CONCAT_VS(&_45$$11, &_44$$11, "[skipped]\n"); zephir_concat_self(&output, &_45$$11); } else if (_42$$9) { - ZEPHIR_CALL_FUNCTION(&_46$$12, "get_object_vars", NULL, 423, variable); + ZEPHIR_CALL_FUNCTION(&_46$$12, "get_object_vars", NULL, 428, variable); zephir_check_call_status(); zephir_is_iterable(&_46$$12, 0, "phalcon/Support/Debug/Dump.zep", 280); if (Z_TYPE_P(&_46$$12) == IS_ARRAY) { @@ -991,10 +991,10 @@ PHP_METHOD(Phalcon_Support_Debug_Dump, output) } else { ZEPHIR_INIT_VAR(&reflect$$15); object_init_ex(&reflect$$15, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &reflect$$15, "__construct", NULL, 150, variable); + ZEPHIR_CALL_METHOD(NULL, &reflect$$15, "__construct", NULL, 153, variable); zephir_check_call_status(); ZVAL_LONG(&_67$$15, ((1 | 2) | 4)); - ZEPHIR_CALL_METHOD(&props$$15, &reflect$$15, "getproperties", NULL, 161, &_67$$15); + ZEPHIR_CALL_METHOD(&props$$15, &reflect$$15, "getproperties", NULL, 164, &_67$$15); zephir_check_call_status(); zephir_is_iterable(&props$$15, 0, "phalcon/Support/Debug/Dump.zep", 306); if (Z_TYPE_P(&props$$15) == IS_ARRAY) { @@ -1272,7 +1272,7 @@ PHP_METHOD(Phalcon_Support_Debug_Dump, output) ZEPHIR_CONCAT_VV(return_value, &output, &_145$$26); RETURN_MM(); } - ZEPHIR_CALL_FUNCTION(&_147, "is_float", NULL, 210, variable); + ZEPHIR_CALL_FUNCTION(&_147, "is_float", NULL, 213, variable); zephir_check_call_status(); if (zephir_is_true(&_147)) { ZEPHIR_INIT_VAR(&_148$$27); diff --git a/ext/phalcon/support/helper/arr/blacklist.zep.c b/ext/phalcon/support/helper/arr/blacklist.zep.c index 8ed8bdba088..7475874ade5 100644 --- a/ext/phalcon/support/helper/arr/blacklist.zep.c +++ b/ext/phalcon/support/helper/arr/blacklist.zep.c @@ -76,9 +76,9 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_Blacklist, __invoke) zephir_create_closure_ex(&_0, NULL, phalcon_13__closure_ce, SL("__invoke")); ZEPHIR_CALL_METHOD(&blackListed, this_ptr, "tofilter", NULL, 0, &blackList, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "array_flip", NULL, 96, &blackListed); + ZEPHIR_CALL_FUNCTION(&_1, "array_flip", NULL, 99, &blackListed); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_diff_key", NULL, 95, &collection, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("array_diff_key", NULL, 98, &collection, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/support/helper/arr/first.zep.c b/ext/phalcon/support/helper/arr/first.zep.c index 057b4acdd51..873b5108310 100644 --- a/ext/phalcon/support/helper/arr/first.zep.c +++ b/ext/phalcon/support/helper/arr/first.zep.c @@ -77,7 +77,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_First, __invoke) ZEPHIR_CALL_METHOD(&filtered, this_ptr, "tofilter", NULL, 0, &collection, method); zephir_check_call_status(); ZEPHIR_MAKE_REF(&filtered); - ZEPHIR_RETURN_CALL_FUNCTION("reset", NULL, 473, &filtered); + ZEPHIR_RETURN_CALL_FUNCTION("reset", NULL, 478, &filtered); ZEPHIR_UNREF(&filtered); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/phalcon/support/helper/arr/group.zep.c b/ext/phalcon/support/helper/arr/group.zep.c index 91b68380035..c5e5c847fde 100644 --- a/ext/phalcon/support/helper/arr/group.zep.c +++ b/ext/phalcon/support/helper/arr/group.zep.c @@ -193,7 +193,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_Group, processCallable) ZEPHIR_CALL_METHOD(&_0, this_ptr, "iscallable", NULL, 0, method); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_CALL_FUNCTION(&key, "call_user_func", NULL, 184, method, element); + ZEPHIR_CALL_FUNCTION(&key, "call_user_func", NULL, 187, method, element); zephir_check_call_status(); zephir_array_update_multi(&output, element, SL("za"), 2, &key); } diff --git a/ext/phalcon/support/helper/arr/isunique.zep.c b/ext/phalcon/support/helper/arr/isunique.zep.c index 2ecd22335e7..419064083cb 100644 --- a/ext/phalcon/support/helper/arr/isunique.zep.c +++ b/ext/phalcon/support/helper/arr/isunique.zep.c @@ -65,7 +65,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_IsUnique, __invoke) zephir_get_arrval(&collection, collection_param); - ZEPHIR_CALL_FUNCTION(&_0, "array_unique", NULL, 176, &collection); + ZEPHIR_CALL_FUNCTION(&_0, "array_unique", NULL, 179, &collection); zephir_check_call_status(); RETURN_MM_BOOL(zephir_fast_count_int(&collection) == zephir_fast_count_int(&_0)); } diff --git a/ext/phalcon/support/helper/arr/last.zep.c b/ext/phalcon/support/helper/arr/last.zep.c index 196ed067c49..4cd699b7435 100644 --- a/ext/phalcon/support/helper/arr/last.zep.c +++ b/ext/phalcon/support/helper/arr/last.zep.c @@ -77,7 +77,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_Last, __invoke) ZEPHIR_CALL_METHOD(&filtered, this_ptr, "tofilter", NULL, 0, &collection, method); zephir_check_call_status(); ZEPHIR_MAKE_REF(&filtered); - ZEPHIR_RETURN_CALL_FUNCTION("end", NULL, 319, &filtered); + ZEPHIR_RETURN_CALL_FUNCTION("end", NULL, 322, &filtered); ZEPHIR_UNREF(&filtered); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/phalcon/support/helper/arr/lastkey.zep.c b/ext/phalcon/support/helper/arr/lastkey.zep.c index 0ad0ed21e05..beb426f3d07 100644 --- a/ext/phalcon/support/helper/arr/lastkey.zep.c +++ b/ext/phalcon/support/helper/arr/lastkey.zep.c @@ -76,7 +76,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_LastKey, __invoke) ZEPHIR_CALL_METHOD(&filtered, this_ptr, "tofilter", NULL, 0, &collection, method); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_key_last", NULL, 36, &filtered); + ZEPHIR_RETURN_CALL_FUNCTION("array_key_last", NULL, 39, &filtered); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/support/helper/arr/sliceleft.zep.c b/ext/phalcon/support/helper/arr/sliceleft.zep.c index 5fc04761006..5f5fc99b78b 100644 --- a/ext/phalcon/support/helper/arr/sliceleft.zep.c +++ b/ext/phalcon/support/helper/arr/sliceleft.zep.c @@ -75,7 +75,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_SliceLeft, __invoke) ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, elements); - ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 497, &collection, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 502, &collection, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/support/helper/arr/sliceright.zep.c b/ext/phalcon/support/helper/arr/sliceright.zep.c index 1da6d02fde0..817a09a8b75 100644 --- a/ext/phalcon/support/helper/arr/sliceright.zep.c +++ b/ext/phalcon/support/helper/arr/sliceright.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_SliceRight, __invoke) ZVAL_LONG(&_0, elements); - ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 497, &collection, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 502, &collection, &_0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/support/helper/arr/whitelist.zep.c b/ext/phalcon/support/helper/arr/whitelist.zep.c index e5502962b03..2060a656657 100644 --- a/ext/phalcon/support/helper/arr/whitelist.zep.c +++ b/ext/phalcon/support/helper/arr/whitelist.zep.c @@ -76,7 +76,7 @@ PHP_METHOD(Phalcon_Support_Helper_Arr_Whitelist, __invoke) zephir_create_closure_ex(&_0, NULL, phalcon_14__closure_ce, SL("__invoke")); ZEPHIR_CALL_METHOD(&filtered, this_ptr, "tofilter", NULL, 0, &whiteList, &_0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_1, "array_flip", NULL, 96, &filtered); + ZEPHIR_CALL_FUNCTION(&_1, "array_flip", NULL, 99, &filtered); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("array_intersect_key", NULL, 2, &collection, &_1); zephir_check_call_status(); diff --git a/ext/phalcon/support/helper/file/basename.zep.c b/ext/phalcon/support/helper/file/basename.zep.c index 6e0092fbb8f..6df986c5dd3 100644 --- a/ext/phalcon/support/helper/file/basename.zep.c +++ b/ext/phalcon/support/helper/file/basename.zep.c @@ -100,7 +100,7 @@ PHP_METHOD(Phalcon_Support_Helper_File_Basename, __invoke) ZVAL_STRING(&_2, "/"); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "@"); - ZEPHIR_CALL_FUNCTION(&_4, "preg_quote", NULL, 355, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "preg_quote", NULL, 353, &_2, &_3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_5); ZEPHIR_CONCAT_SVS(&_5, "@[^", &_4, "]+$@"); @@ -116,13 +116,13 @@ PHP_METHOD(Phalcon_Support_Helper_File_Basename, __invoke) if (1 != ZEPHIR_IS_EMPTY(&suffix)) { ZEPHIR_INIT_VAR(&_6$$3); ZVAL_STRING(&_6$$3, "@"); - ZEPHIR_CALL_FUNCTION(&_7$$3, "preg_quote", NULL, 355, &suffix, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "preg_quote", NULL, 353, &suffix, &_6$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_8$$3); ZEPHIR_CONCAT_SVS(&_8$$3, "@", &_7$$3, "$@"); ZEPHIR_INIT_NVAR(&_6$$3); ZVAL_STRING(&_6$$3, ""); - ZEPHIR_CALL_FUNCTION(&_9$$3, "preg_replace", NULL, 37, &_8$$3, &_6$$3, &fileName); + ZEPHIR_CALL_FUNCTION(&_9$$3, "preg_replace", NULL, 40, &_8$$3, &_6$$3, &fileName); zephir_check_call_status(); ZEPHIR_CPY_WRT(&fileName, &_9$$3); } diff --git a/ext/phalcon/support/helper/json/decode.zep.c b/ext/phalcon/support/helper/json/decode.zep.c index f242c71092a..0c5cfca155a 100644 --- a/ext/phalcon/support/helper/json/decode.zep.c +++ b/ext/phalcon/support/helper/json/decode.zep.c @@ -127,7 +127,7 @@ PHP_METHOD(Phalcon_Support_Helper_Json_Decode, __invoke) zephir_json_encode(&_3$$3, &__$null, 0 ); ZEPHIR_INIT_VAR(&_4$$3); object_init_ex(&_4$$3, spl_ce_InvalidArgumentException); - ZEPHIR_CALL_METHOD(NULL, &_4$$3, "__construct", NULL, 196, &message, &error); + ZEPHIR_CALL_METHOD(NULL, &_4$$3, "__construct", NULL, 199, &message, &error); zephir_check_call_status(); zephir_throw_exception_debug(&_4$$3, "phalcon/Support/Helper/Json/Decode.zep", 64); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/support/helper/json/encode.zep.c b/ext/phalcon/support/helper/json/encode.zep.c index 297954ef95b..8440ba72520 100644 --- a/ext/phalcon/support/helper/json/encode.zep.c +++ b/ext/phalcon/support/helper/json/encode.zep.c @@ -119,7 +119,7 @@ PHP_METHOD(Phalcon_Support_Helper_Json_Encode, __invoke) zephir_json_encode(&_2$$3, &__$null, 0 ); ZEPHIR_INIT_VAR(&_3$$3); object_init_ex(&_3$$3, spl_ce_InvalidArgumentException); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 196, &message, &error); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 199, &message, &error); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$3, "phalcon/Support/Helper/Json/Encode.zep", 64); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/support/helper/str/camelize.zep.c b/ext/phalcon/support/helper/str/camelize.zep.c index f0f356b250b..82547dcd19d 100644 --- a/ext/phalcon/support/helper/str/camelize.zep.c +++ b/ext/phalcon/support/helper/str/camelize.zep.c @@ -86,7 +86,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Camelize, __invoke) ZEPHIR_CALL_PARENT(&result, phalcon_support_helper_str_camelize_ce, getThis(), "__invoke", &_0, 0, &text, &delimiters); zephir_check_call_status(); if (lowerFirst == 1) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "lcfirst", NULL, 73, &result); + ZEPHIR_CALL_FUNCTION(&_1$$3, "lcfirst", NULL, 76, &result); zephir_check_call_status(); ZEPHIR_CPY_WRT(&result, &_1$$3); } diff --git a/ext/phalcon/support/helper/str/concat.zep.c b/ext/phalcon/support/helper/str/concat.zep.c index e0446898ab8..e41f42810ed 100644 --- a/ext/phalcon/support/helper/str/concat.zep.c +++ b/ext/phalcon/support/helper/str/concat.zep.c @@ -81,19 +81,19 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Concat, __invoke) return; } ZEPHIR_MAKE_REF(&arguments); - ZEPHIR_CALL_FUNCTION(&delimiter, "reset", NULL, 473, &arguments); + ZEPHIR_CALL_FUNCTION(&delimiter, "reset", NULL, 478, &arguments); ZEPHIR_UNREF(&arguments); zephir_check_call_status(); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(&_1, "array_slice", NULL, 497, &arguments, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "array_slice", NULL, 502, &arguments, &_0); zephir_check_call_status(); ZEPHIR_CPY_WRT(&arguments, &_1); ZEPHIR_MAKE_REF(&arguments); - ZEPHIR_CALL_FUNCTION(&first, "reset", NULL, 473, &arguments); + ZEPHIR_CALL_FUNCTION(&first, "reset", NULL, 478, &arguments); ZEPHIR_UNREF(&arguments); zephir_check_call_status(); ZEPHIR_MAKE_REF(&arguments); - ZEPHIR_CALL_FUNCTION(&last, "end", NULL, 319, &arguments); + ZEPHIR_CALL_FUNCTION(&last, "end", NULL, 322, &arguments); ZEPHIR_UNREF(&arguments); zephir_check_call_status(); ZEPHIR_INIT_VAR(&prefix); diff --git a/ext/phalcon/support/helper/str/decapitalize.zep.c b/ext/phalcon/support/helper/str/decapitalize.zep.c index 259e7f308f0..453dcd8db46 100644 --- a/ext/phalcon/support/helper/str/decapitalize.zep.c +++ b/ext/phalcon/support/helper/str/decapitalize.zep.c @@ -91,7 +91,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Decapitalize, __invoke) ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(&substr, "mb_substr", NULL, 224, &text, &_0); + ZEPHIR_CALL_FUNCTION(&substr, "mb_substr", NULL, 227, &text, &_0); zephir_check_call_status(); if (upperRest) { ZEPHIR_CALL_METHOD(&suffix, this_ptr, "toupper", NULL, 0, &substr, &encoding); @@ -101,7 +101,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Decapitalize, __invoke) } ZVAL_LONG(&_0, 0); ZVAL_LONG(&_2, 1); - ZEPHIR_CALL_FUNCTION(&_3, "mb_substr", NULL, 224, &text, &_0, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "mb_substr", NULL, 227, &text, &_0, &_2); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "tolower", NULL, 0, &_3, &encoding); zephir_check_call_status(); diff --git a/ext/phalcon/support/helper/str/dirfromfile.zep.c b/ext/phalcon/support/helper/str/dirfromfile.zep.c index 4efae797bc8..19f4c7bee7f 100644 --- a/ext/phalcon/support/helper/str/dirfromfile.zep.c +++ b/ext/phalcon/support/helper/str/dirfromfile.zep.c @@ -75,16 +75,16 @@ PHP_METHOD(Phalcon_Support_Helper_Str_DirFromFile, __invoke) ZVAL_LONG(&_0, 8); - ZEPHIR_CALL_FUNCTION(&name, "pathinfo", NULL, 85, &file, &_0); + ZEPHIR_CALL_FUNCTION(&name, "pathinfo", NULL, 88, &file, &_0); zephir_check_call_status(); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, -2); - ZEPHIR_CALL_FUNCTION(&start, "mb_substr", NULL, 224, &name, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&start, "mb_substr", NULL, 227, &name, &_0, &_1); zephir_check_call_status(); if (!zephir_is_true(&start)) { ZVAL_LONG(&_2$$3, 0); ZVAL_LONG(&_3$$3, 1); - ZEPHIR_CALL_FUNCTION(&start, "mb_substr", NULL, 224, &name, &_2$$3, &_3$$3); + ZEPHIR_CALL_FUNCTION(&start, "mb_substr", NULL, 227, &name, &_2$$3, &_3$$3); zephir_check_call_status(); } ZEPHIR_INIT_VAR(&_4); diff --git a/ext/phalcon/support/helper/str/dynamic.zep.c b/ext/phalcon/support/helper/str/dynamic.zep.c index 09807982a05..34f5daeeb69 100644 --- a/ext/phalcon/support/helper/str/dynamic.zep.c +++ b/ext/phalcon/support/helper/str/dynamic.zep.c @@ -142,9 +142,9 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Dynamic, __invoke) ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", NULL, 355, &leftDelimiter); + ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", NULL, 353, &leftDelimiter); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", NULL, 355, &rightDelimiter); + ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", NULL, 353, &rightDelimiter); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_4); ZEPHIR_CONCAT_SVSVVSVS(&_4, "/", &ldS, "([^", &ldS, &rdS, "]+)", &rdS, "/"); @@ -174,16 +174,16 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Dynamic, __invoke) ZEPHIR_INIT_NVAR(&words); zephir_fast_explode(&words, &separator, &_9$$6, LONG_MAX); ZEPHIR_OBS_NVAR(&word); - ZEPHIR_CALL_FUNCTION(&_10$$6, "array_rand", &_11, 198, &words); + ZEPHIR_CALL_FUNCTION(&_10$$6, "array_rand", &_11, 201, &words); zephir_check_call_status(); zephir_array_fetch(&word, &words, &_10$$6, PH_NOISY, "phalcon/Support/Helper/Str/Dynamic.zep", 62); zephir_array_fetch_long(&_12$$6, &match, 0, PH_NOISY | PH_READONLY, "phalcon/Support/Helper/Str/Dynamic.zep", 63); - ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", NULL, 355, &_12$$6, &separator); + ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", NULL, 353, &_12$$6, &separator); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_13$$6); ZEPHIR_CONCAT_SVS(&_13$$6, "/", &sub, "/"); ZVAL_LONG(&_14$$6, 1); - ZEPHIR_CALL_FUNCTION(&_15$$6, "preg_replace", &_16, 37, &_13$$6, &word, &text, &_14$$6); + ZEPHIR_CALL_FUNCTION(&_15$$6, "preg_replace", &_16, 40, &_13$$6, &word, &text, &_14$$6); zephir_check_call_status(); zephir_get_strval(&text, &_15$$6); } ZEND_HASH_FOREACH_END(); @@ -209,16 +209,16 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Dynamic, __invoke) ZEPHIR_INIT_NVAR(&words); zephir_fast_explode(&words, &separator, &_18$$8, LONG_MAX); ZEPHIR_OBS_NVAR(&word); - ZEPHIR_CALL_FUNCTION(&_19$$8, "array_rand", &_11, 198, &words); + ZEPHIR_CALL_FUNCTION(&_19$$8, "array_rand", &_11, 201, &words); zephir_check_call_status(); zephir_array_fetch(&word, &words, &_19$$8, PH_NOISY, "phalcon/Support/Helper/Str/Dynamic.zep", 62); zephir_array_fetch_long(&_20$$8, &match, 0, PH_NOISY | PH_READONLY, "phalcon/Support/Helper/Str/Dynamic.zep", 63); - ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", NULL, 355, &_20$$8, &separator); + ZEPHIR_CALL_FUNCTION(&sub, "preg_quote", NULL, 353, &_20$$8, &separator); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_21$$8); ZEPHIR_CONCAT_SVS(&_21$$8, "/", &sub, "/"); ZVAL_LONG(&_22$$8, 1); - ZEPHIR_CALL_FUNCTION(&_23$$8, "preg_replace", &_16, 37, &_21$$8, &word, &text, &_22$$8); + ZEPHIR_CALL_FUNCTION(&_23$$8, "preg_replace", &_16, 40, &_21$$8, &word, &text, &_22$$8); zephir_check_call_status(); zephir_get_strval(&text, &_23$$8); ZEPHIR_CALL_METHOD(NULL, &matches, "next", NULL, 0); diff --git a/ext/phalcon/support/helper/str/friendly.zep.c b/ext/phalcon/support/helper/str/friendly.zep.c index 458afb03618..66676f71679 100644 --- a/ext/phalcon/support/helper/str/friendly.zep.c +++ b/ext/phalcon/support/helper/str/friendly.zep.c @@ -145,7 +145,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Friendly, __invoke) ZVAL_STRING(&_4, "/[^a-zA-Z0-9\\/_|+ -]/"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ""); - ZEPHIR_CALL_FUNCTION(&friendly, "preg_replace", NULL, 37, &_4, &_5, &text); + ZEPHIR_CALL_FUNCTION(&friendly, "preg_replace", NULL, 40, &_4, &_5, &text); zephir_check_call_status(); if (lowercase) { ZEPHIR_INIT_VAR(&_6$$5); @@ -154,7 +154,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Friendly, __invoke) } ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "/[\\/_|+ -]+/"); - ZEPHIR_CALL_FUNCTION(&_7, "preg_replace", NULL, 37, &_4, &separator, &friendly); + ZEPHIR_CALL_FUNCTION(&_7, "preg_replace", NULL, 40, &_4, &separator, &friendly); zephir_check_call_status(); ZEPHIR_CPY_WRT(&friendly, &_7); zephir_fast_trim(return_value, &friendly, &separator, ZEPHIR_TRIM_BOTH); diff --git a/ext/phalcon/support/helper/str/humanize.zep.c b/ext/phalcon/support/helper/str/humanize.zep.c index e4c27b227ba..76db4429adc 100644 --- a/ext/phalcon/support/helper/str/humanize.zep.c +++ b/ext/phalcon/support/helper/str/humanize.zep.c @@ -74,7 +74,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Humanize, __invoke) ZVAL_STRING(&_1, "#[_-]+#"); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, " "); - ZEPHIR_CALL_FUNCTION(&result, "preg_replace", NULL, 37, &_1, &_2, &_0); + ZEPHIR_CALL_FUNCTION(&result, "preg_replace", NULL, 40, &_1, &_2, &_0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1); if (Z_TYPE_P(&result) == IS_NULL) { diff --git a/ext/phalcon/support/helper/str/includes.zep.c b/ext/phalcon/support/helper/str/includes.zep.c index eef80714d80..3ec2b06ec5c 100644 --- a/ext/phalcon/support/helper/str/includes.zep.c +++ b/ext/phalcon/support/helper/str/includes.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Includes, __invoke) zephir_get_strval(&needle, needle_param); - ZEPHIR_CALL_FUNCTION(&_0, "mb_strpos", NULL, 82, &haystack, &needle); + ZEPHIR_CALL_FUNCTION(&_0, "mb_strpos", NULL, 85, &haystack, &needle); zephir_check_call_status(); RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(&_0)); } diff --git a/ext/phalcon/support/helper/str/len.zep.c b/ext/phalcon/support/helper/str/len.zep.c index bab81913b85..3981a76e3c9 100644 --- a/ext/phalcon/support/helper/str/len.zep.c +++ b/ext/phalcon/support/helper/str/len.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Len, __invoke) } - ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 230, &text, &encoding); + ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 233, &text, &encoding); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/support/helper/str/pascalcase.zep.c b/ext/phalcon/support/helper/str/pascalcase.zep.c index 4830f35ba5d..098d3f0c7c9 100644 --- a/ext/phalcon/support/helper/str/pascalcase.zep.c +++ b/ext/phalcon/support/helper/str/pascalcase.zep.c @@ -83,7 +83,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_PascalCase, __invoke) ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, phalcon_0__closure_ce, SL("__invoke")); - ZEPHIR_CALL_FUNCTION(&output, "array_map", NULL, 66, &_0, &exploded); + ZEPHIR_CALL_FUNCTION(&output, "array_map", NULL, 69, &_0, &exploded); zephir_check_call_status(); zephir_fast_join_str(return_value, SL(""), &output); RETURN_MM(); @@ -185,7 +185,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_PascalCase, processArray) ZEPHIR_CONCAT_SVS(&_10, "/[", &delimiters, "]+/"); ZVAL_LONG(&_11, -1); ZVAL_LONG(&_12, (2 | 1)); - ZEPHIR_CALL_FUNCTION(&result, "preg_split", NULL, 67, &_10, &text, &_11, &_12); + ZEPHIR_CALL_FUNCTION(&result, "preg_split", NULL, 70, &_10, &text, &_11, &_12); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_13); if (ZEPHIR_IS_FALSE_IDENTICAL(&result)) { diff --git a/ext/phalcon/support/helper/str/random.zep.c b/ext/phalcon/support/helper/str/random.zep.c index cf284ec55f0..b0f974133b0 100644 --- a/ext/phalcon/support/helper/str/random.zep.c +++ b/ext/phalcon/support/helper/str/random.zep.c @@ -134,61 +134,61 @@ PHP_METHOD(Phalcon_Support_Helper_Str_Random, __invoke) ZVAL_STRING(&_3, "a"); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "z"); - ZEPHIR_CALL_FUNCTION(&_5, "range", NULL, 313, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&_5, "range", NULL, 316, &_3, &_4); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "A"); ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "Z"); - ZEPHIR_CALL_FUNCTION(&_6, "range", NULL, 313, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&_6, "range", NULL, 316, &_3, &_4); zephir_check_call_status(); zephir_fast_array_merge(&_2, &_5, &_6); zephir_array_update_long(&pools, 1, &_2, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZEPHIR_INIT_NVAR(&_2); ZVAL_LONG(&_7, 0); ZVAL_LONG(&_8, 9); - ZEPHIR_CALL_FUNCTION(&_9, "range", NULL, 313, &_7, &_8); + ZEPHIR_CALL_FUNCTION(&_9, "range", NULL, 316, &_7, &_8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "a"); ZEPHIR_INIT_NVAR(&_4); ZVAL_STRING(&_4, "f"); - ZEPHIR_CALL_FUNCTION(&_10, "range", NULL, 313, &_3, &_4); + ZEPHIR_CALL_FUNCTION(&_10, "range", NULL, 316, &_3, &_4); zephir_check_call_status(); zephir_fast_array_merge(&_2, &_9, &_10); zephir_array_update_long(&pools, 2, &_2, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZVAL_LONG(&_7, 0); ZVAL_LONG(&_8, 9); - ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 313, &_7, &_8); + ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 316, &_7, &_8); zephir_check_call_status(); zephir_array_update_long(&pools, 3, &_11, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZVAL_LONG(&_7, 1); ZVAL_LONG(&_8, 9); - ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 313, &_7, &_8); + ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 316, &_7, &_8); zephir_check_call_status(); zephir_array_update_long(&pools, 4, &_11, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "2345679ACDEFHJKLMNPRSTUVWXYZ"); - ZEPHIR_CALL_FUNCTION(&_11, "str_split", NULL, 84, &_2); + ZEPHIR_CALL_FUNCTION(&_11, "str_split", NULL, 87, &_2); zephir_check_call_status(); zephir_array_update_long(&pools, 5, &_11, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZVAL_LONG(&_7, 0); ZVAL_LONG(&_8, 9); - ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 313, &_7, &_8); + ZEPHIR_CALL_FUNCTION(&_11, "range", NULL, 316, &_7, &_8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "a"); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "z"); - ZEPHIR_CALL_FUNCTION(&_12, "range", NULL, 313, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_12, "range", NULL, 316, &_2, &_3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "A"); ZEPHIR_INIT_NVAR(&_3); ZVAL_STRING(&_3, "Z"); - ZEPHIR_CALL_FUNCTION(&_13, "range", NULL, 313, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_13, "range", NULL, 316, &_2, &_3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_14, "array_merge", NULL, 329, &_11, &_12, &_13); + ZEPHIR_CALL_FUNCTION(&_14, "array_merge", NULL, 332, &_11, &_12, &_13); zephir_check_call_status(); zephir_array_update_long(&pools, 0, &_14, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_fetch_long(&_15, &pools, type, PH_NOISY | PH_READONLY, "phalcon/Support/Helper/Str/Random.zep", 66); diff --git a/ext/phalcon/support/helper/str/reduceslashes.zep.c b/ext/phalcon/support/helper/str/reduceslashes.zep.c index 9bcfc308eed..b82ab545085 100644 --- a/ext/phalcon/support/helper/str/reduceslashes.zep.c +++ b/ext/phalcon/support/helper/str/reduceslashes.zep.c @@ -70,7 +70,7 @@ PHP_METHOD(Phalcon_Support_Helper_Str_ReduceSlashes, __invoke) ZVAL_STRING(&_0, "#(?", &_2, ""); diff --git a/ext/phalcon/tag/select.zep.c b/ext/phalcon/tag/select.zep.c index ee43b9d3b29..8a4e960c661 100644 --- a/ext/phalcon/tag/select.zep.c +++ b/ext/phalcon/tag/select.zep.c @@ -292,7 +292,7 @@ PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) } ZEPHIR_INIT_NVAR(&optionText); ZVAL_COPY(&optionText, _0); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 282, &optionValue); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 285, &optionValue); zephir_check_call_status(); if (Z_TYPE_P(&optionText) == IS_ARRAY) { ZEPHIR_INIT_NVAR(&_5$$4); @@ -345,7 +345,7 @@ PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&optionText, &data, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 282, &optionValue); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 285, &optionValue); zephir_check_call_status(); if (Z_TYPE_P(&optionText) == IS_ARRAY) { ZEPHIR_INIT_NVAR(&_16$$12); diff --git a/ext/phalcon/translate/adapter/csv.zep.c b/ext/phalcon/translate/adapter/csv.zep.c index b325f8d87b1..2d3cf988a6a 100644 --- a/ext/phalcon/translate/adapter/csv.zep.c +++ b/ext/phalcon/translate/adapter/csv.zep.c @@ -327,7 +327,7 @@ PHP_METHOD(Phalcon_Translate_Adapter_Csv, load) object_init_ex(&_1$$3, phalcon_translate_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "Error opening translation file '", &file, "'"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Translate/Adapter/Csv.zep", 133); ZEPHIR_MM_RESTORE(); @@ -403,7 +403,7 @@ PHP_METHOD(Phalcon_Translate_Adapter_Csv, phpFopen) zephir_get_strval(&mode, mode_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); + ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 139, &filename, &mode); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/phalcon/translate/adapter/nativearray.zep.c b/ext/phalcon/translate/adapter/nativearray.zep.c index 0ae5ca81fca..f33aa933c81 100644 --- a/ext/phalcon/translate/adapter/nativearray.zep.c +++ b/ext/phalcon/translate/adapter/nativearray.zep.c @@ -252,7 +252,7 @@ PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, notFound) object_init_ex(&_1$$3, phalcon_translate_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SV(&_2$$3, "Cannot find translation key: ", &index); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/Translate/Adapter/NativeArray.zep", 107); ZEPHIR_MM_RESTORE(); diff --git a/ext/phalcon/translate/interpolator/indexedarray.zep.c b/ext/phalcon/translate/interpolator/indexedarray.zep.c index 18eb35e2f6a..a9f6f44ed8e 100644 --- a/ext/phalcon/translate/interpolator/indexedarray.zep.c +++ b/ext/phalcon/translate/interpolator/indexedarray.zep.c @@ -92,7 +92,7 @@ PHP_METHOD(Phalcon_Translate_Interpolator_IndexedArray, replacePlaceholders) if (1 != ZEPHIR_IS_EMPTY(&placeholders)) { ZEPHIR_MAKE_REF(&placeholders); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 266, &placeholders, &translation); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 269, &placeholders, &translation); ZEPHIR_UNREF(&placeholders); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_0$$3); diff --git a/ext/php_phalcon.h b/ext/php_phalcon.h index c9f769c2700..1303ea7fa80 100644 --- a/ext/php_phalcon.h +++ b/ext/php_phalcon.h @@ -11,7 +11,7 @@ #include "kernel/globals.h" #define PHP_PHALCON_NAME "phalcon" -#define PHP_PHALCON_VERSION "5.2.3" +#define PHP_PHALCON_VERSION "5.3.0" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" #define PHP_PHALCON_ZEPVERSION "0.17.0-9f99da6" @@ -43,6 +43,7 @@ typedef struct _zephir_struct_orm { int unique_cache_id; zend_bool update_snapshot_on_save; zend_bool virtual_foreign_keys; + zend_bool dynamic_update; } zephir_struct_orm; typedef struct _zephir_struct_warning { From a10fb5c9e28659379a0a46e16590fc9ce29e264f Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Tue, 15 Aug 2023 14:24:52 -0400 Subject: [PATCH 28/29] adjusting changelog --- CHANGELOG-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 5e2609368b7..c81df813e9f 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,6 +1,6 @@ # Changelog -## [5.3.0](https://github.com/phalcon/cphalcon/releases/tag/v5.3.0) (xxxx-xx-xx) +## [5.3.0](https://github.com/phalcon/cphalcon/releases/tag/v5.3.0) (2023-08-15) ### Added From b8574293ecde2d34dfb453e5f1b7d916bdc8e71e Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Tue, 15 Aug 2023 14:25:12 -0400 Subject: [PATCH 29/29] refreshing build files --- build/phalcon/phalcon.zep.c | 328818 +++++++++++++++++---------------- build/phalcon/phalcon.zep.h | 487 +- build/phalcon/php_phalcon.h | 3 +- 3 files changed, 165375 insertions(+), 163933 deletions(-) diff --git a/build/phalcon/phalcon.zep.c b/build/phalcon/phalcon.zep.c index f16861aab63..46ff0316a96 100644 --- a/build/phalcon/phalcon.zep.c +++ b/build/phalcon/phalcon.zep.c @@ -3640,11 +3640,6 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_SCONCAT_VSVSVSV(result, op1, op2, op3, op4, op5, op6, op7) \ zephir_concat_vsvsvsv(result, op1, op2, sizeof(op2)-1, op3, op4, sizeof(op4)-1, op5, op6, sizeof(op6)-1, op7, 1); -#define ZEPHIR_CONCAT_VSVV(result, op1, op2, op3, op4) \ - zephir_concat_vsvv(result, op1, op2, sizeof(op2)-1, op3, op4, 0); -#define ZEPHIR_SCONCAT_VSVV(result, op1, op2, op3, op4) \ - zephir_concat_vsvv(result, op1, op2, sizeof(op2)-1, op3, op4, 1); - #define ZEPHIR_CONCAT_VV(result, op1, op2) \ zephir_concat_vv(result, op1, op2, 0); #define ZEPHIR_SCONCAT_VV(result, op1, op2) \ @@ -3717,7 +3712,6 @@ static void zephir_concat_vsvs(zval *result, zval *op1, const char *op2, uint32_ static void zephir_concat_vsvsv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, int self_var); static void zephir_concat_vsvsvs(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, const char *op6, uint32_t op6_len, int self_var); static void zephir_concat_vsvsvsv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, const char *op4, uint32_t op4_len, zval *op5, const char *op6, uint32_t op6_len, zval *op7, int self_var); -static void zephir_concat_vsvv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, zval *op4, int self_var); static void zephir_concat_vv(zval *result, zval *op1, zval *op2, int self_var); static void zephir_concat_vvs(zval *result, zval *op1, zval *op2, const char *op3, uint32_t op3_len, int self_var); static void zephir_concat_vvsv(zval *result, zval *op1, zval *op2, const char *op3, uint32_t op3_len, zval *op4, int self_var); @@ -12723,75 +12717,6 @@ static void zephir_concat_vsvsvsv(zval *result, zval *op1, const char *op2, uint } -static void zephir_concat_vsvv(zval *result, zval *op1, const char *op2, uint32_t op2_len, zval *op3, zval *op4, int self_var){ - - zval result_copy, op1_copy, op3_copy, op4_copy; - int use_copy = 0, use_copy1 = 0, use_copy3 = 0, use_copy4 = 0; - size_t offset = 0, length; - - if (Z_TYPE_P(op1) != IS_STRING) { - use_copy1 = zend_make_printable_zval(op1, &op1_copy); - if (use_copy1) { - op1 = &op1_copy; - } - } - - if (Z_TYPE_P(op3) != IS_STRING) { - use_copy3 = zend_make_printable_zval(op3, &op3_copy); - if (use_copy3) { - op3 = &op3_copy; - } - } - - if (Z_TYPE_P(op4) != IS_STRING) { - use_copy4 = zend_make_printable_zval(op4, &op4_copy); - if (use_copy4) { - op4 = &op4_copy; - } - } - - length = Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3) + Z_STRLEN_P(op4); - if (self_var) { - - if (Z_TYPE_P(result) != IS_STRING) { - use_copy = zend_make_printable_zval(result, &result_copy); - if (use_copy) { - ZEPHIR_CPY_WRT_CTOR(result, (&result_copy)); - } - } - - offset = Z_STRLEN_P(result); - length += offset; - Z_STR_P(result) = zend_string_realloc(Z_STR_P(result), length, 0); - - } else { - ZVAL_STR(result, zend_string_alloc(length, 0)); - } - - memcpy(Z_STRVAL_P(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1), op2, op2_len); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1) + op2_len, Z_STRVAL_P(op3), Z_STRLEN_P(op3)); - memcpy(Z_STRVAL_P(result) + offset + Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3), Z_STRVAL_P(op4), Z_STRLEN_P(op4)); - Z_STRVAL_P(result)[length] = 0; - zend_string_forget_hash_val(Z_STR_P(result)); - if (use_copy1) { - zval_dtor(op1); - } - - if (use_copy3) { - zval_dtor(op3); - } - - if (use_copy4) { - zval_dtor(op4); - } - - if (use_copy) { - zval_dtor(&result_copy); - } - -} - static void zephir_concat_vv(zval *result, zval *op1, zval *op2, int self_var){ zval result_copy, op1_copy, op2_copy; @@ -15040,7 +14965,7 @@ static PHP_METHOD(Phalcon_Tag, friendlyTitle) object_init_ex(&_3$$4, phalcon_tag_exception_ce); ZEPHIR_CALL_METHOD(&_4$$4, &ex, "getmessage", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_3$$4, "__construct", NULL, 29, &_4$$4); + ZEPHIR_CALL_METHOD(NULL, &_3$$4, "__construct", NULL, 32, &_4$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_3$$4, "phalcon/Tag.zep", 308); ZEPHIR_MM_RESTORE(); @@ -15340,7 +15265,7 @@ static PHP_METHOD(Phalcon_Tag, getTitle) zephir_read_static_property_ce(&_6$$3, phalcon_tag_ce, SL("documentPrependTitle"), PH_NOISY_CC); ZEPHIR_CPY_WRT(&documentPrependTitle, &_6$$3); if (!(ZEPHIR_IS_EMPTY(&documentPrependTitle))) { - ZEPHIR_CALL_FUNCTION(&tmp$$5, "array_reverse", NULL, 297, &documentPrependTitle); + ZEPHIR_CALL_FUNCTION(&tmp$$5, "array_reverse", NULL, 295, &documentPrependTitle); zephir_check_call_status(); zephir_is_iterable(&tmp$$5, 0, "phalcon/Tag.zep", 443); if (Z_TYPE_P(&tmp$$5) == IS_ARRAY) { @@ -16122,7 +16047,7 @@ static PHP_METHOD(Phalcon_Tag, preload) zephir_fast_str_replace(&_5$$5, &_6$$5, &_7$$5, &href); ZEPHIR_INIT_VAR(&_8$$5); ZVAL_STRING(&_8$$5, "preload"); - ZEPHIR_CALL_METHOD(NULL, &link, "__construct", NULL, 501, &_8$$5, &_5$$5, &attributes); + ZEPHIR_CALL_METHOD(NULL, &link, "__construct", NULL, 500, &_8$$5, &_5$$5, &attributes); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_8$$5); object_init_ex(&_8$$5, phalcon_html_link_serializer_header_ce); @@ -16134,7 +16059,7 @@ static PHP_METHOD(Phalcon_Tag, preload) ZEPHIR_INIT_VAR(&_10$$5); zephir_create_array(&_10$$5, 1, 0); zephir_array_fast_append(&_10$$5, &link); - ZEPHIR_CALL_METHOD(&_9$$5, &_8$$5, "serialize", NULL, 502, &_10$$5); + ZEPHIR_CALL_METHOD(&_9$$5, &_8$$5, "serialize", NULL, 501, &_10$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&header); ZEPHIR_CONCAT_SV(&header, "Link: ", &_9$$5); @@ -16386,7 +16311,7 @@ static PHP_METHOD(Phalcon_Tag, renderAttributes) zephir_gettype(&_16$$13, &value); ZEPHIR_INIT_NVAR(&_17$$13); ZEPHIR_CONCAT_SVSVS(&_17$$13, "Value at index: '", &key, "' type: '", &_16$$13, "' cannot be rendered"); - ZEPHIR_CALL_METHOD(NULL, &_15$$13, "__construct", &_18, 29, &_17$$13); + ZEPHIR_CALL_METHOD(NULL, &_15$$13, "__construct", &_18, 32, &_17$$13); zephir_check_call_status(); zephir_throw_exception_debug(&_15$$13, "phalcon/Tag.zep", 952); ZEPHIR_MM_RESTORE(); @@ -16432,7 +16357,7 @@ static PHP_METHOD(Phalcon_Tag, renderAttributes) zephir_gettype(&_24$$18, &value); ZEPHIR_INIT_NVAR(&_25$$18); ZEPHIR_CONCAT_SVSVS(&_25$$18, "Value at index: '", &key, "' type: '", &_24$$18, "' cannot be rendered"); - ZEPHIR_CALL_METHOD(NULL, &_23$$18, "__construct", &_18, 29, &_25$$18); + ZEPHIR_CALL_METHOD(NULL, &_23$$18, "__construct", &_18, 32, &_25$$18); zephir_check_call_status(); zephir_throw_exception_debug(&_23$$18, "phalcon/Tag.zep", 952); ZEPHIR_MM_RESTORE(); @@ -17245,7 +17170,7 @@ static PHP_METHOD(Phalcon_Tag, textArea) ZVAL_STRING(&_1, "", &_2, ""); @@ -17583,315 +17508,471 @@ static PHP_METHOD(Phalcon_Tag, inputFieldChecked) -ZEPHIR_INIT_CLASS(Phalcon_Factory_AbstractConfigFactory) +ZEPHIR_INIT_CLASS(Phalcon_Html_Attributes) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Factory, AbstractConfigFactory, phalcon, factory_abstractconfigfactory, phalcon_factory_abstractconfigfactory_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html, Attributes, phalcon, html_attributes, phalcon_support_collection_ce, phalcon_html_attributes_method_entry, 0); + zend_class_implements(phalcon_html_attributes_ce, 1, phalcon_html_attributes_renderinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Factory_AbstractConfigFactory, checkConfig) +static PHP_METHOD(Phalcon_Html_Attributes, render) { - zend_bool _0; + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *config = NULL, config_sub, _1$$3, _2$$4, _3$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config_sub); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(config) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &config); - ZEPHIR_SEPARATE_PARAM(config); - - _0 = Z_TYPE_P(config) == IS_OBJECT; - if (_0) { - _0 = zephir_instance_of_ev(config, phalcon_config_configinterface_ce); - } - if (_0) { - ZEPHIR_CALL_METHOD(&_1$$3, config, "toarray", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_1$$3); - } - if (UNEXPECTED(Z_TYPE_P(config) != IS_ARRAY)) { - ZEPHIR_INIT_VAR(&_3$$4); - ZVAL_STRING(&_3$$4, "Config must be array or Phalcon\\Config\\Config object"); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getexception", NULL, 0, &_3$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$4, "phalcon/Factory/AbstractConfigFactory.zep", 29); - ZEPHIR_MM_RESTORE(); - return; - } - RETVAL_ZVAL(config, 1, 0); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderattributes", NULL, 0, &_0); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Factory_AbstractConfigFactory, checkConfigElement) +static PHP_METHOD(Phalcon_Html_Attributes, __toString) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval element, _1$$3; - zval *config_param = NULL, *element_param = NULL, _0$$3; - zval config; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ARRAY(config) - Z_PARAM_STR(element) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &config_param, &element_param); - zephir_get_arrval(&config, config_param); - zephir_get_strval(&element, element_param); - - if (UNEXPECTED(!(zephir_array_isset(&config, &element)))) { - ZEPHIR_INIT_VAR(&_1$$3); - ZEPHIR_CONCAT_SVS(&_1$$3, "You must provide '", &element, "' option in factory config parameter."); - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getexception", NULL, 0, &_1$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "phalcon/Factory/AbstractConfigFactory.zep", 43); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_CTOR(&config); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "render", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Factory_AbstractConfigFactory, getException) +static PHP_METHOD(Phalcon_Html_Attributes, renderAttributes) { - zend_class_entry *_1; + zend_bool _4$$3, _10$$5; + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_8 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, exception, _0; - zval message; + zval *attributes_param = NULL, __$null, __$true, intersect, key, result, results, value, *_0, _1, _5$$4, _6$$4, _7$$4, _9$$4, _11$$6, _12$$6, _13$$6, _14$$6; + zval attributes, order; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&exception); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&order); + ZVAL_NULL(&__$null); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&intersect); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&results); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_13$$6); + ZVAL_UNDEF(&_14$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(message) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); - zephir_get_strval(&message, message_param); + zephir_fetch_params(1, 1, 0, &attributes_param); + zephir_get_arrval(&attributes, attributes_param); - ZEPHIR_CALL_METHOD(&exception, this_ptr, "getexceptionclass", NULL, 0); + ZEPHIR_INIT_VAR(&order); + zephir_create_array(&order, 10, 0); + zephir_array_update_string(&order, SL("rel"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("type"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("for"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("src"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("href"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("action"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("id"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("name"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("value"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("class"), &__$null, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect_key", NULL, 2, &order, &attributes); zephir_check_call_status(); - zephir_fetch_safe_class(&_0, &exception); - _1 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_0), Z_STRLEN_P(&_0), ZEND_FETCH_CLASS_AUTO); - if(!_1) { - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&results); + zephir_fast_array_merge(&results, &intersect, &attributes); + zephir_array_unset_string(&results, SL("escape"), PH_SEPARATE); + ZEPHIR_INIT_VAR(&result); + ZVAL_STRING(&result, ""); + zephir_is_iterable(&results, 0, "phalcon/Html/Attributes.zep", 76); + if (Z_TYPE_P(&results) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&results), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + _4$$3 = Z_TYPE_P(&key) == IS_STRING; + if (_4$$3) { + _4$$3 = Z_TYPE_P(&value) != IS_NULL; + } + if (_4$$3) { + ZVAL_LONG(&_5$$4, 3); + ZEPHIR_INIT_NVAR(&_6$$4); + ZVAL_STRING(&_6$$4, "utf-8"); + ZEPHIR_CALL_FUNCTION(&_7$$4, "htmlspecialchars", &_8, 285, &value, &_5$$4, &_6$$4, &__$true); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_CONCAT_VSVS(&_9$$4, &key, "=\"", &_7$$4, "\" "); + zephir_concat_self(&result, &_9$$4); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &results, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &results, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &results, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &results, "current", NULL, 0); + zephir_check_call_status(); + _10$$5 = Z_TYPE_P(&key) == IS_STRING; + if (_10$$5) { + _10$$5 = Z_TYPE_P(&value) != IS_NULL; + } + if (_10$$5) { + ZVAL_LONG(&_11$$6, 3); + ZEPHIR_INIT_NVAR(&_12$$6); + ZVAL_STRING(&_12$$6, "utf-8"); + ZEPHIR_CALL_FUNCTION(&_13$$6, "htmlspecialchars", &_8, 285, &value, &_11$$6, &_12$$6, &__$true); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_14$$6); + ZEPHIR_CONCAT_VSVS(&_14$$6, &key, "=\"", &_13$$6, "\" "); + zephir_concat_self(&result, &_14$$6); + } + ZEPHIR_CALL_METHOD(NULL, &results, "next", NULL, 0); + zephir_check_call_status(); + } } - object_init_ex(return_value, _1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, &message); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Factory_AbstractConfigFactory, getExceptionClass) -{ - zval *this_ptr = getThis(); - RETURN_STRING("Exception"); -} +#ifdef HAVE_CONFIG_H +#endif -#ifdef HAVE_CONFIG_H + +ZEPHIR_INIT_CLASS(Phalcon_Html_Breadcrumbs) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Html, Breadcrumbs, phalcon, html_breadcrumbs, phalcon_html_breadcrumbs_method_entry, 0); + + zend_declare_property_null(phalcon_html_breadcrumbs_ce, SL("elements"), ZEND_ACC_PRIVATE); + zend_declare_property_string(phalcon_html_breadcrumbs_ce, SL("separator"), " / ", ZEND_ACC_PRIVATE); + zend_declare_property_string(phalcon_html_breadcrumbs_ce, SL("template"), "
%label%
", ZEND_ACC_PRIVATE); + phalcon_html_breadcrumbs_ce->create_object = zephir_init_properties_Phalcon_Html_Breadcrumbs; + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Breadcrumbs, add) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *label_param = NULL, *link_param = NULL; + zval label, link; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&label); + ZVAL_UNDEF(&link); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(label) + Z_PARAM_OPTIONAL + Z_PARAM_STR(link) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &label_param, &link_param); + zephir_get_strval(&label, label_param); + if (!link_param) { + ZEPHIR_INIT_VAR(&link); + ZVAL_STRING(&link, ""); + } else { + zephir_get_strval(&link, link_param); + } + zephir_update_property_array(this_ptr, SL("elements"), &link, &label); + RETURN_THIS(); +} -ZEPHIR_INIT_CLASS(Phalcon_Factory_AbstractFactory) +static PHP_METHOD(Phalcon_Html_Breadcrumbs, clear) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Factory, AbstractFactory, phalcon, factory_abstractfactory, phalcon_factory_abstractconfigfactory_ce, phalcon_factory_abstractfactory_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); - zend_declare_property_null(phalcon_factory_abstractfactory_ce, SL("mapper"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_factory_abstractfactory_ce, SL("services"), ZEND_ACC_PROTECTED); - phalcon_factory_abstractfactory_ce->create_object = zephir_init_properties_Phalcon_Factory_AbstractFactory; + ZVAL_UNDEF(&_0); - return SUCCESS; + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("elements"), &_0); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Factory_AbstractFactory, getServices) +static PHP_METHOD(Phalcon_Html_Breadcrumbs, getSeparator) { + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "separator"); } -static PHP_METHOD(Phalcon_Factory_AbstractFactory, getService) +static PHP_METHOD(Phalcon_Html_Breadcrumbs, remove) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0, _3, _4, _1$$3; - zval name, _2$$3; + zval *link_param = NULL, elements, _0; + zval link; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&link); + ZVAL_UNDEF(&elements); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_STR(link) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } + zephir_fetch_params(1, 1, 0, &link_param); + zephir_get_strval(&link, link_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset(&_0, &name)))) { - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Service ", &name, " is not registered"); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "getexception", NULL, 0, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Factory/AbstractFactory.zep", 40); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4, &_3, &name, PH_NOISY | PH_READONLY, "phalcon/Factory/AbstractFactory.zep", 43); - RETURN_CTOR(&_4); + zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&elements, &_0); + zephir_array_unset(&elements, &link, PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("elements"), &elements); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Factory_AbstractFactory, init) +static PHP_METHOD(Phalcon_Html_Breadcrumbs, render) { + zval _6$$3, _8$$3, _10$$4, _12$$4, _15$$6, _17$$6; zend_string *_4; zend_ulong _3; + zval element, elements, lastLabel, lastUrl, output, template, url, urls, _0, *_1, _2, _18, _19, _5$$3, _7$$3, _9$$4, _11$$4, _13$$5, _14$$6, _16$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *services_param = NULL, adapters, name, service, _0, *_1, _2, _5$$3, _6$$4; - zval services; zval *this_ptr = getThis(); - ZVAL_UNDEF(&services); - ZVAL_UNDEF(&adapters); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&service); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&lastLabel); + ZVAL_UNDEF(&lastUrl); + ZVAL_UNDEF(&output); + ZVAL_UNDEF(&template); + ZVAL_UNDEF(&url); + ZVAL_UNDEF(&urls); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_18); + ZVAL_UNDEF(&_19); ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(services) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_11$$4); + ZVAL_UNDEF(&_13$$5); + ZVAL_UNDEF(&_14$$6); + ZVAL_UNDEF(&_16$$6); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_8$$3); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_12$$4); + ZVAL_UNDEF(&_15$$6); + ZVAL_UNDEF(&_17$$6); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &services_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); - } - - ZEPHIR_CALL_METHOD(&adapters, this_ptr, "getservices", NULL, 0); + ZEPHIR_INIT_VAR(&output); + array_init(&output); + zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&elements, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("template"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&template, &_0); + ZEPHIR_INIT_VAR(&urls); + zephir_array_keys(&urls, &elements); + ZEPHIR_MAKE_REF(&urls); + ZEPHIR_CALL_FUNCTION(&lastUrl, "end", NULL, 322, &urls); + ZEPHIR_UNREF(&urls); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_fast_array_merge(&_0, &adapters, &services); - ZEPHIR_CPY_WRT(&adapters, &_0); - zephir_is_iterable(&adapters, 0, "phalcon/Factory/AbstractFactory.zep", 60); - if (Z_TYPE_P(&adapters) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&adapters), _3, _4, _1) + ZEPHIR_OBS_VAR(&lastLabel); + zephir_array_fetch(&lastLabel, &elements, &lastUrl, PH_NOISY, "phalcon/Html/Breadcrumbs.zep", 122); + zephir_array_unset(&elements, &lastUrl, PH_SEPARATE); + zephir_is_iterable(&elements, 0, "phalcon/Html/Breadcrumbs.zep", 143); + if (Z_TYPE_P(&elements) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&elements), _3, _4, _1) { - ZEPHIR_INIT_NVAR(&name); + ZEPHIR_INIT_NVAR(&url); if (_4 != NULL) { - ZVAL_STR_COPY(&name, _4); + ZVAL_STR_COPY(&url, _4); } else { - ZVAL_LONG(&name, _3); + ZVAL_LONG(&url, _3); } - ZEPHIR_INIT_NVAR(&service); - ZVAL_COPY(&service, _1); - zephir_update_property_array(this_ptr, SL("mapper"), &name, &service); - zephir_unset_property_array(this_ptr, ZEND_STRL("services"), &name); - zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_5$$3, &name, PH_SEPARATE); + ZEPHIR_INIT_NVAR(&element); + ZVAL_COPY(&element, _1); + ZEPHIR_INIT_NVAR(&_5$$3); + ZEPHIR_INIT_NVAR(&_6$$3); + zephir_create_array(&_6$$3, 2, 0); + ZEPHIR_INIT_NVAR(&_7$$3); + ZVAL_STRING(&_7$$3, "%label%"); + zephir_array_fast_append(&_6$$3, &_7$$3); + ZEPHIR_INIT_NVAR(&_7$$3); + ZVAL_STRING(&_7$$3, "%link%"); + zephir_array_fast_append(&_6$$3, &_7$$3); + ZEPHIR_INIT_NVAR(&_8$$3); + zephir_create_array(&_8$$3, 2, 0); + zephir_array_fast_append(&_8$$3, &element); + zephir_array_fast_append(&_8$$3, &url); + zephir_fast_str_replace(&_5$$3, &_6$$3, &_8$$3, &template); + zephir_array_append(&output, &_5$$3, PH_SEPARATE, "phalcon/Html/Breadcrumbs.zep", 137); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &adapters, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &elements, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_2, &adapters, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &elements, "valid", NULL, 0); zephir_check_call_status(); if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&name, &adapters, "key", NULL, 0); + ZEPHIR_CALL_METHOD(&url, &elements, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&service, &adapters, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&element, &elements, "current", NULL, 0); zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("mapper"), &name, &service); - zephir_unset_property_array(this_ptr, ZEND_STRL("services"), &name); - zephir_read_property(&_6$$4, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_6$$4, &name, PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &adapters, "next", NULL, 0); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_INIT_NVAR(&_10$$4); + zephir_create_array(&_10$$4, 2, 0); + ZEPHIR_INIT_NVAR(&_11$$4); + ZVAL_STRING(&_11$$4, "%label%"); + zephir_array_fast_append(&_10$$4, &_11$$4); + ZEPHIR_INIT_NVAR(&_11$$4); + ZVAL_STRING(&_11$$4, "%link%"); + zephir_array_fast_append(&_10$$4, &_11$$4); + ZEPHIR_INIT_NVAR(&_12$$4); + zephir_create_array(&_12$$4, 2, 0); + zephir_array_fast_append(&_12$$4, &element); + zephir_array_fast_append(&_12$$4, &url); + zephir_fast_str_replace(&_9$$4, &_10$$4, &_12$$4, &template); + zephir_array_append(&output, &_9$$4, PH_SEPARATE, "phalcon/Html/Breadcrumbs.zep", 137); + ZEPHIR_CALL_METHOD(NULL, &elements, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&service); - ZEPHIR_INIT_NVAR(&name); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_NVAR(&element); + ZEPHIR_INIT_NVAR(&url); + if (0 != zephir_fast_count_int(&elements)) { + ZEPHIR_INIT_VAR(&_13$$5); + ZEPHIR_CONCAT_SVS(&_13$$5, "
", &lastLabel, "
"); + zephir_array_append(&output, &_13$$5, PH_SEPARATE, "phalcon/Html/Breadcrumbs.zep", 144); + } else { + ZEPHIR_INIT_VAR(&_14$$6); + ZEPHIR_INIT_VAR(&_15$$6); + zephir_create_array(&_15$$6, 2, 0); + ZEPHIR_INIT_VAR(&_16$$6); + ZVAL_STRING(&_16$$6, "%label%"); + zephir_array_fast_append(&_15$$6, &_16$$6); + ZEPHIR_INIT_NVAR(&_16$$6); + ZVAL_STRING(&_16$$6, "%link%"); + zephir_array_fast_append(&_15$$6, &_16$$6); + ZEPHIR_INIT_VAR(&_17$$6); + zephir_create_array(&_17$$6, 2, 0); + zephir_array_fast_append(&_17$$6, &lastLabel); + zephir_array_fast_append(&_17$$6, &lastUrl); + zephir_fast_str_replace(&_14$$6, &_15$$6, &_17$$6, &template); + zephir_array_append(&output, &_14$$6, PH_SEPARATE, "phalcon/Html/Breadcrumbs.zep", 156); + } + ZEPHIR_INIT_VAR(&_18); + zephir_read_property(&_0, this_ptr, ZEND_STRL("separator"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_19); + ZEPHIR_CONCAT_SVS(&_19, "
", &_0, "
"); + zephir_fast_join(&_18, &_19, &output); + ZEPHIR_CONCAT_SVS(return_value, "
", &_18, "
"); + RETURN_MM(); } -zend_object *zephir_init_properties_Phalcon_Factory_AbstractFactory(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Html_Breadcrumbs, setSeparator) { - zval _0, _2, _1$$3, _3$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *separator_param = NULL; + zval separator; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&separator); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(separator) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &separator_param); + zephir_get_strval(&separator, separator_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("separator"), &separator); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Html_Breadcrumbs, toArray) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "elements"); +} + +zend_object *zephir_init_properties_Phalcon_Html_Breadcrumbs(zend_class_entry *class_type) +{ + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); ZEPHIR_MM_GROW(); @@ -17899,17 +17980,11 @@ zend_object *zephir_init_properties_Phalcon_Factory_AbstractFactory(zend_class_e { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("services"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("mapper"), &_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("elements"), &_1$$3); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -17926,917 +18001,801 @@ zend_object *zephir_init_properties_Phalcon_Factory_AbstractFactory(zend_class_e -ZEPHIR_INIT_CLASS(Phalcon_Factory_Exception) +ZEPHIR_INIT_CLASS(Phalcon_Html_Escaper) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Factory, Exception, phalcon, factory_exception, zend_ce_exception, NULL, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Html, Escaper, phalcon, html_escaper, phalcon_html_escaper_method_entry, 0); + zend_declare_property_bool(phalcon_html_escaper_ce, SL("doubleEncode"), 1, ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_escaper_ce, SL("encoding"), "utf-8", ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_html_escaper_ce, SL("flags"), 11, ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_html_escaper_ce, 1, phalcon_html_escaper_escaperinterface_ce); return SUCCESS; } +static PHP_METHOD(Phalcon_Html_Escaper, attributes) +{ + zend_bool _5$$4, _13$$8; + zval _0$$3, _9$$4, _11$$7, _17$$8, _19$$11; + zend_string *_4; + zend_ulong _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input, input_sub, key, result, value, *_1, _2, _6$$4, _8$$4, _7$$6, _10$$7, _12$$7, _14$$8, _16$$8, _15$$10, _18$$11, _20$$11; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&input_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_10$$7); + ZVAL_UNDEF(&_12$$7); + ZVAL_UNDEF(&_14$$8); + ZVAL_UNDEF(&_16$$8); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_18$$11); + ZVAL_UNDEF(&_20$$11); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_17$$8); + ZVAL_UNDEF(&_19$$11); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(input) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &input); - -ZEPHIR_INIT_CLASS(Phalcon_Storage_AdapterFactory) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage, AdapterFactory, phalcon, storage_adapterfactory, phalcon_factory_abstractfactory_ce, phalcon_storage_adapterfactory_method_entry, 0); - - zend_declare_property_null(phalcon_storage_adapterfactory_ce, SL("serializerFactory"), ZEND_ACC_PRIVATE); - return SUCCESS; + if (EXPECTED((Z_TYPE_P(input) != IS_ARRAY))) { + zephir_cast_to_string(&_0$$3, input); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "phphtmlspecialchars", NULL, 0, &_0$$3); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&result); + ZVAL_STRING(&result, ""); + zephir_is_iterable(input, 0, "phalcon/Html/Escaper.zep", 96); + if (Z_TYPE_P(input) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&key); + if (_4 != NULL) { + ZVAL_STR_COPY(&key, _4); + } else { + ZVAL_LONG(&key, _3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1); + _5$$4 = Z_TYPE_P(&value) == IS_NULL; + if (!(_5$$4)) { + _5$$4 = ZEPHIR_IS_FALSE_IDENTICAL(&value); + } + if (_5$$4) { + continue; + } + ZEPHIR_INIT_NVAR(&_6$$4); + zephir_fast_trim(&_6$$4, &key, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_CPY_WRT(&key, &_6$$4); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_7$$6); + zephir_fast_join_str(&_7$$6, SL(" "), &value); + ZEPHIR_CPY_WRT(&value, &_7$$6); + } + zephir_cast_to_string(&_9$$4, &key); + ZEPHIR_CALL_METHOD(&_8$$4, this_ptr, "phphtmlspecialchars", NULL, 0, &_9$$4); + zephir_check_call_status(); + zephir_concat_self(&result, &_8$$4); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_cast_to_string(&_11$$7, &value); + ZEPHIR_CALL_METHOD(&_10$$7, this_ptr, "phphtmlspecialchars", NULL, 0, &_11$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_12$$7); + ZEPHIR_CONCAT_SVS(&_12$$7, "=\"", &_10$$7, "\""); + zephir_concat_self(&result, &_12$$7); + } + zephir_concat_self_str(&result, SL(" ")); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, input, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, input, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&key, input, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, input, "current", NULL, 0); + zephir_check_call_status(); + _13$$8 = Z_TYPE_P(&value) == IS_NULL; + if (!(_13$$8)) { + _13$$8 = ZEPHIR_IS_FALSE_IDENTICAL(&value); + } + if (_13$$8) { + continue; + } + ZEPHIR_INIT_NVAR(&_14$$8); + zephir_fast_trim(&_14$$8, &key, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_CPY_WRT(&key, &_14$$8); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_15$$10); + zephir_fast_join_str(&_15$$10, SL(" "), &value); + ZEPHIR_CPY_WRT(&value, &_15$$10); + } + zephir_cast_to_string(&_17$$8, &key); + ZEPHIR_CALL_METHOD(&_16$$8, this_ptr, "phphtmlspecialchars", NULL, 0, &_17$$8); + zephir_check_call_status(); + zephir_concat_self(&result, &_16$$8); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_cast_to_string(&_19$$11, &value); + ZEPHIR_CALL_METHOD(&_18$$11, this_ptr, "phphtmlspecialchars", NULL, 0, &_19$$11); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_20$$11); + ZEPHIR_CONCAT_SVS(&_20$$11, "=\"", &_18$$11, "\""); + zephir_concat_self(&result, &_20$$11); + } + zephir_concat_self_str(&result, SL(" ")); + ZEPHIR_CALL_METHOD(NULL, input, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + zephir_fast_trim(return_value, &result, NULL , ZEPHIR_TRIM_RIGHT); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_AdapterFactory, __construct) +static PHP_METHOD(Phalcon_Html_Escaper, css) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval services; - zval *factory, factory_sub, *services_param = NULL; + zval *input_param = NULL, _0; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&input); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(services) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &services_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); - } + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("serializerFactory"), factory); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 323, &input); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapecss", NULL, 324, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_AdapterFactory, newInstance) +static PHP_METHOD(Phalcon_Html_Escaper, detectEncoding) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval options, _0; - zval *name_param = NULL, *options_param = NULL, definition, _1; - zval name; + zval *input_param = NULL, __$true, charset, _1, *_2, _3, _4$$5, _6$$7; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&input); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&charset); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_6$$7); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &options_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); - } + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&charset); + zephir_is_basic_charset(&charset, &input); + if (Z_TYPE_P(&charset) == IS_STRING) { + RETURN_CCTOR(&charset); + } + if (!((zephir_function_exists_ex(ZEND_STRL("mb_detect_encoding")) == SUCCESS))) { + RETURN_MM_NULL(); + } ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0); - ZEPHIR_OBS_VAR(&_1); - zephir_read_property(&_1, this_ptr, ZEND_STRL("serializerFactory"), PH_NOISY_CC); + zephir_create_array(&_0, 4, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "UTF-32"); zephir_array_fast_append(&_0, &_1); - zephir_array_fast_append(&_0, &options); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_0); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "UTF-8"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "ISO-8859-1"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "ASCII"); + zephir_array_fast_append(&_0, &_1); + zephir_is_iterable(&_0, 0, "phalcon/Html/Escaper.zep", 158); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) + { + ZEPHIR_INIT_NVAR(&charset); + ZVAL_COPY(&charset, _2); + ZEPHIR_CALL_FUNCTION(&_4$$5, "mb_detect_encoding", &_5, 325, &input, &charset, &__$true); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_4$$5)) { + RETURN_CCTOR(&charset); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&charset, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&_6$$7, "mb_detect_encoding", &_5, 325, &input, &charset, &__$true); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_6$$7)) { + RETURN_CCTOR(&charset); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&charset); + ZEPHIR_RETURN_CALL_FUNCTION("mb_detect_encoding", &_5, 325, &input); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_AdapterFactory, getExceptionClass) -{ - zval *this_ptr = getThis(); - - - - RETURN_STRING("Phalcon\\Storage\\Exception"); -} - -static PHP_METHOD(Phalcon_Storage_AdapterFactory, getServices) +static PHP_METHOD(Phalcon_Html_Escaper, escapeCss) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL; + zval input; zval *this_ptr = getThis(); - - - zephir_create_array(return_value, 5, 0); - add_assoc_stringl_ex(return_value, SL("apcu"), SL("Phalcon\\Storage\\Adapter\\Apcu")); - add_assoc_stringl_ex(return_value, SL("libmemcached"), SL("Phalcon\\Storage\\Adapter\\Libmemcached")); - add_assoc_stringl_ex(return_value, SL("memory"), SL("Phalcon\\Storage\\Adapter\\Memory")); - add_assoc_stringl_ex(return_value, SL("redis"), SL("Phalcon\\Storage\\Adapter\\Redis")); - add_assoc_stringl_ex(return_value, SL("stream"), SL("Phalcon\\Storage\\Adapter\\Stream")); - return; -} - - - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&input); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - -ZEPHIR_INIT_CLASS(Phalcon_Storage_Exception) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage, Exception, phalcon, storage_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "css", NULL, 0, &input); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Html_Escaper, escapeJs) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL; + zval input; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&input); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - -ZEPHIR_INIT_CLASS(Phalcon_Storage_SerializerFactory) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage, SerializerFactory, phalcon, storage_serializerfactory, phalcon_factory_abstractfactory_ce, phalcon_storage_serializerfactory_method_entry, 0); - - return SUCCESS; + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "js", NULL, 0, &input); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_SerializerFactory, __construct) +static PHP_METHOD(Phalcon_Html_Escaper, escapeHtml) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *services_param = NULL; - zval services; + zval *input_param = NULL; + zval input, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&input); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(services) + Z_PARAM_STR_OR_NULL(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &services_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); + zephir_fetch_params(1, 0, 1, &input_param); + if (!input_param) { + ZEPHIR_INIT_VAR(&input); } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); + zephir_get_strval(&input, input_param); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); + zephir_cast_to_string(&_0, &input); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "html", NULL, 0, &_0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_SerializerFactory, newInstance) +static PHP_METHOD(Phalcon_Html_Escaper, escapeHtmlAttr) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, definition; - zval name; + zval *input_param = NULL; + zval input, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&input); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 0, 1, &input_param); + if (!input_param) { + ZEPHIR_INIT_VAR(&input); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_strval(&input, input_param); } - ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(return_value, &definition); + zephir_cast_to_string(&_0, &input); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "attributes", NULL, 0, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_SerializerFactory, getExceptionClass) +static PHP_METHOD(Phalcon_Html_Escaper, escapeUrl) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL; + zval input; zval *this_ptr = getThis(); + ZVAL_UNDEF(&input); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_STRING("Phalcon\\Storage\\Exception"); -} - -static PHP_METHOD(Phalcon_Storage_SerializerFactory, getServices) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - zephir_create_array(return_value, 14, 0); - add_assoc_stringl_ex(return_value, SL("base64"), SL("Phalcon\\Storage\\Serializer\\Base64")); - add_assoc_stringl_ex(return_value, SL("igbinary"), SL("Phalcon\\Storage\\Serializer\\Igbinary")); - add_assoc_stringl_ex(return_value, SL("json"), SL("Phalcon\\Storage\\Serializer\\Json")); - add_assoc_stringl_ex(return_value, SL("memcached_igbinary"), SL("Phalcon\\Storage\\Serializer\\MemcachedIgbinary")); - add_assoc_stringl_ex(return_value, SL("memcached_json"), SL("Phalcon\\Storage\\Serializer\\MemcachedJson")); - add_assoc_stringl_ex(return_value, SL("memcached_php"), SL("Phalcon\\Storage\\Serializer\\MemcachedPhp")); - add_assoc_stringl_ex(return_value, SL("msgpack"), SL("Phalcon\\Storage\\Serializer\\Msgpack")); - add_assoc_stringl_ex(return_value, SL("none"), SL("Phalcon\\Storage\\Serializer\\None")); - add_assoc_stringl_ex(return_value, SL("php"), SL("Phalcon\\Storage\\Serializer\\Php")); - add_assoc_stringl_ex(return_value, SL("redis_igbinary"), SL("Phalcon\\Storage\\Serializer\\RedisIgbinary")); - add_assoc_stringl_ex(return_value, SL("redis_json"), SL("Phalcon\\Storage\\Serializer\\RedisJson")); - add_assoc_stringl_ex(return_value, SL("redis_msgpack"), SL("Phalcon\\Storage\\Serializer\\RedisMsgpack")); - add_assoc_stringl_ex(return_value, SL("redis_none"), SL("Phalcon\\Storage\\Serializer\\RedisNone")); - add_assoc_stringl_ex(return_value, SL("redis_php"), SL("Phalcon\\Storage\\Serializer\\RedisPhp")); - return; + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "url", NULL, 0, &input); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Html_Escaper, getEncoding) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif - - - - + RETURN_MEMBER(getThis(), "encoding"); +} -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_AbstractAdapter) +static PHP_METHOD(Phalcon_Html_Escaper, getFlags) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Storage\\Adapter, AbstractAdapter, phalcon, storage_adapter_abstractadapter, phalcon_storage_adapter_abstractadapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zval *this_ptr = getThis(); - zend_declare_property_null(phalcon_storage_adapter_abstractadapter_ce, SL("adapter"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_storage_adapter_abstractadapter_ce, SL("defaultSerializer"), "php", ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_storage_adapter_abstractadapter_ce, SL("lifetime"), 3600, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_storage_adapter_abstractadapter_ce, SL("options"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_storage_adapter_abstractadapter_ce, SL("prefix"), "ph-memo-", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_storage_adapter_abstractadapter_ce, SL("serializer"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_storage_adapter_abstractadapter_ce, SL("serializerFactory"), ZEND_ACC_PROTECTED); - phalcon_storage_adapter_abstractadapter_ce->create_object = zephir_init_properties_Phalcon_Storage_Adapter_AbstractAdapter; - zend_class_implements(phalcon_storage_adapter_abstractadapter_ce, 1, phalcon_storage_adapter_adapterinterface_ce); - return SUCCESS; + + RETURN_MEMBER(getThis(), "flags"); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, __construct) +static PHP_METHOD(Phalcon_Html_Escaper, html) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *factory, factory_sub, *options_param = NULL, _0, _1, _2, _3, _4, _5, _6, _7$$3; + zval *input_param = NULL, _0, _1, _2; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); + ZVAL_UNDEF(&input); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_STR_OR_NULL(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 0, 1, &input_param); + if (!input_param) { + ZEPHIR_INIT_VAR(&input); } else { - zephir_get_arrval(&options, options_param); + zephir_get_strval(&input, input_param); } - zephir_update_property_zval(this_ptr, ZEND_STRL("serializerFactory"), factory); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "defaultSerializer"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "php"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getarrval", NULL, 0, &options, &_1, &_2); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_3, "mb_strtolower", NULL, 10, &_0); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultSerializer"), &_3); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "lifetime"); - ZVAL_LONG(&_5, 3600); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getarrval", NULL, 0, &options, &_1, &_5); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("lifetime"), &_4); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "serializer"); - ZVAL_NULL(&_5); - ZEPHIR_CALL_METHOD(&_6, this_ptr, "getarrval", NULL, 0, &options, &_1, &_5); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("serializer"), &_6); - if (zephir_array_isset_string(&options, SL("prefix"))) { - zephir_array_fetch_string(&_7$$3, &options, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/AbstractAdapter.zep", 99); - zephir_update_property_zval(this_ptr, ZEND_STRL("prefix"), &_7$$3); + if (Z_TYPE_P(&input) == IS_NULL) { + RETURN_MM_STRING(""); } - zephir_array_unset_string(&options, SL("defaultSerializer"), PH_SEPARATE); - zephir_array_unset_string(&options, SL("lifetime"), PH_SEPARATE); - zephir_array_unset_string(&options, SL("serializer"), PH_SEPARATE); - zephir_array_unset_string(&options, SL("prefix"), PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, clear) -{ -} - -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, decrement) -{ -} - -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, delete) -{ + zephir_read_property(&_0, this_ptr, ZEND_STRL("flags"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("encoding"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_2, this_ptr, ZEND_STRL("doubleEncode"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 285, &input, &_0, &_1, &_2); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, get) +static PHP_METHOD(Phalcon_Html_Escaper, js) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, content, _0; - zval key; + zval *input_param = NULL, _0; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&content); + ZVAL_UNDEF(&input); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &defaultValue); - zephir_get_strval(&key, key_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &key); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&content, this_ptr, "doget", NULL, 0, &key); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "normalizeencoding", NULL, 323, &input); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getunserializeddata", NULL, 0, &content, defaultValue); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doescapejs", NULL, 326, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getAdapter) +static PHP_METHOD(Phalcon_Html_Escaper, normalizeEncoding) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL, _0, _1; + zval input; zval *this_ptr = getThis(); + ZVAL_UNDEF(&input); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "adapter"); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getDefaultSerializer) -{ - zval *this_ptr = getThis(); - - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - RETURN_MEMBER(getThis(), "defaultSerializer"); -} -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getKeys) -{ + ZEPHIR_CALL_METHOD(&_0, this_ptr, "detectencoding", NULL, 327, &input); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "UTF-32"); + ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 328, &input, &_1, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getPrefix) +static PHP_METHOD(Phalcon_Html_Escaper, setDoubleEncode) { + zval *doubleEncode_param = NULL, __$true, __$false; + zend_bool doubleEncode; zval *this_ptr = getThis(); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(doubleEncode) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "prefix"); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, has) -{ -} + zephir_fetch_params_without_memory_grow(1, 0, &doubleEncode_param); + doubleEncode = zephir_get_boolval(doubleEncode_param); -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, increment) -{ -} -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, set) -{ + if (doubleEncode) { + zephir_update_property_zval(this_ptr, ZEND_STRL("doubleEncode"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("doubleEncode"), &__$false); + } + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, setDefaultSerializer) +static PHP_METHOD(Phalcon_Html_Escaper, setEncoding) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *serializer_param = NULL, _0; - zval serializer; + zval *encoding_param = NULL; + zval encoding; zval *this_ptr = getThis(); - ZVAL_UNDEF(&serializer); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&encoding); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(serializer) + Z_PARAM_STR(encoding) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &serializer_param); - zephir_get_strval(&serializer, serializer_param); + zephir_fetch_params(1, 1, 0, &encoding_param); + zephir_get_strval(&encoding, encoding_param); - ZEPHIR_CALL_FUNCTION(&_0, "mb_strtolower", NULL, 10, &serializer); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultSerializer"), &_0); - ZEPHIR_MM_RESTORE(); + zephir_update_property_zval(this_ptr, ZEND_STRL("encoding"), &encoding); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, doGet) +static PHP_METHOD(Phalcon_Html_Escaper, setFlags) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0; - zval key; + zval *flags_param = NULL, _0; + zend_long flags; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); + zephir_fetch_params_without_memory_grow(1, 0, &flags_param); + flags = zephir_get_intval(flags_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_0, "get", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, flags); + zephir_update_property_zval(this_ptr, ZEND_STRL("flags"), &_0); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getFilteredKeys) +static PHP_METHOD(Phalcon_Html_Escaper, setHtmlQuoteType) { - zval results; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval prefix; - zval *keys = NULL, keys_sub, *prefix_param = NULL, key, pattern, _0, _1, *_2, _3; + zval *flags_param = NULL, _0; + zend_long flags, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&keys_sub); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&prefix); - ZVAL_UNDEF(&results); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ZVAL(keys) - Z_PARAM_STR(prefix) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &keys, &prefix_param); - ZEPHIR_SEPARATE_PARAM(keys); - if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(&prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(&prefix); - } + zephir_fetch_params(1, 1, 0, &flags_param); + flags = zephir_get_intval(flags_param); - ZEPHIR_INIT_VAR(&results); - array_init(&results); - zephir_read_property(&_0, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&pattern); - ZEPHIR_CONCAT_VV(&pattern, &_0, &prefix); - ZEPHIR_INIT_VAR(&_1); - if (!(zephir_is_true(keys))) { - ZEPHIR_INIT_NVAR(&_1); - array_init(&_1); - } else { - ZEPHIR_CPY_WRT(&_1, keys); - } - ZEPHIR_CPY_WRT(keys, &_1); - zephir_is_iterable(keys, 0, "phalcon/Storage/Adapter/AbstractAdapter.zep", 267); - if (Z_TYPE_P(keys) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), _2) - { - ZEPHIR_INIT_NVAR(&key); - ZVAL_COPY(&key, _2); - if (zephir_start_with(&key, &pattern, NULL)) { - zephir_array_append(&results, &key, PH_SEPARATE, "phalcon/Storage/Adapter/AbstractAdapter.zep", 263); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, keys, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, keys, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&key, keys, "current", NULL, 0); - zephir_check_call_status(); - if (zephir_start_with(&key, &pattern, NULL)) { - zephir_array_append(&results, &key, PH_SEPARATE, "phalcon/Storage/Adapter/AbstractAdapter.zep", 263); - } - ZEPHIR_CALL_METHOD(NULL, keys, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&key); - RETURN_CTOR(&results); + ZVAL_LONG(&_0, flags); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "setflags", NULL, 0, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getPrefixedKey) +static PHP_METHOD(Phalcon_Html_Escaper, url) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *key = NULL, key_sub, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&input); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(key) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key); - ZEPHIR_SEPARATE_PARAM(key); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - zephir_cast_to_string(&_0, key); - ZEPHIR_CPY_WRT(key, &_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CONCAT_VV(return_value, &_1, key); + ZEPHIR_RETURN_CALL_FUNCTION("rawurlencode", NULL, 329, &input); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getSerializedData) +static PHP_METHOD(Phalcon_Html_Escaper, phpHtmlSpecialChars) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *content = NULL, content_sub, _0, _1$$3, _2$$3; + zval *input_param = NULL, _0, _1, _2; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&content_sub); + ZVAL_UNDEF(&input); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(content) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &content); - ZEPHIR_SEPARATE_PARAM(content); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) != IS_NULL) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "setdata", NULL, 0, content); - zephir_check_call_status(); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(content, &_2$$3, "serialize", NULL, 0); - zephir_check_call_status(); - } - RETVAL_ZVAL(content, 1, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("flags"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("encoding"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_2, this_ptr, ZEND_STRL("doubleEncode"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_FUNCTION("htmlspecialchars", NULL, 285, &input, &_0, &_1, &_2); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getTtl) +static PHP_METHOD(Phalcon_Html_Escaper, doEscapeCss) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *ttl, ttl_sub, dateTime, _1$$4, _2$$4; + zval *input_param = NULL; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&ttl_sub); - ZVAL_UNDEF(&dateTime); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&input); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(ttl) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &ttl); + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - if (Z_TYPE_P(ttl) == IS_NULL) { - RETURN_MM_MEMBER(getThis(), "lifetime"); - } - _0 = Z_TYPE_P(ttl) == IS_OBJECT; - if (_0) { - _0 = zephir_is_instance_of(ttl, SL("DateInterval")); - } - if (_0) { - ZEPHIR_INIT_VAR(&dateTime); - object_init_ex(&dateTime, php_date_get_date_ce()); - ZEPHIR_INIT_VAR(&_1$$4); - ZVAL_STRING(&_1$$4, "@0"); - ZEPHIR_CALL_METHOD(NULL, &dateTime, "__construct", NULL, 0, &_1$$4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2$$4, &dateTime, "add", NULL, 0, ttl); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_2$$4, "gettimestamp", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_MM_LONG(zephir_get_intval(ttl)); + zephir_escape_css(return_value, &input); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getUnserializedData) +static PHP_METHOD(Phalcon_Html_Escaper, doEscapeJs) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *content = NULL, content_sub, *defaultValue = NULL, defaultValue_sub, __$null, _0, _1$$3, _2$$3, _3$$3, _4$$3; + zval *input_param = NULL; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&content_sub); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&input); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(content) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &content, &defaultValue); - ZEPHIR_SEPARATE_PARAM(content); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) != IS_NULL) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "unserialize", NULL, 0, content); - zephir_check_call_status(); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_3$$3, &_2$$3, "issuccess", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!ZEPHIR_IS_TRUE_IDENTICAL(&_3$$3))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(content, &_4$$3, "getdata", NULL, 0); - zephir_check_call_status(); - } - RETVAL_ZVAL(content, 1, 0); + zephir_escape_js(return_value, &input); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, initSerializer) -{ - zend_bool _1; - zval className, _0, _2, _3$$3, _4$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultSerializer"), PH_NOISY_CC); - _1 = 1 != ZEPHIR_IS_EMPTY(&_0); - if (_1) { - ZEPHIR_OBS_VAR(&_2); - zephir_read_property(&_2, this_ptr, ZEND_STRL("serializer"), PH_NOISY_CC); - _1 = Z_TYPE_P(&_2) != IS_OBJECT; - } - if (_1) { - ZEPHIR_OBS_VAR(&className); - zephir_read_property(&className, this_ptr, ZEND_STRL("defaultSerializer"), PH_NOISY_CC); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("serializerFactory"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_4$$3, &_3$$3, "newinstance", NULL, 0, &className); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("serializer"), &_4$$3); - } - ZEPHIR_MM_RESTORE(); + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_EscaperFactory) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Html, EscaperFactory, phalcon, html_escaperfactory, phalcon_html_escaperfactory_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_AbstractAdapter, getArrVal) +static PHP_METHOD(Phalcon_Html_EscaperFactory, newInstance) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval cast; - zval *collection_param = NULL, *index, index_sub, *defaultValue = NULL, defaultValue_sub, *cast_param = NULL, __$null, value; - zval collection; zval *this_ptr = getThis(); - ZVAL_UNDEF(&collection); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&cast); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_ARRAY(collection) - Z_PARAM_ZVAL(index) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) - Z_PARAM_STR_OR_NULL(cast) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 2, &collection_param, &index, &defaultValue, &cast_param); - ZEPHIR_OBS_COPY_OR_DUP(&collection, collection_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } - if (!cast_param) { - ZEPHIR_INIT_VAR(&cast); - } else { - if (UNEXPECTED(Z_TYPE_P(cast_param) != IS_STRING && Z_TYPE_P(cast_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'cast' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(cast_param) == IS_STRING)) { - zephir_get_strval(&cast, cast_param); - } else { - ZEPHIR_INIT_VAR(&cast); - } - } - - ZEPHIR_OBS_VAR(&value); - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, &collection, index, 0)))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - if (UNEXPECTED(zephir_is_true(&cast))) { - ZEPHIR_MAKE_REF(&value); - ZEPHIR_CALL_FUNCTION(NULL, "settype", NULL, 12, &value, &cast); - ZEPHIR_UNREF(&value); + object_init_ex(return_value, phalcon_html_escaper_ce); + if (zephir_has_constructor(return_value)) { + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); zephir_check_call_status(); } - RETURN_CCTOR(&value); -} - -zend_object *zephir_init_properties_Phalcon_Storage_Adapter_AbstractAdapter(zend_class_entry *class_type) -{ - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + RETURN_MM(); } @@ -18849,24 +18808,13 @@ zend_object *zephir_init_properties_Phalcon_Storage_Adapter_AbstractAdapter(zend -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_AdapterInterface) +ZEPHIR_INIT_CLASS(Phalcon_Html_Exception) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Storage\\Adapter, AdapterInterface, phalcon, storage_adapter_adapterinterface, phalcon_storage_adapter_adapterinterface_method_entry); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html, Exception, phalcon, html_exception, zend_ce_exception, NULL, 0); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, clear); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, decrement); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, delete); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, get); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, getAdapter); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, getKeys); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, getPrefix); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, has); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, increment); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, set); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, setForever); @@ -18877,748 +18825,950 @@ ZEPHIR_DOC_METHOD(Phalcon_Storage_Adapter_AdapterInterface, setForever); -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_Apcu) +ZEPHIR_INIT_CLASS(Phalcon_Html_TagFactory) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Adapter, Apcu, phalcon, storage_adapter_apcu, phalcon_storage_adapter_abstractadapter_ce, phalcon_storage_adapter_apcu_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html, TagFactory, phalcon, html_tagfactory, phalcon_factory_abstractfactory_ce, phalcon_html_tagfactory_method_entry, 0); + + zend_declare_property_null(phalcon_html_tagfactory_ce, SL("escaper"), ZEND_ACC_PRIVATE); + zend_declare_property_null(phalcon_html_tagfactory_ce, SL("services"), ZEND_ACC_PROTECTED); + phalcon_html_tagfactory_ce->create_object = zephir_init_properties_Phalcon_Html_TagFactory; - zend_declare_property_string(phalcon_storage_adapter_apcu_ce, SL("prefix"), "ph-apcu-", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, __construct) +static PHP_METHOD(Phalcon_Html_TagFactory, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval options; - zval *factory, factory_sub, *options_param = NULL; + zval services; + zval *escaper, escaper_sub, *services_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&escaper_sub); + ZVAL_UNDEF(&services); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + Z_PARAM_OBJECT_OF_CLASS(escaper, phalcon_html_escaper_escaperinterface_ce) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_ARRAY(services) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 1, 1, &escaper, &services_param); + if (!services_param) { + ZEPHIR_INIT_VAR(&services); + array_init(&services); } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); } - ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_apcu_ce, getThis(), "__construct", &_0, 0, factory, &options); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initserializer", NULL, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("escaper"), escaper); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, clear) +static PHP_METHOD(Phalcon_Html_TagFactory, __call) { - zend_object_iterator *_1; - zend_bool result = 0; - zval item, pattern, apc, _0, _2$$4, _3$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval arguments, _0; + zval *name_param = NULL, *arguments_param = NULL, helper, _1; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&apc); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(&apc); - ZVAL_NULL(&apc); - zephir_read_property(&_0, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&pattern); - ZEPHIR_CONCAT_SVS(&pattern, "/^", &_0, "/"); - ZEPHIR_CALL_METHOD(&apc, this_ptr, "phpapcuiterator", NULL, 0, &pattern); - zephir_check_call_status(); - result = 1; - if (Z_TYPE_P(&apc) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - _1 = zephir_get_iterator(&apc); - _1->funcs->rewind(_1); - for (;_1->funcs->valid(_1) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1)) { - { - ZEPHIR_ITERATOR_COPY(&item, _1); - } - zephir_array_fetch_string(&_3$$4, &item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Apcu.zep", 63); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "phpapcudelete", &_4, 0, &_3$$4); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_2$$4)) { - result = 0; - } - } - zend_iterator_dtor(_1); - RETURN_MM_BOOL(result); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, decrement) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&helper); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } + zephir_fetch_params(1, 2, 0, &name_param, &arguments_param); + zephir_get_strval(&name, name_param); + zephir_get_arrval(&arguments, arguments_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getprefixedkey", NULL, 0, &key); + ZEPHIR_CALL_METHOD(&helper, this_ptr, "newinstance", NULL, 0, &name); zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "phpapcudec", NULL, 0, &_0, &_1); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + zephir_array_fast_append(&_0, &helper); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "__invoke"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_0, &arguments); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, delete) +static PHP_METHOD(Phalcon_Html_TagFactory, has) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1; - zval key; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_fetch_params(1, 1, 0, &name_param); + zephir_get_strval(&name, name_param); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpapcudelete", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM_BOOL(zephir_get_boolval(&_0)); + zephir_read_property(&_0, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); + RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, getKeys) +static PHP_METHOD(Phalcon_Html_TagFactory, newInstance) { - zend_object_iterator *_1; - zval results; + zval _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, item, pattern, apc, _0, _2$$4; - zval prefix; + zval *name_param = NULL, definition, _0, _4, _5, _1$$3, _3$$3; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&prefix); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&apc); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&definition); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&results); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(prefix) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &prefix_param); - if (!prefix_param) { - ZEPHIR_INIT_VAR(&prefix); - ZVAL_STRING(&prefix, ""); - } else { - if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(&prefix, prefix_param); - } else { - ZEPHIR_INIT_VAR(&prefix); - } - } + zephir_fetch_params(1, 1, 0, &name_param); + zephir_get_strval(&name, name_param); - ZEPHIR_INIT_VAR(&apc); - ZVAL_NULL(&apc); - zephir_read_property(&_0, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&pattern); - ZEPHIR_CONCAT_SVVS(&pattern, "/^", &_0, &prefix, "/"); - ZEPHIR_CALL_METHOD(&apc, this_ptr, "phpapcuiterator", NULL, 0, &pattern); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&results); - array_init(&results); - if (Z_TYPE_P(&apc) != IS_OBJECT) { - RETURN_CTOR(&results); - } - _1 = zephir_get_iterator(&apc); - _1->funcs->rewind(_1); - for (;_1->funcs->valid(_1) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1)) { - { - ZEPHIR_ITERATOR_COPY(&item, _1); - } - zephir_array_fetch_string(&_2$$4, &item, SL("key"), PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Apcu.zep", 117); - zephir_array_append(&results, &_2$$4, PH_SEPARATE, "phalcon/Storage/Adapter/Apcu.zep", 117); + zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset(&_0, &name))) { + ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1$$3); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_create_array(&_2$$3, 1, 0); + ZEPHIR_OBS_VAR(&_3$$3); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC); + zephir_array_fast_append(&_2$$3, &_3$$3); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&_1$$3, &definition, &_2$$3); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("services"), &name, &_1$$3); } - zend_iterator_dtor(_1); - RETURN_CTOR(&results); + zephir_read_property(&_4, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_5, &_4, &name, PH_NOISY | PH_READONLY, "phalcon/Html/TagFactory.zep", 176); + RETURN_CTOR(&_5); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, has) +static PHP_METHOD(Phalcon_Html_TagFactory, set) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, result, _0, _1; - zval key; + zval *name_param = NULL, *method, method_sub, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&method_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_ZVAL(method) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_fetch_params(1, 2, 0, &name_param, &method); + zephir_get_strval(&name, name_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, this_ptr, "phpapcuexists", NULL, 0, &_0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_1, &result); - } else { - ZVAL_BOOL(&_1, 0); - } - RETURN_CCTOR(&_1); + zephir_update_property_array(this_ptr, SL("mapper"), &name, method); + zephir_unset_property_array(this_ptr, ZEND_STRL("services"), &name); + zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_0, &name, PH_SEPARATE); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, increment) +static PHP_METHOD(Phalcon_Html_TagFactory, getExceptionClass) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "phpapcuinc", NULL, 0, &_0, &_1); - zephir_check_call_status(); - RETURN_MM(); + RETURN_STRING("Phalcon\\Html\\Exception"); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, set) +static PHP_METHOD(Phalcon_Html_TagFactory, getServices) { - zend_bool _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, result, _1, _2, _3, _4; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&ttl_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(ttl) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!ttl) { - ttl = &ttl_sub; - ttl = &__$null; - } - _0 = Z_TYPE_P(ttl) == IS_LONG; - if (_0) { - _0 = ZEPHIR_LT_LONG(ttl, 1); - } - if (_0) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "delete", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getttl", NULL, 0, ttl); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, this_ptr, "phpapcustore", NULL, 0, &_1, &_2, &_3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_4, &result); - } else { - ZVAL_BOOL(&_4, 0); + zephir_create_array(return_value, 41, 0); + add_assoc_stringl_ex(return_value, SL("a"), SL("Phalcon\\Html\\Helper\\Anchor")); + add_assoc_stringl_ex(return_value, SL("base"), SL("Phalcon\\Html\\Helper\\Base")); + add_assoc_stringl_ex(return_value, SL("body"), SL("Phalcon\\Html\\Helper\\Body")); + add_assoc_stringl_ex(return_value, SL("button"), SL("Phalcon\\Html\\Helper\\Button")); + add_assoc_stringl_ex(return_value, SL("close"), SL("Phalcon\\Html\\Helper\\Close")); + add_assoc_stringl_ex(return_value, SL("doctype"), SL("Phalcon\\Html\\Helper\\Doctype")); + add_assoc_stringl_ex(return_value, SL("element"), SL("Phalcon\\Html\\Helper\\Element")); + add_assoc_stringl_ex(return_value, SL("form"), SL("Phalcon\\Html\\Helper\\Form")); + add_assoc_stringl_ex(return_value, SL("img"), SL("Phalcon\\Html\\Helper\\Img")); + add_assoc_stringl_ex(return_value, SL("inputCheckbox"), SL("Phalcon\\Html\\Helper\\Input\\Checkbox")); + add_assoc_stringl_ex(return_value, SL("inputColor"), SL("Phalcon\\Html\\Helper\\Input\\Color")); + add_assoc_stringl_ex(return_value, SL("inputDate"), SL("Phalcon\\Html\\Helper\\Input\\Date")); + add_assoc_stringl_ex(return_value, SL("inputDateTime"), SL("Phalcon\\Html\\Helper\\Input\\DateTime")); + add_assoc_stringl_ex(return_value, SL("inputDateTimeLocal"), SL("Phalcon\\Html\\Helper\\Input\\DateTimeLocal")); + add_assoc_stringl_ex(return_value, SL("inputEmail"), SL("Phalcon\\Html\\Helper\\Input\\Email")); + add_assoc_stringl_ex(return_value, SL("inputFile"), SL("Phalcon\\Html\\Helper\\Input\\File")); + add_assoc_stringl_ex(return_value, SL("inputHidden"), SL("Phalcon\\Html\\Helper\\Input\\Hidden")); + add_assoc_stringl_ex(return_value, SL("inputImage"), SL("Phalcon\\Html\\Helper\\Input\\Image")); + add_assoc_stringl_ex(return_value, SL("inputInput"), SL("Phalcon\\Html\\Helper\\Input\\Input")); + add_assoc_stringl_ex(return_value, SL("inputMonth"), SL("Phalcon\\Html\\Helper\\Input\\Month")); + add_assoc_stringl_ex(return_value, SL("inputNumeric"), SL("Phalcon\\Html\\Helper\\Input\\Numeric")); + add_assoc_stringl_ex(return_value, SL("inputPassword"), SL("Phalcon\\Html\\Helper\\Input\\Password")); + add_assoc_stringl_ex(return_value, SL("inputRadio"), SL("Phalcon\\Html\\Helper\\Input\\Radio")); + add_assoc_stringl_ex(return_value, SL("inputRange"), SL("Phalcon\\Html\\Helper\\Input\\Range")); + add_assoc_stringl_ex(return_value, SL("inputSearch"), SL("Phalcon\\Html\\Helper\\Input\\Search")); + add_assoc_stringl_ex(return_value, SL("inputSelect"), SL("Phalcon\\Html\\Helper\\Input\\Select")); + add_assoc_stringl_ex(return_value, SL("inputSubmit"), SL("Phalcon\\Html\\Helper\\Input\\Submit")); + add_assoc_stringl_ex(return_value, SL("inputTel"), SL("Phalcon\\Html\\Helper\\Input\\Tel")); + add_assoc_stringl_ex(return_value, SL("inputText"), SL("Phalcon\\Html\\Helper\\Input\\Text")); + add_assoc_stringl_ex(return_value, SL("inputTextarea"), SL("Phalcon\\Html\\Helper\\Input\\Textarea")); + add_assoc_stringl_ex(return_value, SL("inputTime"), SL("Phalcon\\Html\\Helper\\Input\\Time")); + add_assoc_stringl_ex(return_value, SL("inputUrl"), SL("Phalcon\\Html\\Helper\\Input\\Url")); + add_assoc_stringl_ex(return_value, SL("inputWeek"), SL("Phalcon\\Html\\Helper\\Input\\Week")); + add_assoc_stringl_ex(return_value, SL("label"), SL("Phalcon\\Html\\Helper\\Label")); + add_assoc_stringl_ex(return_value, SL("link"), SL("Phalcon\\Html\\Helper\\Link")); + add_assoc_stringl_ex(return_value, SL("meta"), SL("Phalcon\\Html\\Helper\\Meta")); + add_assoc_stringl_ex(return_value, SL("ol"), SL("Phalcon\\Html\\Helper\\Ol")); + add_assoc_stringl_ex(return_value, SL("script"), SL("Phalcon\\Html\\Helper\\Script")); + add_assoc_stringl_ex(return_value, SL("style"), SL("Phalcon\\Html\\Helper\\Style")); + add_assoc_stringl_ex(return_value, SL("title"), SL("Phalcon\\Html\\Helper\\Title")); + add_assoc_stringl_ex(return_value, SL("ul"), SL("Phalcon\\Html\\Helper\\Ul")); + return; +} + +zend_object *zephir_init_properties_Phalcon_Html_TagFactory(zend_class_entry *class_type) +{ + zval _0, _2, _1$$3, _3$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("mapper"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("mapper"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("services"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - RETURN_CCTOR(&_4); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, setForever) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Attributes_AttributesInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Attributes, AttributesInterface, phalcon, html_attributes_attributesinterface, phalcon_html_attributes_attributesinterface_method_entry); + + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Html_Attributes_AttributesInterface, getAttributes); +ZEPHIR_DOC_METHOD(Phalcon_Html_Attributes_AttributesInterface, setAttributes); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Attributes_RenderInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Attributes, RenderInterface, phalcon, html_attributes_renderinterface, phalcon_html_attributes_renderinterface_method_entry); + + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Html_Attributes_RenderInterface, render); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Escaper_EscaperInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Escaper, EscaperInterface, phalcon, html_escaper_escaperinterface, phalcon_html_escaper_escaperinterface_method_entry); + + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, attributes); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, css); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, getEncoding); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, html); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, js); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, setEncoding); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, setFlags); +ZEPHIR_DOC_METHOD(Phalcon_Html_Escaper_EscaperInterface, url); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Escaper_Exception) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Escaper, Exception, phalcon, html_escaper_exception, zend_ce_exception, NULL, 0); + + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_AbstractHelper) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Html\\Helper, AbstractHelper, phalcon, html_helper_abstracthelper, phalcon_html_helper_abstracthelper_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_string(phalcon_html_helper_abstracthelper_ce, SL("delimiter"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_helper_abstracthelper_ce, SL("escaper"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_abstracthelper_ce, SL("indent"), " ", ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_html_helper_abstracthelper_ce, SL("indentLevel"), 1, ZEND_ACC_PROTECTED); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *escaper, escaper_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&escaper_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(escaper, phalcon_html_escaper_escaperinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &escaper); + + + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_GET_CONSTANT(&_0, "PHP_EOL"); + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("escaper"), escaper); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, close) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, result, _0, _1, _2; - zval key; + zend_bool raw; + zval *tag_param = NULL, *raw_param = NULL, _0, _1; + zval tag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&tag); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(tag) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &tag_param, &raw_param); + zephir_get_strval(&tag, tag_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&key); + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, this_ptr, "phpapcustore", NULL, 0, &_0, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - if ((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE)) { - ZEPHIR_CPY_WRT(&_2, &result); + ZEPHIR_INIT_VAR(&_0); + if (raw) { + ZEPHIR_CPY_WRT(&_0, &tag); } else { - ZVAL_BOOL(&_2, 0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_0, &_1, "html", NULL, 0, &tag); + zephir_check_call_status(); } - RETURN_CCTOR(&_2); + zephir_get_strval(&tag, &_0); + ZEPHIR_CONCAT_SVS(return_value, ""); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, doGet) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, indent) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "phpapcufetch", NULL, 0, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("indent"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("indentLevel"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 1, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuDec) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, orderAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long step, ttl, ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub, *step_param = NULL, *success = NULL, success_sub, *ttl_param = NULL, __$null, _0, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *overrides_param = NULL, *attributes_param = NULL, __$null, intersect, results, _0; + zval overrides, attributes, order; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); - ZVAL_UNDEF(&success_sub); + ZVAL_UNDEF(&overrides); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&order); ZVAL_NULL(&__$null); + ZVAL_UNDEF(&intersect); + ZVAL_UNDEF(&results); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_ZVAL(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(step) - Z_PARAM_ZVAL_OR_NULL(success) - Z_PARAM_LONG(ttl) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ARRAY(overrides) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &key, &step_param, &success, &ttl_param); - if (!step_param) { - step = 1; - } else { - step = zephir_get_intval(step_param); - } - if (!success) { - success = &success_sub; - success = &__$null; - } - if (!ttl_param) { - ttl = 0; - } else { - ttl = zephir_get_intval(ttl_param); - } + zephir_fetch_params(1, 2, 0, &overrides_param, &attributes_param); + zephir_get_arrval(&overrides, overrides_param); + zephir_get_arrval(&attributes, attributes_param); - ZVAL_LONG(&_0, step); - ZVAL_LONG(&_1, ttl); - ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_dec", NULL, 99, key, &_0, success, &_1); - ZEPHIR_UNREF(success); + ZEPHIR_INIT_VAR(&order); + zephir_create_array(&order, 10, 0); + zephir_array_update_string(&order, SL("rel"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("type"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("for"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("src"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("href"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("action"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("id"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("name"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("value"), &__$null, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&order, SL("class"), &__$null, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect_key", NULL, 2, &order, &attributes); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&results); + zephir_fast_array_merge(&results, &intersect, &attributes); + ZEPHIR_INIT_VAR(&_0); + zephir_fast_array_merge(&_0, &overrides, &results); + ZEPHIR_CPY_WRT(&results, &_0); + zephir_array_unset_string(&results, SL("escape"), PH_SEPARATE); + RETURN_CCTOR(&results); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuDelete) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, renderArrayElements) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub; + zval delimiter; + zval *elements_param = NULL, *delimiter_param = NULL, item, result, *_0, _1, _2$$3, _3$$3, _5$$3, _6$$3, _7$$3, _8$$4, _9$$4, _11$$4, _12$$4, _13$$4; + zval elements, _4$$3, _10$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); + ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&item); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_11$$4); + ZVAL_UNDEF(&_12$$4); + ZVAL_UNDEF(&_13$$4); + ZVAL_UNDEF(&delimiter); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(key) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ARRAY(elements) + Z_PARAM_STR(delimiter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key); + zephir_fetch_params(1, 2, 0, &elements_param, &delimiter_param); + zephir_get_arrval(&elements, elements_param); + zephir_get_strval(&delimiter, delimiter_param); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_delete", NULL, 100, key); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&result); + ZVAL_STRING(&result, ""); + zephir_is_iterable(&elements, 0, "phalcon/Html/Helper/AbstractHelper.zep", 140); + if (Z_TYPE_P(&elements) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&elements), _0) + { + ZEPHIR_INIT_NVAR(&item); + ZVAL_COPY(&item, _0); + zephir_array_fetch_long(&_2$$3, &item, 2, PH_NOISY | PH_READONLY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + ZEPHIR_INIT_NVAR(&_3$$3); + ZEPHIR_INIT_NVAR(&_4$$3); + zephir_create_array(&_4$$3, 2, 0); + zephir_array_fast_append(&_4$$3, this_ptr); + ZEPHIR_OBS_NVAR(&_5$$3); + zephir_array_fetch_long(&_5$$3, &item, 0, PH_NOISY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + zephir_array_fast_append(&_4$$3, &_5$$3); + zephir_array_fetch_long(&_6$$3, &item, 1, PH_NOISY | PH_READONLY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_3$$3, &_4$$3, &_6$$3); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_7$$3); + ZEPHIR_CONCAT_VVV(&_7$$3, &_2$$3, &_3$$3, &delimiter); + zephir_concat_self(&result, &_7$$3); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &elements, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &elements, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&item, &elements, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_fetch_long(&_8$$4, &item, 2, PH_NOISY | PH_READONLY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_INIT_NVAR(&_10$$4); + zephir_create_array(&_10$$4, 2, 0); + zephir_array_fast_append(&_10$$4, this_ptr); + ZEPHIR_OBS_NVAR(&_11$$4); + zephir_array_fetch_long(&_11$$4, &item, 0, PH_NOISY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + zephir_array_fast_append(&_10$$4, &_11$$4); + zephir_array_fetch_long(&_12$$4, &item, 1, PH_NOISY | PH_READONLY, "phalcon/Html/Helper/AbstractHelper.zep", 136); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_9$$4, &_10$$4, &_12$$4); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_13$$4); + ZEPHIR_CONCAT_VVV(&_13$$4, &_8$$4, &_9$$4, &delimiter); + zephir_concat_self(&result, &_13$$4); + ZEPHIR_CALL_METHOD(NULL, &elements, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&item); + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuExists) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, renderAttributes) { + zend_bool _4$$3, _8$$5; + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub; + zval *attributes_param = NULL, key, result, value, *_0, _1, _5$$4, _6$$4, _7$$4, _9$$6, _10$$6, _11$$6; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(key) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key); + zephir_fetch_params(1, 1, 0, &attributes_param); + zephir_get_arrval(&attributes, attributes_param); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_exists", NULL, 101, key); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&result); + ZVAL_STRING(&result, ""); + zephir_is_iterable(&attributes, 0, "phalcon/Html/Helper/AbstractHelper.zep", 161); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&attributes), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + _4$$3 = Z_TYPE_P(&key) == IS_STRING; + if (_4$$3) { + _4$$3 = Z_TYPE_P(&value) != IS_NULL; + } + if (_4$$3) { + zephir_read_property(&_5$$4, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_6$$4, &_5$$4, "attributes", NULL, 0, &value); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_7$$4); + ZEPHIR_CONCAT_VSVS(&_7$$4, &key, "=\"", &_6$$4, "\" "); + zephir_concat_self(&result, &_7$$4); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &attributes, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &attributes, "current", NULL, 0); + zephir_check_call_status(); + _8$$5 = Z_TYPE_P(&key) == IS_STRING; + if (_8$$5) { + _8$$5 = Z_TYPE_P(&value) != IS_NULL; + } + if (_8$$5) { + zephir_read_property(&_9$$6, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_10$$6, &_9$$6, "attributes", NULL, 0, &value); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_11$$6); + ZEPHIR_CONCAT_VSVS(&_11$$6, &key, "=\"", &_10$$6, "\" "); + zephir_concat_self(&result, &_11$$6); + } + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuInc) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, renderElement) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long step, ttl, ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub, *step_param = NULL, *success = NULL, success_sub, *ttl_param = NULL, __$null, _0, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval attributes; + zval *tag_param = NULL, *attributes_param = NULL; + zval tag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); - ZVAL_UNDEF(&success_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&tag); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_ZVAL(key) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(tag) Z_PARAM_OPTIONAL - Z_PARAM_LONG(step) - Z_PARAM_ZVAL_OR_NULL(success) - Z_PARAM_LONG(ttl) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &key, &step_param, &success, &ttl_param); - if (!step_param) { - step = 1; - } else { - step = zephir_get_intval(step_param); - } - if (!success) { - success = &success_sub; - success = &__$null; - } - if (!ttl_param) { - ttl = 0; + zephir_fetch_params(1, 1, 1, &tag_param, &attributes_param); + zephir_get_strval(&tag, tag_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ttl = zephir_get_intval(ttl_param); + zephir_get_arrval(&attributes, attributes_param); } - ZVAL_LONG(&_0, step); - ZVAL_LONG(&_1, ttl); - ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_inc", NULL, 102, key, &_0, success, &_1); - ZEPHIR_UNREF(success); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rendertag", NULL, 0, &tag, &attributes); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuFetch) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, renderFullElement) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub, *success = NULL, success_sub, __$null; + zend_bool raw; + zval attributes; + zval *tag_param = NULL, *text_param = NULL, *attributes_param = NULL, *raw_param = NULL, content, _0, _1, _2, _3; + zval tag, text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); - ZVAL_UNDEF(&success_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&tag); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&content); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(key) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(tag) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(success) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key, &success); - if (!success) { - success = &success_sub; - success = &__$null; + zephir_fetch_params(1, 2, 2, &tag_param, &text_param, &attributes_param, &raw_param); + zephir_get_strval(&tag, tag_param); + zephir_get_strval(&text, text_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } + if (!raw_param) { + raw = 0; + } else { + raw = zephir_get_boolval(raw_param); } - ZEPHIR_MAKE_REF(success); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 103, key, success); - ZEPHIR_UNREF(success); + if (raw) { + ZEPHIR_CPY_WRT(&content, &text); + } else { + zephir_read_property(&_0, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&content, &_0, "html", NULL, 0, &text); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "renderelement", NULL, 0, &tag, &attributes); zephir_check_call_status(); + if (raw) { + ZVAL_BOOL(&_3, 1); + } else { + ZVAL_BOOL(&_3, 0); + } + ZEPHIR_CALL_METHOD(&_2, this_ptr, "close", NULL, 0, &tag, &_3); + zephir_check_call_status(); + ZEPHIR_CONCAT_VVV(return_value, &_1, &content, &_2); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuIterator) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, renderTag) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL; - zval pattern; + zval attributes; + zval *tag_param = NULL, *attributes_param = NULL, close, *close_param = NULL, attrs, escapedAttrs, _3, _4, _5, _0$$3, _1$$3, _2$$3; + zval tag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&tag); + ZVAL_UNDEF(&close); + ZVAL_UNDEF(&attrs); + ZVAL_UNDEF(&escapedAttrs); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(pattern) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(tag) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) + Z_PARAM_STR(close) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - zephir_get_strval(&pattern, pattern_param); + zephir_fetch_params(1, 1, 2, &tag_param, &attributes_param, &close_param); + zephir_get_strval(&tag, tag_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } + if (!close_param) { + ZEPHIR_INIT_VAR(&close); + ZVAL_STRING(&close, ""); + } else { + zephir_get_strval(&close, close_param); + } - object_init_ex(return_value, zephir_get_internal_ce(SL("apcuiterator"))); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, &pattern); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&escapedAttrs); + ZVAL_STRING(&escapedAttrs, ""); + if (1 != ZEPHIR_IS_EMPTY(&attributes)) { + ZEPHIR_INIT_VAR(&_0$$3); + array_init(&_0$$3); + ZEPHIR_CALL_METHOD(&attrs, this_ptr, "orderattributes", NULL, 0, &_0$$3, &attributes); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1$$3); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "renderattributes", NULL, 0, &attrs); + zephir_check_call_status(); + zephir_fast_trim(&_1$$3, &_2$$3, NULL , ZEPHIR_TRIM_RIGHT); + ZEPHIR_INIT_NVAR(&escapedAttrs); + ZEPHIR_CONCAT_SV(&escapedAttrs, " ", &_1$$3); + } + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_INIT_VAR(&_4); + zephir_fast_trim(&_4, &close, NULL , ZEPHIR_TRIM_BOTH); + if (ZEPHIR_IS_EMPTY(&_4)) { + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, ""); + } else { + ZEPHIR_INIT_VAR(&_5); + zephir_fast_trim(&_5, &close, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&_3); + ZEPHIR_CONCAT_SV(&_3, " ", &_5); + } + ZEPHIR_CPY_WRT(&close, &_3); + ZEPHIR_CONCAT_SVVVS(return_value, "<", &tag, &escapedAttrs, &close, ">"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuStore) +static PHP_METHOD(Phalcon_Html_Helper_AbstractHelper, selfClose) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ttl, ZEPHIR_LAST_CALL_STATUS; - zval *key, key_sub, *payload, payload_sub, *ttl_param = NULL, _0; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval attributes; + zval *tag_param = NULL, *attributes_param = NULL, _0; + zval tag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key_sub); - ZVAL_UNDEF(&payload_sub); + ZVAL_UNDEF(&tag); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_ZVAL(key) - Z_PARAM_ZVAL(payload) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(tag) Z_PARAM_OPTIONAL - Z_PARAM_LONG(ttl) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key, &payload, &ttl_param); - if (!ttl_param) { - ttl = 0; + zephir_fetch_params(1, 1, 1, &tag_param, &attributes_param); + zephir_get_strval(&tag, tag_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ttl = zephir_get_intval(ttl_param); + zephir_get_arrval(&attributes, attributes_param); } - ZVAL_LONG(&_0, ttl); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 104, key, payload, &_0); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "/"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rendertag", NULL, 0, &tag, &attributes, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -19633,672 +19783,647 @@ static PHP_METHOD(Phalcon_Storage_Adapter_Apcu, phpApcuStore) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_Libmemcached) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_AbstractList) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Adapter, Libmemcached, phalcon, storage_adapter_libmemcached, phalcon_storage_adapter_abstractadapter_ce, phalcon_storage_adapter_libmemcached_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, AbstractList, phalcon, html_helper_abstractlist, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_abstractlist_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_html_helper_abstractlist_ce, SL("attributes"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_abstractlist_ce, SL("elementTag"), "li", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_helper_abstractlist_ce, SL("store"), ZEND_ACC_PROTECTED); + phalcon_html_helper_abstractlist_ce->create_object = zephir_init_properties_Phalcon_Html_Helper_AbstractList; - zend_declare_property_string(phalcon_storage_adapter_libmemcached_ce, SL("prefix"), "ph-memc-", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, __construct) +static PHP_METHOD(Phalcon_Html_Helper_AbstractList, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_2 = NULL; - zval options, _0$$3, _1$$3; - zval *factory, factory_sub, *options_param = NULL; + zval attributes; + zval *indent_param = NULL, *delimiter_param = NULL, *attributes_param = NULL, _0, _1; + zval indent, delimiter; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&indent); + ZVAL_UNDEF(&delimiter); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + ZEND_PARSE_PARAMETERS_START(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_STR(indent) + Z_PARAM_STR_OR_NULL(delimiter) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 0, 3, &indent_param, &delimiter_param, &attributes_param); + if (!indent_param) { + ZEPHIR_INIT_VAR(&indent); + ZVAL_STRING(&indent, " "); } else { - zephir_get_arrval(&options, options_param); + zephir_get_strval(&indent, indent_param); + } + if (!delimiter_param) { + ZEPHIR_INIT_VAR(&delimiter); + } else { + zephir_get_strval(&delimiter, delimiter_param); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); } - if (!(zephir_array_isset_string(&options, SL("servers")))) { - ZEPHIR_INIT_VAR(&_0$$3); - zephir_create_array(&_0$$3, 1, 0); - ZEPHIR_INIT_VAR(&_1$$3); - zephir_create_array(&_1$$3, 3, 0); - add_assoc_stringl_ex(&_1$$3, SL("host"), SL("127.0.0.1")); - add_assoc_long_ex(&_1$$3, SL("port"), 11211); - add_assoc_long_ex(&_1$$3, SL("weight"), 1); - zephir_array_update_long(&_0$$3, 0, &_1$$3, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); - zephir_array_update_string(&options, SL("servers"), &_0$$3, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &attributes); + ZEPHIR_INIT_VAR(&_0); + if (ZEPHIR_IS_EMPTY(&delimiter)) { + ZEPHIR_INIT_NVAR(&_0); + ZEPHIR_GET_CONSTANT(&_0, "PHP_EOL"); + } else { + ZEPHIR_CPY_WRT(&_0, &delimiter); } - ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_libmemcached_ce, getThis(), "__construct", &_2, 0, factory, &options); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("indent"), &indent); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("store"), &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, clear) +static PHP_METHOD(Phalcon_Html_Helper_AbstractList, __toString) { - zval _0; + zval contents, _0, _1, _2, _3, _4, _5, _6, _7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&contents); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_EMPTY(&_0)) { + RETURN_MM_STRING(""); + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_4, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "renderarrayelements", NULL, 0, &_3, &_4); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_0, "flush", NULL, 0); + ZEPHIR_INIT_VAR(&contents); + ZEPHIR_CONCAT_VV(&contents, &_1, &_2); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "gettag", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_6, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZVAL_BOOL(&_7, 1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &_5, &contents, &_6, &_7); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, decrement) +static PHP_METHOD(Phalcon_Html_Helper_AbstractList, getTag) +{ +} + +zend_object *zephir_init_properties_Phalcon_Html_Helper_AbstractList(zend_class_entry *class_type) { + zval _0, _2, _1$$3, _3$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; - zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) - ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("attributes"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(&_0, "decrement", NULL, 0, &key, &_1); - zephir_check_call_status(); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_AbstractSeries) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, AbstractSeries, phalcon, html_helper_abstractseries, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_abstractseries_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_html_helper_abstractseries_ce, SL("attributes"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_helper_abstractseries_ce, SL("store"), ZEND_ACC_PROTECTED); + phalcon_html_helper_abstractseries_ce->create_object = zephir_init_properties_Phalcon_Html_Helper_AbstractSeries; + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, delete) +static PHP_METHOD(Phalcon_Html_Helper_AbstractSeries, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1; - zval key; + zval *indent_param = NULL, *delimiter_param = NULL, _0, _1; + zval indent, delimiter; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&indent); + ZVAL_UNDEF(&delimiter); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_STR(indent) + Z_PARAM_STR_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 0, 2, &indent_param, &delimiter_param); + if (!indent_param) { + ZEPHIR_INIT_VAR(&indent); + ZVAL_STRING(&indent, " "); + } else { + zephir_get_strval(&indent, indent_param); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (!delimiter_param) { + ZEPHIR_INIT_VAR(&delimiter); } else { - ZEPHIR_INIT_VAR(&key); + zephir_get_strval(&delimiter, delimiter_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_1, 0); - ZEPHIR_RETURN_CALL_METHOD(&_0, "delete", NULL, 0, &key, &_1); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + if (Z_TYPE_P(&delimiter) == IS_NULL) { + ZEPHIR_INIT_NVAR(&_0); + ZEPHIR_GET_CONSTANT(&_0, "PHP_EOL"); + } else { + ZEPHIR_CPY_WRT(&_0, &delimiter); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("indent"), &indent); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("store"), &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, getAdapter) +static PHP_METHOD(Phalcon_Html_Helper_AbstractSeries, __toString) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, client, connection, failover, options, persistentId, sasl, saslUser, saslPass, serverList, servers, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$4, _6$$4, _7$$4, _8$$4, _9$$4, _10$$4; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&client); - ZVAL_UNDEF(&connection); - ZVAL_UNDEF(&failover); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&persistentId); - ZVAL_UNDEF(&sasl); - ZVAL_UNDEF(&saslUser); - ZVAL_UNDEF(&saslPass); - ZVAL_UNDEF(&serverList); - ZVAL_UNDEF(&servers); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_is_true(&_0))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&options, &_1$$3); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "persistentId"); - ZEPHIR_INIT_VAR(&_3$$3); - ZVAL_STRING(&_3$$3, "ph-mcid-"); - ZEPHIR_CALL_METHOD(&persistentId, this_ptr, "getarrval", NULL, 0, &options, &_2$$3, &_3$$3); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_2$$3); - array_init(&_2$$3); - ZEPHIR_INIT_NVAR(&_3$$3); - ZVAL_STRING(&_3$$3, "saslAuthData"); - ZEPHIR_CALL_METHOD(&sasl, this_ptr, "getarrval", NULL, 0, &options, &_3$$3, &_2$$3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&connection); - object_init_ex(&connection, zephir_get_internal_ce(SL("memcached"))); - ZEPHIR_CALL_METHOD(NULL, &connection, "__construct", NULL, 0, &persistentId); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&serverList, &connection, "getserverlist", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_4$$3, -1002); - ZEPHIR_CALL_METHOD(NULL, &connection, "setoption", NULL, 0, &_4$$3, &_1$$3); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(&serverList)) { - ZEPHIR_INIT_VAR(&_5$$4); - array_init(&_5$$4); - ZEPHIR_INIT_VAR(&_6$$4); - ZVAL_STRING(&_6$$4, "servers"); - ZEPHIR_CALL_METHOD(&servers, this_ptr, "getarrval", NULL, 0, &options, &_6$$4, &_5$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6$$4); - array_init(&_6$$4); - ZEPHIR_INIT_VAR(&_7$$4); - ZVAL_STRING(&_7$$4, "client"); - ZEPHIR_CALL_METHOD(&client, this_ptr, "getarrval", NULL, 0, &options, &_7$$4, &_6$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_7$$4); - ZVAL_STRING(&_7$$4, "user"); - ZEPHIR_INIT_VAR(&_8$$4); - ZVAL_STRING(&_8$$4, ""); - ZEPHIR_CALL_METHOD(&saslUser, this_ptr, "getarrval", NULL, 0, &sasl, &_7$$4, &_8$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_7$$4); - ZVAL_STRING(&_7$$4, "pass"); - ZEPHIR_INIT_NVAR(&_8$$4); - ZVAL_STRING(&_8$$4, ""); - ZEPHIR_CALL_METHOD(&saslPass, this_ptr, "getarrval", NULL, 0, &sasl, &_7$$4, &_8$$4); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&failover); - zephir_create_array(&failover, 5, 0); - add_index_long(&failover, 14, 10); - add_index_long(&failover, 9, 1); - add_index_long(&failover, 21, 2); - zephir_array_update_long(&failover, 35, &__$true, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); - add_index_long(&failover, 15, 1); - ZEPHIR_INIT_NVAR(&_7$$4); - zephir_fast_array_merge(&_7$$4, &failover, &client); - ZEPHIR_CPY_WRT(&client, &_7$$4); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "setoptions", NULL, 105, &connection, &client); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10$$4, &_9$$4, "setservers", NULL, 106, &connection, &servers); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_10$$4, "setsasl", NULL, 107, &connection, &saslUser, &saslPass); - zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderarrayelements", NULL, 0, &_0, &_1); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Html_Helper_AbstractSeries, getTag) +{ +} + +zend_object *zephir_init_properties_Phalcon_Html_Helper_AbstractSeries(zend_class_entry *class_type) +{ + zval _0, _2, _1$$3, _3$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 108, &connection); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), &connection); + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("attributes"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - RETURN_MM_MEMBER(getThis(), "adapter"); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, getKeys) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Anchor) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Anchor, phalcon, html_helper_anchor, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_anchor_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Anchor, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, _0, _1; - zval prefix; + zend_bool raw; + zval attributes; + zval *href_param = NULL, *text_param = NULL, *attributes_param = NULL, *raw_param = NULL, overrides, _0, _1; + zval href, text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&href); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&overrides); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(href) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_STR(prefix) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &prefix_param); - if (!prefix_param) { - ZEPHIR_INIT_VAR(&prefix); - ZVAL_STRING(&prefix, ""); + zephir_fetch_params(1, 2, 2, &href_param, &text_param, &attributes_param, &raw_param); + zephir_get_strval(&href, href_param); + zephir_get_strval(&text, text_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); - RETURN_MM_NULL(); + zephir_get_arrval(&attributes, attributes_param); } - if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(&prefix, prefix_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&prefix); - } + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, &_0, "getallkeys", NULL, 0); + ZEPHIR_CALL_METHOD(&overrides, this_ptr, "processattributes", NULL, 0, &href, &attributes); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getfilteredkeys", NULL, 0, &_1, &prefix); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "a"); + if (raw) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &_0, &text, &overrides, &_1); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, has) +static PHP_METHOD(Phalcon_Html_Helper_Anchor, processAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, connection, result, _0; - zval key; + zval attributes; + zval *href_param = NULL, *attributes_param = NULL, overrides; + zval href; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&connection); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&href); + ZVAL_UNDEF(&overrides); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(href) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_fetch_params(1, 2, 0, &href_param, &attributes_param); + zephir_get_strval(&href, href_param); + zephir_get_arrval(&attributes, attributes_param); - ZEPHIR_CALL_METHOD(&connection, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, &connection, "get", NULL, 0, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, &connection, "getresultcode", NULL, 0); - zephir_check_call_status(); - RETURN_MM_BOOL(!ZEPHIR_IS_LONG_IDENTICAL(&_0, 16)); + ZEPHIR_INIT_VAR(&overrides); + zephir_create_array(&overrides, 1, 0); + zephir_array_update_string(&overrides, SL("href"), &href, PH_COPY | PH_SEPARATE); + zephir_array_unset_string(&attributes, SL("href"), PH_SEPARATE); + zephir_fast_array_merge(return_value, &overrides, &attributes); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, increment) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(&_0, "increment", NULL, 0, &key, &_1); - zephir_check_call_status(); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Base) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Base, phalcon, html_helper_base, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_base_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, set) +static PHP_METHOD(Phalcon_Html_Helper_Base, __invoke) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, result, _1, _2, _3, _4; - zval key; + zval attributes; + zval *href_param = NULL, *attributes_param = NULL, overrides, _1, _0$$3; + zval href; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&ttl_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&href); + ZVAL_UNDEF(&overrides); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(ttl) + Z_PARAM_STR_OR_NULL(href) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); - zephir_get_strval(&key, key_param); - if (!ttl) { - ttl = &ttl_sub; - ttl = &__$null; + zephir_fetch_params(1, 0, 2, &href_param, &attributes_param); + if (!href_param) { + ZEPHIR_INIT_VAR(&href); + } else { + zephir_get_strval(&href, href_param); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); } - _0 = Z_TYPE_P(ttl) == IS_LONG; - if (_0) { - _0 = ZEPHIR_LT_LONG(ttl, 1); - } - if (_0) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "delete", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&overrides); + array_init(&overrides); + if (!(ZEPHIR_IS_EMPTY(&href))) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_create_array(&_0$$3, 1, 0); + zephir_array_update_string(&_0$$3, SL("href"), &href, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&overrides, &_0$$3); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getttl", NULL, 0, ttl); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, &_1, "set", NULL, 0, &key, &_2, &_3); + zephir_array_unset_string(&attributes, SL("href"), PH_SEPARATE); + ZEPHIR_INIT_VAR(&_1); + zephir_fast_array_merge(&_1, &overrides, &attributes); + ZEPHIR_CPY_WRT(&overrides, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "base"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderelement", NULL, 0, &_1, &overrides); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_4, &result); - } else { - ZVAL_BOOL(&_4, 0); - } - RETURN_CCTOR(&_4); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setForever) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, result, _0, _1, _2, _3; - zval key; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - zephir_get_strval(&key, key_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - ZVAL_LONG(&_2, 0); - ZEPHIR_CALL_METHOD(&result, &_0, "set", NULL, 0, &key, &_1, &_2); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_3, &result); - } else { - ZVAL_BOOL(&_3, 0); - } - RETURN_CCTOR(&_3); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Body) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Body, phalcon, html_helper_body, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_body_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setOptions) +static PHP_METHOD(Phalcon_Html_Helper_Body, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval client; - zval *connection, connection_sub, *client_param = NULL, _0; + zval *attributes_param = NULL, _0; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&attributes); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&client); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("memcached"))) - Z_PARAM_ARRAY(client) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &client_param); - zephir_get_arrval(&client, client_param); + zephir_fetch_params(1, 0, 1, &attributes_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } - ZEPHIR_CALL_METHOD(&_0, connection, "setoptions", NULL, 0, &client); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "body"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderelement", NULL, 0, &_0, &attributes); zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "Cannot set Memcached client options", "phalcon/Storage/Adapter/Libmemcached.zep", 253); - return; - } - RETURN_THIS(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setSasl) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval saslUser, saslPass; - zval *connection, connection_sub, *saslUser_param = NULL, *saslPass_param = NULL; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&saslUser); - ZVAL_UNDEF(&saslPass); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("memcached"))) - Z_PARAM_STR(saslUser) - Z_PARAM_STR(saslPass) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &connection, &saslUser_param, &saslPass_param); - zephir_get_strval(&saslUser, saslUser_param); - zephir_get_strval(&saslPass, saslPass_param); - if (1 != ZEPHIR_IS_EMPTY(&saslUser)) { - ZEPHIR_CALL_METHOD(NULL, connection, "setsaslauthdata", NULL, 0, &saslUser, &saslPass); - zephir_check_call_status(); - } - RETURN_THIS(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Button) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Button, phalcon, html_helper_button, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_button_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setSerializer) +static PHP_METHOD(Phalcon_Html_Helper_Button, __invoke) { - zval map; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, serializer, _0, _1$$3, _2$$3, _3$$3; + zend_bool raw; + zval attributes; + zval *text_param = NULL, *attributes_param = NULL, *raw_param = NULL, _0, _1; + zval text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&serializer); + ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&map); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("memcached"))) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(text) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); + zephir_fetch_params(1, 1, 2, &text_param, &attributes_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } + if (!raw_param) { + raw = 0; + } else { + raw = zephir_get_boolval(raw_param); + } - ZEPHIR_INIT_VAR(&map); - zephir_create_array(&map, 3, 0); - add_assoc_long_ex(&map, SL("memcached_igbinary"), 2); - add_assoc_long_ex(&map, SL("memcached_json"), 3); - add_assoc_long_ex(&map, SL("memcached_php"), 1); - zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultSerializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&serializer); - zephir_fast_strtolower(&serializer, &_0); - if (zephir_array_isset(&map, &serializer)) { - ZEPHIR_INIT_VAR(&_1$$3); - ZEPHIR_INIT_NVAR(&_1$$3); - ZVAL_STRING(&_1$$3, ""); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultSerializer"), &_1$$3); - zephir_array_fetch(&_2$$3, &map, &serializer, PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Libmemcached.zep", 299); - ZVAL_LONG(&_3$$3, -1003); - ZEPHIR_CALL_METHOD(NULL, connection, "setoption", NULL, 0, &_3$$3, &_2$$3); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "button"); + if (raw) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initserializer", NULL, 0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &_0, &text, &attributes, &_1); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setServers) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Close) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Close, phalcon, html_helper_close, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_close_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Close, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval servers; - zval *connection, connection_sub, *servers_param = NULL, _0; + zend_bool raw; + zval *tag_param = NULL, *raw_param = NULL, _0; + zval tag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&tag); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&servers); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("memcached"))) - Z_PARAM_ARRAY(servers) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(tag) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &servers_param); - zephir_get_arrval(&servers, servers_param); + zephir_fetch_params(1, 1, 1, &tag_param, &raw_param); + zephir_get_strval(&tag, tag_param); + if (!raw_param) { + raw = 0; + } else { + raw = zephir_get_boolval(raw_param); + } - ZEPHIR_CALL_METHOD(&_0, connection, "addservers", NULL, 0, &servers); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "Cannot connect to the Memcached server(s)", "phalcon/Storage/Adapter/Libmemcached.zep", 317); - return; + if (raw) { + ZVAL_BOOL(&_0, 1); + } else { + ZVAL_BOOL(&_0, 0); } - RETURN_THIS(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "close", NULL, 0, &tag, &_0); + zephir_check_call_status(); + RETURN_MM(); } @@ -20311,469 +20436,574 @@ static PHP_METHOD(Phalcon_Storage_Adapter_Libmemcached, setServers) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_Memory) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Doctype) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Adapter, Memory, phalcon, storage_adapter_memory, phalcon_storage_adapter_abstractadapter_ce, phalcon_storage_adapter_memory_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Html\\Helper, Doctype, phalcon, html_helper_doctype, phalcon_html_helper_doctype_method_entry, 0); - zend_declare_property_null(phalcon_storage_adapter_memory_ce, SL("data"), ZEND_ACC_PROTECTED); - phalcon_storage_adapter_memory_ce->create_object = zephir_init_properties_Phalcon_Storage_Adapter_Memory; + zend_declare_property_null(phalcon_html_helper_doctype_ce, SL("delimiter"), ZEND_ACC_PRIVATE); + zend_declare_property_null(phalcon_html_helper_doctype_ce, SL("flag"), ZEND_ACC_PRIVATE); + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("HTML32"), 1); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("HTML401_STRICT"), 2); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("HTML401_TRANSITIONAL"), 3); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("HTML401_FRAMESET"), 4); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("HTML5"), 5); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML10_STRICT"), 6); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML10_TRANSITIONAL"), 7); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML10_FRAMESET"), 8); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML11"), 9); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML20"), 10); + + zephir_declare_class_constant_long(phalcon_html_helper_doctype_ce, SL("XHTML5"), 11); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, __construct) +static PHP_METHOD(Phalcon_Html_Helper_Doctype, __construct) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval options; - zval *factory, factory_sub, *options_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 5); + zephir_update_property_zval(this_ptr, ZEND_STRL("flag"), &_0); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_GET_CONSTANT(&_1, "PHP_EOL"); + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_1); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Html_Helper_Doctype, __invoke) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval delimiter; + zval *flag_param = NULL, *delimiter_param = NULL, _0; + zend_long flag; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&delimiter); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_LONG(flag) + Z_PARAM_STR(delimiter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 0, 2, &flag_param, &delimiter_param); + if (!flag_param) { + flag = 5; } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + flag = zephir_get_intval(flag_param); + } + if (!delimiter_param) { + ZEPHIR_INIT_VAR(&delimiter); + ZVAL_STRING(&delimiter, "\n"); + } else { + zephir_get_strval(&delimiter, delimiter_param); } - ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_memory_ce, getThis(), "__construct", &_0, 0, factory, &options); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initserializer", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, flag); + zephir_update_property_zval(this_ptr, ZEND_STRL("flag"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &delimiter); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, clear) +static PHP_METHOD(Phalcon_Html_Helper_Doctype, __toString) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval _0, _18, _1$$3, _2$$4, _3$$4, _4$$5, _5$$5, _6$$6, _7$$6, _8$$7, _9$$7, _10$$8, _11$$8, _12$$9, _13$$9, _14$$10, _15$$10, _16$$11, _17$$11; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_18); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$9); + ZVAL_UNDEF(&_13$$9); + ZVAL_UNDEF(&_14$$10); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_16$$11); + ZVAL_UNDEF(&_17$$11); - ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &_0); - RETURN_MM_BOOL(1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("flag"), PH_NOISY_CC | PH_READONLY); + do { + if (ZEPHIR_IS_LONG(&_0, 1)) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SV(return_value, "", &_1$$3); + return; + } + if (ZEPHIR_IS_LONG(&_0, 2)) { + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_3$$4); + return; + } + if (ZEPHIR_IS_LONG(&_0, 3)) { + zephir_read_property(&_4$$5, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_5$$5, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_5$$5); + return; + } + if (ZEPHIR_IS_LONG(&_0, 4)) { + zephir_read_property(&_6$$6, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_7$$6, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_7$$6); + return; + } + if (ZEPHIR_IS_LONG(&_0, 6)) { + zephir_read_property(&_8$$7, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_9$$7, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_9$$7); + return; + } + if (ZEPHIR_IS_LONG(&_0, 7)) { + zephir_read_property(&_10$$8, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_11$$8, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_11$$8); + return; + } + if (ZEPHIR_IS_LONG(&_0, 8)) { + zephir_read_property(&_12$$9, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_13$$9, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_13$$9); + return; + } + if (ZEPHIR_IS_LONG(&_0, 9)) { + zephir_read_property(&_14$$10, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_15$$10, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_15$$10); + return; + } + if (ZEPHIR_IS_LONG(&_0, 10)) { + zephir_read_property(&_16$$11, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_17$$11, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SVSV(return_value, "", &_17$$11); + return; + } + } while(0); + + zephir_read_property(&_18, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_SV(return_value, "", &_18); + return; } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, decrement) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Element) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Element, phalcon, html_helper_element, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_element_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Element, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, current, newValue, prefixedKey, result, _0, _1$$3; - zval key; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool raw; + zval attributes; + zval *tag_param = NULL, *text_param = NULL, *attributes_param = NULL, *raw_param = NULL, _0; + zval tag, text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(¤t); - ZVAL_UNDEF(&newValue); - ZVAL_UNDEF(&prefixedKey); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&tag); + ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(tag) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 2, 2, &tag_param, &text_param, &attributes_param, &raw_param); + zephir_get_strval(&tag, tag_param); + zephir_get_strval(&text, text_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); + zephir_get_arrval(&attributes, attributes_param); } - if (!value_param) { - value = 1; + if (!raw_param) { + raw = 0; } else { - value = zephir_get_intval(value_param); + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&prefixedKey, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&result); - ZVAL_BOOL(&result, zephir_array_key_exists(&_0, &prefixedKey)); - if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&result))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(¤t, &_1$$3, &prefixedKey, PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Memory.zep", 72); - ZEPHIR_INIT_VAR(&newValue); - ZVAL_LONG(&newValue, (zephir_get_intval(¤t) - value)); - ZEPHIR_CPY_WRT(&result, &newValue); - zephir_update_property_array(this_ptr, SL("data"), &prefixedKey, &newValue); + if (raw) { + ZVAL_BOOL(&_0, 1); + } else { + ZVAL_BOOL(&_0, 0); } - RETURN_CCTOR(&result); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &tag, &text, &attributes, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, delete) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Form) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Form, phalcon, html_helper_form, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_form_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Form, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, exists, prefixedKey, _0, _1; - zval key; + zval *attributes_param = NULL, overrides, _0, _1; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&exists); - ZVAL_UNDEF(&prefixedKey); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&overrides); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 0, 1, &attributes_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); + zephir_get_arrval(&attributes, attributes_param); } - ZEPHIR_CALL_METHOD(&prefixedKey, this_ptr, "getprefixedkey", NULL, 0, &key); + ZEPHIR_INIT_VAR(&overrides); + zephir_create_array(&overrides, 2, 0); + add_assoc_stringl_ex(&overrides, SL("method"), SL("post")); + add_assoc_stringl_ex(&overrides, SL("enctype"), SL("multipart/form-data")); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "orderattributes", NULL, 0, &overrides, &attributes); zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&exists); - ZVAL_BOOL(&exists, zephir_array_key_exists(&_0, &prefixedKey)); - zephir_unset_property_array(this_ptr, ZEND_STRL("data"), &prefixedKey); - zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_1, &prefixedKey, PH_SEPARATE); - RETURN_CCTOR(&exists); + ZEPHIR_CPY_WRT(&overrides, &_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "form"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderelement", NULL, 0, &_1, &overrides); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, getKeys) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Img) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Img, phalcon, html_helper_img, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_img_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Img, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, _0, _1; - zval prefix; + zval attributes; + zval *src_param = NULL, *attributes_param = NULL, overrides, _0; + zval src; zval *this_ptr = getThis(); - ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&src); + ZVAL_UNDEF(&overrides); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(src) Z_PARAM_OPTIONAL - Z_PARAM_STR(prefix) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &prefix_param); - if (!prefix_param) { - ZEPHIR_INIT_VAR(&prefix); - ZVAL_STRING(&prefix, ""); + zephir_fetch_params(1, 1, 1, &src_param, &attributes_param); + zephir_get_strval(&src, src_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - zephir_get_strval(&prefix, prefix_param); + zephir_get_arrval(&attributes, attributes_param); } + ZEPHIR_INIT_VAR(&overrides); + zephir_create_array(&overrides, 1, 0); + zephir_array_update_string(&overrides, SL("src"), &src, PH_COPY | PH_SEPARATE); + zephir_array_unset_string(&attributes, SL("src"), PH_SEPARATE); ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - zephir_array_keys(&_0, &_1); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getfilteredkeys", NULL, 0, &_0, &prefix); + zephir_fast_array_merge(&_0, &overrides, &attributes); + ZEPHIR_CPY_WRT(&overrides, &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "img"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "selfclose", NULL, 0, &_0, &overrides); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, has) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Label) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Label, phalcon, html_helper_label, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_label_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Label, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, prefixedKey, _0; - zval key; + zend_bool raw; + zval attributes; + zval *label_param = NULL, *attributes_param = NULL, *raw_param = NULL, _0, _1; + zval label; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&prefixedKey); + ZVAL_UNDEF(&label); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(label) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 2, &label_param, &attributes_param, &raw_param); + zephir_get_strval(&label, label_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&key); + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&prefixedKey, this_ptr, "getprefixedkey", NULL, 0, &key); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "label"); + if (raw) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &_0, &label, &attributes, &_1); zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - RETURN_MM_BOOL(zephir_array_key_exists(&_0, &prefixedKey)); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, increment) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, current, newValue, prefixedKey, result, _0, _1$$3; - zval key; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(¤t); - ZVAL_UNDEF(&newValue); - ZVAL_UNDEF(&prefixedKey); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } - ZEPHIR_CALL_METHOD(&prefixedKey, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&result); - ZVAL_BOOL(&result, zephir_array_key_exists(&_0, &prefixedKey)); - if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&result))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(¤t, &_1$$3, &prefixedKey, PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Memory.zep", 145); - ZEPHIR_INIT_VAR(&newValue); - ZVAL_LONG(&newValue, (zephir_get_intval(¤t) + value)); - ZEPHIR_CPY_WRT(&result, &newValue); - zephir_update_property_array(this_ptr, SL("data"), &prefixedKey, &newValue); - } - RETURN_CCTOR(&result); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Link) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Link, phalcon, html_helper_link, phalcon_html_helper_style_ce, phalcon_html_helper_link_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, set) +static PHP_METHOD(Phalcon_Html_Helper_Link, add) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, content, prefixedKey; - zval key; + zval attributes, _0, _2; + zval *url_param = NULL, *attributes_param = NULL, _1, _3; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&ttl_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&content); - ZVAL_UNDEF(&prefixedKey); + ZVAL_UNDEF(&url); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(url) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(ttl) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); - } - if (!ttl) { - ttl = &ttl_sub; - ttl = &__$null; + zephir_get_arrval(&attributes, attributes_param); } - _0 = Z_TYPE_P(ttl) == IS_LONG; - if (_0) { - _0 = ZEPHIR_LT_LONG(ttl, 1); - } - if (_0) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "delete", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&content, this_ptr, "getserializeddata", NULL, 0, value); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "renderTag"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 3, 0); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettag", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&prefixedKey, this_ptr, "getprefixedkey", NULL, 0, &key); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getattributes", NULL, 0, &url, &attributes); zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("data"), &prefixedKey, &content); - RETURN_MM_BOOL(1); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "/"); + zephir_array_fast_append(&_2, &_1); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "indent", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_0, &_3); + zephir_update_property_array_append(this_ptr, SL("store"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, setForever) +static PHP_METHOD(Phalcon_Html_Helper_Link, getTag) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "set", NULL, 0, &key, value); - zephir_check_call_status(); - RETURN_MM(); + RETURN_STRING("link"); } -static PHP_METHOD(Phalcon_Storage_Adapter_Memory, doGet) +static PHP_METHOD(Phalcon_Html_Helper_Link, getAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1, _2; - zval key; + zval attributes, required; + zval *url_param = NULL, *attributes_param = NULL; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&url); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&required); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(url) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getprefixedkey", NULL, 0, &key); - zephir_check_call_status(); - zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Memory.zep", 206); - RETURN_CTOR(&_1); -} + zephir_fetch_params(1, 2, 0, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + zephir_get_arrval(&attributes, attributes_param); -zend_object *zephir_init_properties_Phalcon_Storage_Adapter_Memory(zend_class_entry *class_type) -{ - zval _0, _2, _1$$3, _3$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("data"), &_3$$4); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + ZEPHIR_INIT_VAR(&required); + zephir_create_array(&required, 1, 0); + zephir_array_update_string(&required, SL("href"), &url, PH_COPY | PH_SEPARATE); + zephir_array_unset_string(&attributes, SL("href"), PH_SEPARATE); + zephir_fast_array_merge(return_value, &required, &attributes); + RETURN_MM(); } @@ -20786,820 +21016,593 @@ zend_object *zephir_init_properties_Phalcon_Storage_Adapter_Memory(zend_class_en -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_Redis) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Meta) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Adapter, Redis, phalcon, storage_adapter_redis, phalcon_storage_adapter_abstractadapter_ce, phalcon_storage_adapter_redis_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Meta, phalcon, html_helper_meta, phalcon_html_helper_abstractseries_ce, phalcon_html_helper_meta_method_entry, 0); - zend_declare_property_string(phalcon_storage_adapter_redis_ce, SL("prefix"), "ph-reds-", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, __construct) +static PHP_METHOD(Phalcon_Html_Helper_Meta, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_15 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *factory, factory_sub, *options_param = NULL, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14; + zval *attributes_param = NULL, _1, _3; + zval attributes, _0, _2; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); + ZVAL_UNDEF(&attributes); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 0, 1, &attributes_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + zephir_get_arrval(&attributes, attributes_param); } + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "host"); + ZVAL_STRING(&_1, "renderTag"); + zephir_array_fast_append(&_0, &_1); ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "127.0.0.1"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getarrval", NULL, 0, &options, &_1, &_2); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("host"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "port"); - ZVAL_LONG(&_4, 6379); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, "int"); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4, &_2); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("port"), &_3, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "index"); - ZVAL_LONG(&_4, 0); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("index"), &_5, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "timeout"); - ZVAL_LONG(&_4, 0); - ZEPHIR_CALL_METHOD(&_6, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("timeout"), &_6, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "persistent"); - ZVAL_BOOL(&_4, 0); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, "bool"); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4, &_2); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("persistent"), &_7, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "persistentId"); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, ""); - ZEPHIR_INIT_VAR(&_9); - ZVAL_STRING(&_9, "string"); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "getarrval", NULL, 0, &options, &_1, &_2, &_9); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("persistentId"), &_8, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "auth"); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, ""); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "getarrval", NULL, 0, &options, &_1, &_2); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("auth"), &_10, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "socket"); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, ""); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "getarrval", NULL, 0, &options, &_1, &_2); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("socket"), &_11, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "connectTimeout"); - ZVAL_LONG(&_4, 0); - ZEPHIR_CALL_METHOD(&_12, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("connectTimeout"), &_12, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "retryInterval"); - ZVAL_LONG(&_4, 0); - ZEPHIR_CALL_METHOD(&_13, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4); - zephir_check_call_status(); - zephir_array_update_string(&options, SL("retryInterval"), &_13, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "readTimeout"); - ZVAL_LONG(&_4, 0); - ZEPHIR_CALL_METHOD(&_14, this_ptr, "getarrval", NULL, 0, &options, &_1, &_4); + zephir_create_array(&_2, 2, 0); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettag", NULL, 0); zephir_check_call_status(); - zephir_array_update_string(&options, SL("readTimeout"), &_14, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_redis_ce, getThis(), "__construct", &_15, 0, factory, &options); + zephir_array_fast_append(&_2, &_3); + zephir_array_fast_append(&_2, &attributes); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "indent", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_array_fast_append(&_0, &_3); + zephir_update_property_array_append(this_ptr, SL("store"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, clear) +static PHP_METHOD(Phalcon_Html_Helper_Meta, addHttp) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *httpEquiv_param = NULL, *content_param = NULL, _0; + zval httpEquiv, content; zval *this_ptr = getThis(); + ZVAL_UNDEF(&httpEquiv); + ZVAL_UNDEF(&content); ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(httpEquiv) + Z_PARAM_STR(content) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &httpEquiv_param, &content_param); + zephir_get_strval(&httpEquiv, httpEquiv_param); + zephir_get_strval(&content, content_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_0, "flushdb", NULL, 0); + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "http-equiv"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addelement", NULL, 331, &_0, &httpEquiv, &content); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, decrement) +static PHP_METHOD(Phalcon_Html_Helper_Meta, addName) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *content_param = NULL, _0; + zval name, content; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&content); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_STR(content) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } + zephir_fetch_params(1, 2, 0, &name_param, &content_param); + zephir_get_strval(&name, name_param); + zephir_get_strval(&content, content_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(&_0, "decrby", NULL, 0, &key, &_1); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "name"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 331, &_0, &name, &content); zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, delete) +static PHP_METHOD(Phalcon_Html_Helper_Meta, addProperty) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1; - zval key; + zval *name_param = NULL, *content_param = NULL, _0; + zval name, content; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&content); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_STR(content) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_fetch_params(1, 2, 0, &name_param, &content_param); + zephir_get_strval(&name, name_param); + zephir_get_strval(&content, content_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, &_0, "del", NULL, 0, &key); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "property"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addelement", NULL, 331, &_0, &name, &content); zephir_check_call_status(); - RETURN_MM_BOOL(zephir_get_boolval(&_1)); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, getAdapter) +static PHP_METHOD(Phalcon_Html_Helper_Meta, getTag) { - zval connection, _0, _1$$3, _2$$3, _3$$3, _4$$3; + zval *this_ptr = getThis(); + + + + RETURN_STRING("meta"); +} + +static PHP_METHOD(Phalcon_Html_Helper_Meta, addElement) +{ + zval attributes; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *element_param = NULL, *value_param = NULL, *content_param = NULL; + zval element, value, content; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&content); + ZVAL_UNDEF(&attributes); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_STR(element) + Z_PARAM_STR(value) + Z_PARAM_STR(content) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &element_param, &value_param, &content_param); + zephir_get_strval(&element, element_param); + zephir_get_strval(&value, value_param); + zephir_get_strval(&content, content_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&connection); - object_init_ex(&connection, zephir_get_internal_ce(SL("redis"))); - ZEPHIR_CALL_METHOD(NULL, &connection, "__construct", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkconnect", NULL, 109, &connection); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2$$3, &_1$$3, "checkauth", NULL, 110, &connection); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "checkindex", NULL, 111, &connection); - zephir_check_call_status(); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_4$$3, 2); - ZEPHIR_CALL_METHOD(NULL, &connection, "setoption", NULL, 0, &_4$$3, &_3$$3); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setserializer", NULL, 112, &connection); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), &connection); - } - RETURN_MM_MEMBER(getThis(), "adapter"); + + ZEPHIR_INIT_VAR(&attributes); + zephir_create_array(&attributes, 2, 0); + zephir_array_update_zval(&attributes, &element, &value, PH_COPY); + zephir_array_update_string(&attributes, SL("content"), &content, PH_COPY | PH_SEPARATE); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &attributes); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, getKeys) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Ol) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Ol, phalcon, html_helper_ol, phalcon_html_helper_abstractlist_ce, phalcon_html_helper_ol_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Ol, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, _0, _1, _2; - zval prefix; + zend_bool raw; + zval attributes, _0, _2; + zval *text_param = NULL, *attributes_param = NULL, *raw_param = NULL, _1, _3, _4; + zval text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&prefix); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&text); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_STR(prefix) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &prefix_param); - if (!prefix_param) { - ZEPHIR_INIT_VAR(&prefix); - ZVAL_STRING(&prefix, ""); + zephir_fetch_params(1, 1, 2, &text_param, &attributes_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); - RETURN_MM_NULL(); + zephir_get_arrval(&attributes, attributes_param); } - if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(&prefix, prefix_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&prefix); - } + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "renderFullElement"); + zephir_array_fast_append(&_0, &_1); ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "*"); - ZEPHIR_CALL_METHOD(&_1, &_0, "keys", NULL, 0, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getfilteredkeys", NULL, 0, &_1, &prefix); + zephir_create_array(&_2, 4, 0); + ZEPHIR_OBS_VAR(&_3); + zephir_read_property(&_3, this_ptr, ZEND_STRL("elementTag"), PH_NOISY_CC); + zephir_array_fast_append(&_2, &_3); + zephir_array_fast_append(&_2, &text); + zephir_array_fast_append(&_2, &attributes); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_BOOL(&_1, raw); + zephir_array_fast_append(&_2, &_1); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "indent", NULL, 0); zephir_check_call_status(); - RETURN_MM(); + zephir_array_fast_append(&_0, &_4); + zephir_update_property_array_append(this_ptr, SL("store"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, has) +static PHP_METHOD(Phalcon_Html_Helper_Ol, getTag) +{ + zval *this_ptr = getThis(); + + + + RETURN_STRING("ol"); +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Script) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Script, phalcon, html_helper_script, phalcon_html_helper_abstractseries_ce, phalcon_html_helper_script_method_entry, 0); + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Script, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1; - zval key; + zval attributes, _0, _2; + zval *url_param = NULL, *attributes_param = NULL, _1, _3; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&url); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(url) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); + zephir_get_arrval(&attributes, attributes_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "renderFullElement"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 3, 0); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettag", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, &_0, "exists", NULL, 0, &key); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, ""); + zephir_array_fast_append(&_2, &_1); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getattributes", NULL, 0, &url, &attributes); zephir_check_call_status(); - RETURN_MM_BOOL(zephir_get_boolval(&_1)); + zephir_array_fast_append(&_2, &_3); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "indent", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_0, &_3); + zephir_update_property_array_append(this_ptr, SL("store"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, increment) +static PHP_METHOD(Phalcon_Html_Helper_Script, getAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value_param = NULL, _0, _1; - zval key; + zval attributes, required; + zval *url_param = NULL, *attributes_param = NULL; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&url); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&required); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(url) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } + zephir_fetch_params(1, 2, 0, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + zephir_get_arrval(&attributes, attributes_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_1, value); - ZEPHIR_RETURN_CALL_METHOD(&_0, "incrby", NULL, 0, &key, &_1); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&required); + zephir_create_array(&required, 2, 0); + zephir_array_update_string(&required, SL("src"), &url, PH_COPY | PH_SEPARATE); + add_assoc_stringl_ex(&required, SL("type"), SL("application/javascript")); + zephir_array_unset_string(&attributes, SL("src"), PH_SEPARATE); + zephir_fast_array_merge(return_value, &required, &attributes); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, set) +static PHP_METHOD(Phalcon_Html_Helper_Script, getTag) +{ + zval *this_ptr = getThis(); + + + + RETURN_STRING("script"); +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Style) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Style, phalcon, html_helper_style, phalcon_html_helper_abstractseries_ce, phalcon_html_helper_style_method_entry, 0); + + zend_declare_property_bool(phalcon_html_helper_style_ce, SL("isStyle"), 0, ZEND_ACC_PRIVATE); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Style, add) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, result, _1, _2, _3, _4; - zval key; + zval attributes, _0, _2; + zval *url_param = NULL, *attributes_param = NULL, _1, _3; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&ttl_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&url); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(url) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(ttl) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); - } - if (!ttl) { - ttl = &ttl_sub; - ttl = &__$null; + zephir_get_arrval(&attributes, attributes_param); } - _0 = Z_TYPE_P(ttl) == IS_LONG; - if (_0) { - _0 = ZEPHIR_LT_LONG(ttl, 1); - } - if (_0) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "delete", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getserializeddata", NULL, 0, value); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "renderTag"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 3, 0); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettag", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getttl", NULL, 0, ttl); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getattributes", NULL, 0, &url, &attributes); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, &_1, "set", NULL, 0, &key, &_2, &_3); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "/"); + zephir_array_fast_append(&_2, &_1); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "indent", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_4, &result); - } else { - ZVAL_BOOL(&_4, 0); - } - RETURN_CCTOR(&_4); + zephir_array_fast_append(&_0, &_3); + zephir_update_property_array_append(this_ptr, SL("store"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, setForever) +static PHP_METHOD(Phalcon_Html_Helper_Style, setStyle) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, result, _0, _1, _2; - zval key; + zval *flag_param = NULL, __$true, __$false; + zend_bool flag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(flag) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_fetch_params_without_memory_grow(1, 0, &flag_param); + flag = zephir_get_boolval(flag_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getadapter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&result, &_0, "set", NULL, 0, &key, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - if (((Z_TYPE_P(&result) == IS_TRUE || Z_TYPE_P(&result) == IS_FALSE) == 1)) { - ZEPHIR_CPY_WRT(&_2, &result); + if (flag) { + zephir_update_property_zval(this_ptr, ZEND_STRL("isStyle"), &__$true); } else { - ZVAL_BOOL(&_2, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("isStyle"), &__$false); } - RETURN_CCTOR(&_2); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, checkAuth) +static PHP_METHOD(Phalcon_Html_Helper_Style, getAttributes) { - zend_bool error = 0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, auth, _0, _3, _4, _2$$3; + zval attributes, required; + zval *url_param = NULL, *attributes_param = NULL, _0; + zval url; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&auth); + ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&required); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("redis"))) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(url) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&auth); - zephir_array_fetch_string(&auth, &_0, SL("auth"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 243); - - /* try_start_1: */ - - _1$$3 = 1 != ZEPHIR_IS_EMPTY(&auth); - if (_1$$3) { - ZEPHIR_CALL_METHOD(&_2$$3, connection, "auth", NULL, 0, &auth); - zephir_check_call_status_or_jump(try_end_1); - _1$$3 = !ZEPHIR_IS_TRUE_IDENTICAL(&_2$$3); - } - error = _1$$3; + zephir_fetch_params(1, 2, 0, &url_param, &attributes_param); + zephir_get_strval(&url, url_param); + zephir_get_arrval(&attributes, attributes_param); - try_end_1: - if (EG(exception)) { - ZEPHIR_INIT_VAR(&_3); - ZVAL_OBJ(&_3, EG(exception)); - Z_ADDREF_P(&_3); - ZEPHIR_INIT_VAR(&_4); - if (zephir_is_instance_of(&_3, SL("Exception"))) { - zend_clear_exception(); - ZEPHIR_CPY_WRT(&_4, &_3); - error = 1; - } - } - if (error) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "Failed to authenticate with the Redis server", "phalcon/Storage/Adapter/Redis.zep", 254); - return; + ZEPHIR_INIT_VAR(&required); + zephir_create_array(&required, 4, 0); + add_assoc_stringl_ex(&required, SL("rel"), SL("stylesheet")); + zephir_array_update_string(&required, SL("href"), &url, PH_COPY | PH_SEPARATE); + add_assoc_stringl_ex(&required, SL("type"), SL("text/css")); + add_assoc_stringl_ex(&required, SL("media"), SL("screen")); + zephir_read_property(&_0, this_ptr, ZEND_STRL("isStyle"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { + zephir_array_unset_string(&required, SL("rel"), PH_SEPARATE); } - RETURN_THIS(); + zephir_array_unset_string(&attributes, SL("href"), PH_SEPARATE); + zephir_fast_array_merge(return_value, &required, &attributes); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, checkConnect) +static PHP_METHOD(Phalcon_Html_Helper_Style, getTag) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, host, method, options, parameter, persistentId, port, retryInterval, readTimeout, result, timeout, _0, _1, _2$$4, _3$$4, _4$$5, _5$$5, _6$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&host); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(¶meter); - ZVAL_UNDEF(&persistentId); - ZVAL_UNDEF(&port); - ZVAL_UNDEF(&retryInterval); - ZVAL_UNDEF(&readTimeout); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&timeout); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("redis"))) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&options, &_0); - ZEPHIR_OBS_VAR(&host); - zephir_array_fetch_string(&host, &options, SL("host"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 272); - ZEPHIR_OBS_VAR(&port); - zephir_array_fetch_string(&port, &options, SL("port"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 273); - ZEPHIR_OBS_VAR(&timeout); - zephir_array_fetch_string(&timeout, &options, SL("timeout"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 274); - ZEPHIR_OBS_VAR(&retryInterval); - zephir_array_fetch_string(&retryInterval, &options, SL("retryInterval"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 275); - ZEPHIR_OBS_VAR(&readTimeout); - zephir_array_fetch_string(&readTimeout, &options, SL("readTimeout"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 276); - zephir_array_fetch_string(&_1, &options, SL("persistent"), PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Redis.zep", 278); - ZEPHIR_INIT_VAR(&method); - ZEPHIR_INIT_VAR(¶meter); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_1)) { - ZVAL_STRING(&method, "connect"); - ZVAL_NULL(¶meter); - } else { - ZVAL_STRING(&method, "pconnect"); - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&persistentId); - zephir_array_fetch_string(&persistentId, &_2$$4, SL("persistentId"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 283); - if (!(ZEPHIR_IS_EMPTY(&persistentId))) { - ZEPHIR_CPY_WRT(¶meter, &persistentId); - } else { - zephir_array_fetch_string(&_3$$4, &options, SL("index"), PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Redis.zep", 284); - ZEPHIR_CONCAT_SV(¶meter, "persistentId", &_3$$4); - } - } - ZEPHIR_CALL_METHOD_ZVAL(&result, connection, &method, NULL, 0, &host, &port, &timeout, ¶meter, &retryInterval, &readTimeout); - zephir_check_call_status(); - if (!(zephir_is_true(&result))) { - ZEPHIR_INIT_VAR(&_4$$5); - object_init_ex(&_4$$5, phalcon_storage_exception_ce); - ZEPHIR_INIT_VAR(&_5$$5); - ZVAL_STRING(&_5$$5, "Could not connect to the Redisd server [%s:%s]"); - ZEPHIR_CALL_FUNCTION(&_6$$5, "sprintf", NULL, 113, &_5$$5, &host, &port); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_4$$5, "__construct", NULL, 29, &_6$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(&_4$$5, "phalcon/Storage/Adapter/Redis.zep", 303); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_THIS(); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, checkIndex) -{ - zend_bool _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, index, _0, _2; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("redis"))) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&index); - zephir_array_fetch_string(&index, &_0, SL("index"), PH_NOISY, "phalcon/Storage/Adapter/Redis.zep", 319); - _1 = ZEPHIR_GT_LONG(&index, 0); - if (_1) { - ZEPHIR_CALL_METHOD(&_2, connection, "select", NULL, 0, &index); - zephir_check_call_status(); - _1 = !ZEPHIR_IS_TRUE_IDENTICAL(&_2); - } - if (_1) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "Redis server selected database failed", "phalcon/Storage/Adapter/Redis.zep", 324); - return; - } - RETURN_THIS(); -} - -static PHP_METHOD(Phalcon_Storage_Adapter_Redis, setSerializer) -{ - zval map; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, serializer, _0, _1, _4, _7, _10, _2$$3, _3$$3, _5$$4, _6$$4, _8$$5, _9$$5, _11$$6, _12$$6, _13$$6; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&serializer); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_11$$6); - ZVAL_UNDEF(&_12$$6); - ZVAL_UNDEF(&_13$$6); - ZVAL_UNDEF(&map); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, zephir_get_internal_ce(SL("redis"))) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); - - - ZEPHIR_INIT_VAR(&map); - zephir_create_array(&map, 2, 0); - add_assoc_long_ex(&map, SL("redis_none"), 0); - add_assoc_long_ex(&map, SL("redis_php"), 1); ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "\\Redis::SERIALIZER_IGBINARY"); - ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 114, &_0); - zephir_check_call_status(); - if (zephir_is_true(&_1)) { - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "\\Redis::SERIALIZER_IGBINARY"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "constant", NULL, 115, &_2$$3); - zephir_check_call_status(); - zephir_array_update_string(&map, SL("redis_igbinary"), &_3$$3, PH_COPY | PH_SEPARATE); - } - ZEPHIR_INIT_NVAR(&_0); - ZVAL_STRING(&_0, "\\Redis::SERIALIZER_MSGPACK"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 114, &_0); - zephir_check_call_status(); - if (zephir_is_true(&_4)) { - ZEPHIR_INIT_VAR(&_5$$4); - ZVAL_STRING(&_5$$4, "\\Redis::SERIALIZER_MSGPACK"); - ZEPHIR_CALL_FUNCTION(&_6$$4, "constant", NULL, 115, &_5$$4); - zephir_check_call_status(); - zephir_array_update_string(&map, SL("redis_msgpack"), &_6$$4, PH_COPY | PH_SEPARATE); - } - ZEPHIR_INIT_NVAR(&_0); - ZVAL_STRING(&_0, "\\Redis::SERIALIZER_JSON"); - ZEPHIR_CALL_FUNCTION(&_7, "defined", NULL, 114, &_0); - zephir_check_call_status(); - if (zephir_is_true(&_7)) { - ZEPHIR_INIT_VAR(&_8$$5); - ZVAL_STRING(&_8$$5, "\\Redis::SERIALIZER_JSON"); - ZEPHIR_CALL_FUNCTION(&_9$$5, "constant", NULL, 115, &_8$$5); - zephir_check_call_status(); - zephir_array_update_string(&map, SL("redis_json"), &_9$$5, PH_COPY | PH_SEPARATE); - } - zephir_read_property(&_10, this_ptr, ZEND_STRL("defaultSerializer"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&serializer); - zephir_fast_strtolower(&serializer, &_10); - if (1 == zephir_array_isset(&map, &serializer)) { - ZEPHIR_INIT_VAR(&_11$$6); - ZEPHIR_INIT_NVAR(&_11$$6); - ZVAL_STRING(&_11$$6, ""); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultSerializer"), &_11$$6); - zephir_array_fetch(&_12$$6, &map, &serializer, PH_NOISY | PH_READONLY, "phalcon/Storage/Adapter/Redis.zep", 366); - ZVAL_LONG(&_13$$6, 1); - ZEPHIR_CALL_METHOD(NULL, connection, "setoption", NULL, 0, &_13$$6, &_12$$6); - zephir_check_call_status(); + zephir_read_property(&_1, this_ptr, ZEND_STRL("isStyle"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_1)) { + ZVAL_STRING(&_0, "style"); + } else { + ZVAL_STRING(&_0, "link"); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initserializer", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_CCTOR(&_0); } @@ -21612,1299 +21615,945 @@ static PHP_METHOD(Phalcon_Storage_Adapter_Redis, setSerializer) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Adapter_Stream) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Title) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Adapter, Stream, phalcon, storage_adapter_stream, phalcon_storage_adapter_abstractadapter_ce, phalcon_storage_adapter_stream_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Title, phalcon, html_helper_title, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_title_method_entry, 0); + + zend_declare_property_null(phalcon_html_helper_title_ce, SL("append"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_helper_title_ce, SL("prepend"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_title_ce, SL("title"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_title_ce, SL("separator"), "", ZEND_ACC_PROTECTED); + phalcon_html_helper_title_ce->create_object = zephir_init_properties_Phalcon_Html_Helper_Title; - zend_declare_property_string(phalcon_storage_adapter_stream_ce, SL("prefix"), "ph-strm", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_storage_adapter_stream_ce, SL("storageDir"), "", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, __construct) +static PHP_METHOD(Phalcon_Html_Helper_Title, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *factory, factory_sub, *options_param = NULL, storageDir, _0, _1, _2; + zval *indent_param = NULL, *delimiter_param = NULL, _0; + zval indent, delimiter; zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); - ZVAL_UNDEF(&storageDir); + ZVAL_UNDEF(&indent); + ZVAL_UNDEF(&delimiter); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_STR(indent) + Z_PARAM_STR_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &factory, &options_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 0, 2, &indent_param, &delimiter_param); + if (!indent_param) { + ZEPHIR_INIT_VAR(&indent); + ZVAL_STRING(&indent, " "); } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + zephir_get_strval(&indent, indent_param); + } + if (!delimiter_param) { + ZEPHIR_INIT_VAR(&delimiter); + } else { + zephir_get_strval(&delimiter, delimiter_param); } ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "storageDir"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, ""); - ZEPHIR_CALL_METHOD(&storageDir, this_ptr, "getarrval", NULL, 0, &options, &_0, &_1); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(&storageDir)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_storage_exception_ce, "The 'storageDir' must be specified in the options", "phalcon/Storage/Adapter/Stream.zep", 60); - return; + if (Z_TYPE_P(&delimiter) == IS_NULL) { + ZEPHIR_INIT_NVAR(&_0); + ZEPHIR_GET_CONSTANT(&_0, "PHP_EOL"); + } else { + ZEPHIR_CPY_WRT(&_0, &delimiter); } - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getdirseparator", NULL, 116, &storageDir); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("storageDir"), &_2); - ZEPHIR_CALL_PARENT(NULL, phalcon_storage_adapter_stream_ce, getThis(), "__construct", &_3, 0, factory, &options); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initserializer", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("indent"), &indent); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, clear) +static PHP_METHOD(Phalcon_Html_Helper_Title, __toString) { - zend_bool result = 0, _4$$3, _9$$5; - zval directory, iterator, file, _0, *_1, _2, _3$$3, _5$$3, _6$$3, _8$$5, _10$$5, _11$$5; + zval _1; + zval items, _0, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&directory); - ZVAL_UNDEF(&iterator); - ZVAL_UNDEF(&file); + ZVAL_UNDEF(&items); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$5); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - result = 1; - zephir_read_property(&_0, this_ptr, ZEND_STRL("storageDir"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdirseparator", NULL, 116, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("prepend"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 1, 0); + ZEPHIR_OBS_VAR(&_2); + zephir_read_property(&_2, this_ptr, ZEND_STRL("title"), PH_NOISY_CC); + zephir_array_fast_append(&_1, &_2); + zephir_read_property(&_3, this_ptr, ZEND_STRL("append"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_FUNCTION(&items, "array_merge", NULL, 332, &_0, &_1, &_3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 117, &directory); + ZEPHIR_INIT_VAR(&_4); + array_init(&_4); + zephir_update_property_zval(this_ptr, ZEND_STRL("append"), &_4); + ZEPHIR_INIT_VAR(&_5); + array_init(&_5); + zephir_update_property_zval(this_ptr, ZEND_STRL("prepend"), &_5); + ZEPHIR_INIT_VAR(&_6); + ZEPHIR_INIT_NVAR(&_6); + ZVAL_STRING(&_6, ""); + zephir_update_property_zval(this_ptr, ZEND_STRL("title"), &_6); + zephir_read_property(&_7, this_ptr, ZEND_STRL("indent"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_NVAR(&_6); + zephir_read_property(&_9, this_ptr, ZEND_STRL("separator"), PH_NOISY_CC | PH_READONLY); + zephir_fast_join(&_6, &_9, &items); + ZEPHIR_INIT_VAR(&_10); + array_init(&_10); + ZEPHIR_INIT_VAR(&_11); + ZVAL_STRING(&_11, "title"); + ZVAL_BOOL(&_12, 1); + ZEPHIR_CALL_METHOD(&_8, this_ptr, "renderfullelement", NULL, 0, &_11, &_6, &_10, &_12); zephir_check_call_status(); - zephir_is_iterable(&iterator, 0, "phalcon/Storage/Adapter/Stream.zep", 91); - if (Z_TYPE_P(&iterator) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&iterator), _1) - { - ZEPHIR_INIT_NVAR(&file); - ZVAL_COPY(&file, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &file, "isfile", NULL, 0); - zephir_check_call_status(); - _4$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_3$$3); - if (_4$$3) { - ZEPHIR_CALL_METHOD(&_6$$3, &file, "getpathname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "phpunlink", &_7, 0, &_6$$3); - zephir_check_call_status(); - _4$$3 = !ZEPHIR_IS_TRUE_IDENTICAL(&_5$$3); - } - if (_4$$3) { - result = 0; - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &iterator, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &iterator, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&file, &iterator, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$5, &file, "isfile", NULL, 0); - zephir_check_call_status(); - _9$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_8$$5); - if (_9$$5) { - ZEPHIR_CALL_METHOD(&_11$$5, &file, "getpathname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10$$5, this_ptr, "phpunlink", &_7, 0, &_11$$5); - zephir_check_call_status(); - _9$$5 = !ZEPHIR_IS_TRUE_IDENTICAL(&_10$$5); - } - if (_9$$5) { - result = 0; - } - ZEPHIR_CALL_METHOD(NULL, &iterator, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&file); - RETURN_MM_BOOL(result); + zephir_read_property(&_12, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_VVV(return_value, &_7, &_8, &_12); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, decrement) +static PHP_METHOD(Phalcon_Html_Helper_Title, append) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS, _1; - zval *key_param = NULL, *value_param = NULL, data, result, _0; - zval key; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool raw; + zval *text_param = NULL, *raw_param = NULL, _0, _1; + zval text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; + zephir_fetch_params(1, 1, 1, &text_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!raw_param) { + raw = 0; } else { - value = zephir_get_intval(value_param); + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &key); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&data, this_ptr, "get", NULL, 0, &key); - zephir_check_call_status(); - _1 = (zephir_get_intval(&data) - value); - ZEPHIR_INIT_NVAR(&data); - ZVAL_LONG(&data, _1); - ZEPHIR_CALL_METHOD(&result, this_ptr, "set", NULL, 0, &key, &data); - zephir_check_call_status(); - if (EXPECTED(!ZEPHIR_IS_FALSE_IDENTICAL(&result))) { - ZEPHIR_CPY_WRT(&result, &data); + ZEPHIR_INIT_VAR(&_0); + if (raw) { + ZEPHIR_CPY_WRT(&_0, &text); + } else { + zephir_read_property(&_1, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_0, &_1, "html", NULL, 0, &text); + zephir_check_call_status(); } - RETURN_CCTOR(&result); + zephir_get_strval(&text, &_0); + zephir_update_property_array_append(this_ptr, SL("append"), &text); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, delete) +static PHP_METHOD(Phalcon_Html_Helper_Title, get) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, filepath, _0; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&filepath); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &key); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 119, &filepath); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "title"); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, get) +static PHP_METHOD(Phalcon_Html_Helper_Title, set) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, content, filepath, payload, _1, _2; - zval key; + zend_bool raw; + zval *text_param = NULL, *raw_param = NULL, _0, _1; + zval text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&content); - ZVAL_UNDEF(&filepath); - ZVAL_UNDEF(&payload); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) + Z_PARAM_STR(text) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &defaultValue); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &text_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&key); - } - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); - zephir_check_call_status(); - if (1 != (zephir_file_exists(&filepath) == SUCCESS)) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 120, &filepath); - zephir_check_call_status(); - _0 = ZEPHIR_IS_EMPTY(&payload); - if (!(_0)) { - ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 121, &payload); + ZEPHIR_INIT_VAR(&_0); + if (raw) { + ZEPHIR_CPY_WRT(&_0, &text); + } else { + zephir_read_property(&_1, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_0, &_1, "html", NULL, 0, &text); zephir_check_call_status(); - _0 = zephir_is_true(&_1); - } - if (_0) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); } - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "content"); - ZEPHIR_CALL_METHOD(&content, this_ptr, "getarrval", NULL, 0, &payload, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getunserializeddata", NULL, 0, &content, defaultValue); - zephir_check_call_status(); - RETURN_MM(); + zephir_get_strval(&text, &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("title"), &text); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getKeys) +static PHP_METHOD(Phalcon_Html_Helper_Title, setSeparator) { - zval files; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *prefix_param = NULL, directory, file, iterator, _0, *_1, _2, _3$$4, _4$$5, _5$$5, _6$$5, _7$$6, _8$$7, _9$$7, _10$$7; - zval prefix; + zend_bool raw; + zval *separator_param = NULL, *raw_param = NULL, _0, _1; + zval separator; zval *this_ptr = getThis(); - ZVAL_UNDEF(&prefix); - ZVAL_UNDEF(&directory); - ZVAL_UNDEF(&file); - ZVAL_UNDEF(&iterator); + ZVAL_UNDEF(&separator); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&files); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(separator) Z_PARAM_OPTIONAL - Z_PARAM_STR(prefix) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &prefix_param); - if (!prefix_param) { - ZEPHIR_INIT_VAR(&prefix); - ZVAL_STRING(&prefix, ""); - } else { - if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { - zephir_get_strval(&prefix, prefix_param); + zephir_fetch_params(1, 1, 1, &separator_param, &raw_param); + zephir_get_strval(&separator, separator_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&prefix); - } + raw = zephir_get_boolval(raw_param); } - ZEPHIR_INIT_VAR(&files); - array_init(&files); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 122); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpfileexists", NULL, 0, &directory); - zephir_check_call_status(); - if (UNEXPECTED(!ZEPHIR_IS_TRUE_IDENTICAL(&_0))) { - array_init(return_value); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&iterator, this_ptr, "getiterator", NULL, 117, &directory); - zephir_check_call_status(); - zephir_is_iterable(&iterator, 0, "phalcon/Storage/Adapter/Stream.zep", 197); - if (Z_TYPE_P(&iterator) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&iterator), _1) - { - ZEPHIR_INIT_NVAR(&file); - ZVAL_COPY(&file, _1); - ZEPHIR_CALL_METHOD(&_3$$4, &file, "isfile", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_3$$4)) { - zephir_read_property(&_4$$5, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_5$$5, &file, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6$$5); - ZEPHIR_CONCAT_VV(&_6$$5, &_4$$5, &_5$$5); - zephir_array_append(&files, &_6$$5, PH_SEPARATE, "phalcon/Storage/Adapter/Stream.zep", 193); - } - } ZEND_HASH_FOREACH_END(); + ZEPHIR_INIT_VAR(&_0); + if (raw) { + ZEPHIR_CPY_WRT(&_0, &separator); } else { - ZEPHIR_CALL_METHOD(NULL, &iterator, "rewind", NULL, 0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_0, &_1, "html", NULL, 0, &separator); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &iterator, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&file, &iterator, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7$$6, &file, "isfile", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_7$$6)) { - zephir_read_property(&_8$$7, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_9$$7, &file, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$7); - ZEPHIR_CONCAT_VV(&_10$$7, &_8$$7, &_9$$7); - zephir_array_append(&files, &_10$$7, PH_SEPARATE, "phalcon/Storage/Adapter/Stream.zep", 193); - } - ZEPHIR_CALL_METHOD(NULL, &iterator, "next", NULL, 0); - zephir_check_call_status(); - } } - ZEPHIR_INIT_NVAR(&file); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getfilteredkeys", NULL, 0, &files, &prefix); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("separator"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, has) +static PHP_METHOD(Phalcon_Html_Helper_Title, prepend) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, payload, filepath, _0, _1; - zval key; + zend_bool raw; + zval *text_param = NULL, *raw_param = NULL, prepend, _0, _1, _2; + zval text; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&payload); - ZVAL_UNDEF(&filepath); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&prepend); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(text) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 1, 1, &text_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!raw_param) { + raw = 0; } else { - ZEPHIR_INIT_VAR(&key); + raw = zephir_get_boolval(raw_param); } - ZEPHIR_CALL_METHOD(&filepath, this_ptr, "getfilepath", NULL, 118, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "phpfileexists", NULL, 0, &filepath); - zephir_check_call_status(); - if (UNEXPECTED(!ZEPHIR_IS_TRUE_IDENTICAL(&_0))) { - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&payload, this_ptr, "getpayload", NULL, 120, &filepath); - zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&payload))) { - RETURN_MM_BOOL(0); + ZEPHIR_INIT_VAR(&_0); + if (raw) { + ZEPHIR_CPY_WRT(&_0, &text); + } else { + zephir_read_property(&_1, this_ptr, ZEND_STRL("escaper"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_0, &_1, "html", NULL, 0, &text); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "isexpired", NULL, 121, &payload); + zephir_get_strval(&text, &_0); + zephir_read_property(&_2, this_ptr, ZEND_STRL("prepend"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&prepend, &_2); + ZEPHIR_MAKE_REF(&prepend); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", NULL, 269, &prepend, &text); + ZEPHIR_UNREF(&prepend); zephir_check_call_status(); - RETURN_MM_BOOL(!zephir_is_true(&_1)); + zephir_update_property_zval(this_ptr, ZEND_STRL("prepend"), &prepend); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, increment) +zend_object *zephir_init_properties_Phalcon_Html_Helper_Title(zend_class_entry *class_type) { + zval _0, _2, _1$$3, _3$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long value, ZEPHIR_LAST_CALL_STATUS, _1; - zval *key_param = NULL, *value_param = NULL, data, result, _0; - zval key; - zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(key) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(value) - ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("prepend"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("prepend"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("append"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("append"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &key_param, &value_param); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!value_param) { - value = 1; - } else { - value = zephir_get_intval(value_param); - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &key); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&data, this_ptr, "get", NULL, 0, &key); - zephir_check_call_status(); - _1 = (zephir_get_intval(&data) + value); - ZEPHIR_INIT_NVAR(&data); - ZVAL_LONG(&data, _1); - ZEPHIR_CALL_METHOD(&result, this_ptr, "set", NULL, 0, &key, &data); - zephir_check_call_status(); - if (EXPECTED(!ZEPHIR_IS_FALSE_IDENTICAL(&result))) { - ZEPHIR_CPY_WRT(&result, &data); - } - RETURN_CCTOR(&result); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Ul) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper, Ul, phalcon, html_helper_ul, phalcon_html_helper_ol_ce, phalcon_html_helper_ul_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, set) +static PHP_METHOD(Phalcon_Html_Helper_Ul, getTag) { - zend_bool _0; - zval payload; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, _1, _2; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&ttl_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&payload); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(ttl) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - if (!ttl) { - ttl = &ttl_sub; - ttl = &__$null; - } + RETURN_STRING("ul"); +} - _0 = Z_TYPE_P(ttl) == IS_LONG; - if (_0) { - _0 = ZEPHIR_LT_LONG(ttl, 1); - } - if (_0) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "delete", NULL, 0, &key); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&payload); - zephir_create_array(&payload, 3, 0); - ZEPHIR_INIT_VAR(&_1); - zephir_time(&_1); - zephir_array_update_string(&payload, SL("created"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getttl", NULL, 0, ttl); - zephir_check_call_status(); - zephir_array_update_string(&payload, SL("ttl"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - zephir_array_update_string(&payload, SL("content"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 123, &payload, &key); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, setForever) -{ - zval payload; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, _0, _1; - zval key; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&payload); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &value); - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - } - ZEPHIR_INIT_VAR(&payload); - zephir_create_array(&payload, 3, 0); - ZEPHIR_INIT_VAR(&_0); - zephir_time(&_0); - zephir_array_update_string(&payload, SL("created"), &_0, PH_COPY | PH_SEPARATE); - add_assoc_stringl_ex(&payload, SL("ttl"), SL("forever")); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getserializeddata", NULL, 0, value); - zephir_check_call_status(); - zephir_array_update_string(&payload, SL("content"), &_1, PH_COPY | PH_SEPARATE); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "storepayload", NULL, 123, &payload, &key); - zephir_check_call_status(); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_AbstractInput) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, AbstractInput, phalcon, html_helper_input_abstractinput, phalcon_html_helper_abstracthelper_ce, phalcon_html_helper_input_abstractinput_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_string(phalcon_html_helper_input_abstractinput_ce, SL("type"), "text", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_helper_input_abstractinput_ce, SL("attributes"), ZEND_ACC_PROTECTED); + phalcon_html_helper_input_abstractinput_ce->create_object = zephir_init_properties_Phalcon_Html_Helper_Input_AbstractInput; + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDir) +static PHP_METHOD(Phalcon_Html_Helper_Input_AbstractInput, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, dirFromFile, dirPrefix, _0, _1, _2, _3, _4; - zval key; + zval attributes, _0; + zval *name_param = NULL, *value_param = NULL, *attributes_param = NULL, _1, _3, _4, _2$$3; + zval name, value; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&dirFromFile); - ZVAL_UNDEF(&dirPrefix); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(name) Z_PARAM_OPTIONAL - Z_PARAM_STR(key) + Z_PARAM_STR_OR_NULL(value) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &key_param); - if (!key_param) { - ZEPHIR_INIT_VAR(&key); - ZVAL_STRING(&key, ""); + zephir_fetch_params(1, 1, 2, &name_param, &value_param, &attributes_param); + zephir_get_strval(&name, name_param); + if (!value_param) { + ZEPHIR_INIT_VAR(&value); } else { - if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); - RETURN_MM_NULL(); + zephir_get_strval(&value, value_param); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_INIT_VAR(&key); - } + zephir_get_arrval(&attributes, attributes_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("storageDir"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_VV(&_2, &_0, &_1); - ZEPHIR_CALL_METHOD(&dirPrefix, this_ptr, "getdirseparator", NULL, 116, &_2); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getkeywithoutprefix", NULL, 124, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&dirFromFile, this_ptr, "getdirfromfile", NULL, 125, &_3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_VV(&_4, &dirPrefix, &dirFromFile); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getdirseparator", NULL, 116, &_4); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + ZEPHIR_OBS_VAR(&_1); + zephir_read_property(&_1, this_ptr, ZEND_STRL("type"), PH_NOISY_CC); + zephir_array_update_string(&_0, SL("type"), &_1, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("name"), &name, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_0); + if (!(zephir_array_isset_string(&attributes, SL("id")))) { + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "id"); + zephir_update_property_array(this_ptr, SL("attributes"), &_2$$3, &name); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", NULL, 0, &value); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_3); + zephir_read_property(&_4, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + zephir_fast_array_merge(&_3, &_4, &attributes); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_3); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getFilepath) +static PHP_METHOD(Phalcon_Html_Helper_Input_AbstractInput, __toString) { + zval _0, _1, _2, _3; + zval attributes; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&attributes); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdir", NULL, 122, &key); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getkeywithoutprefix", NULL, 124, &key); + zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_1); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "input"); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "/"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rendertag", NULL, 0, &_2, &attributes, &_3); zephir_check_call_status(); - ZEPHIR_CONCAT_VV(return_value, &_0, &_1); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getKeyWithoutPrefix) +static PHP_METHOD(Phalcon_Html_Helper_Input_AbstractInput, setValue) { + zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *key_param = NULL, _0, _1$$3, _2$$3; - zval key; + zval *value_param = NULL, _1$$3; + zval value; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); + zephir_fetch_params(1, 0, 1, &value_param); + if (!value_param) { + ZEPHIR_INIT_VAR(&value); + } else { + zephir_get_strval(&value, value_param); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - if (zephir_start_with(&key, &_0, NULL)) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_2$$3, zephir_fast_strlen_ev(&_1$$3)); - zephir_substr(return_value, &key, zephir_get_intval(&_2$$3), 0, ZEPHIR_SUBSTR_NO_LENGTH); - RETURN_MM(); + _0 = zephir_is_numeric(&value); + if (!(_0)) { + _0 = !(ZEPHIR_IS_EMPTY(&value)); } - RETURN_CTOR(&key); + if (_0) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "value"); + zephir_update_property_array(this_ptr, SL("attributes"), &_1$$3, &value); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getIterator) +zend_object *zephir_init_properties_Phalcon_Html_Helper_Input_AbstractInput(zend_class_entry *class_type) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("attributes"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Checkbox) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Checkbox, phalcon, html_helper_input_checkbox, phalcon_html_helper_input_abstractinput_ce, phalcon_html_helper_input_checkbox_method_entry, 0); + + zend_declare_property_null(phalcon_html_helper_input_checkbox_ce, SL("label"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_input_checkbox_ce, SL("type"), "checkbox", ZEND_ACC_PROTECTED); + phalcon_html_helper_input_checkbox_ce->create_object = zephir_init_properties_Phalcon_Html_Helper_Input_Checkbox; + + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, __construct) { + zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *dir_param = NULL, _0, _1; - zval dir; + zephir_fcall_cache_entry *_0 = NULL; + zval *escaper, escaper_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&dir); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&escaper_sub); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(dir) + Z_PARAM_OBJECT_OF_CLASS(escaper, phalcon_html_escaper_escaperinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &dir_param); - if (UNEXPECTED(Z_TYPE_P(dir_param) != IS_STRING && Z_TYPE_P(dir_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'dir' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(dir_param) == IS_STRING)) { - zephir_get_strval(&dir, dir_param); - } else { - ZEPHIR_INIT_VAR(&dir); - } + zephir_fetch_params(1, 1, 0, &escaper); - object_init_ex(return_value, spl_ce_RecursiveIteratorIterator); - ZEPHIR_INIT_VAR(&_0); - object_init_ex(&_0, spl_ce_RecursiveDirectoryIterator); - ZVAL_LONG(&_1, 4096); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 126, &dir, &_1); - zephir_check_call_status(); - ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 127, &_0, &_1); + ZEPHIR_CALL_PARENT(NULL, phalcon_html_helper_input_checkbox_ce, getThis(), "__construct", &_0, 0, escaper); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 3, 0); + add_assoc_stringl_ex(&_1, SL("start"), SL("")); + add_assoc_stringl_ex(&_1, SL("text"), SL("")); + add_assoc_stringl_ex(&_1, SL("end"), SL("")); + zephir_update_property_zval(this_ptr, ZEND_STRL("label"), &_1); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getPayload) +static PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, __toString) { - zend_bool _10; + zval _2; + zval element, label, unchecked, _1, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_0 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *filepath_param = NULL, __$false, payload, pointer, version, _0, _1, _2, _3, _4, _9, _5$$6, _6$$6, _7$$7, _8$$7; - zval filepath; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filepath); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&payload); - ZVAL_UNDEF(&pointer); - ZVAL_UNDEF(&version); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&label); + ZVAL_UNDEF(&unchecked); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_8$$7); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filepath) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filepath_param); - zephir_get_strval(&filepath, filepath_param); - - ZEPHIR_INIT_VAR(&payload); - ZVAL_BOOL(&payload, 0); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "r"); - ZEPHIR_CALL_METHOD(&pointer, this_ptr, "phpfopen", NULL, 0, &filepath, &_0); - zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&pointer))) { - array_init(return_value); - RETURN_MM(); - } - ZVAL_LONG(&_1, 1); - ZEPHIR_CALL_FUNCTION(&_2, "flock", NULL, 128, &pointer, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processchecked", NULL, 94); zephir_check_call_status(); - if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&_2))) { - ZEPHIR_CALL_METHOD(&payload, this_ptr, "phpfilegetcontents", NULL, 0, &filepath); - zephir_check_call_status(); - } - zephir_fclose(&pointer); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&payload))) { - array_init(return_value); - RETURN_MM(); - } - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); - zephir_check_call_status(); - ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); - ZEPHIR_INIT_NVAR(&_0); - ZVAL_STRING(&_0, "8.0"); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, ">="); - ZEPHIR_CALL_FUNCTION(&_4, "version_compare", NULL, 130, &version, &_0, &_3); - zephir_check_call_status(); - if (zephir_is_true(&_4)) { - ZEPHIR_INIT_VAR(&_5$$6); - ZEPHIR_INIT_NVAR(&_5$$6); - zephir_create_closure_ex(&_5$$6, NULL, phalcon_1__closure_ce, SL("__invoke")); - ZVAL_LONG(&_6$$6, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_5$$6, &_6$$6); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(&_7$$7); - ZEPHIR_INIT_NVAR(&_7$$7); - zephir_create_closure_ex(&_7$$7, NULL, phalcon_2__closure_ce, SL("__invoke")); - ZVAL_LONG(&_8$$7, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_7$$7, &_8$$7); - zephir_check_call_status(); - } - ZEPHIR_CALL_FUNCTION(&_9, "unserialize", NULL, 16, &payload); + ZEPHIR_CALL_METHOD(&unchecked, this_ptr, "processunchecked", NULL, 95); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&payload, &_9); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + ZEPHIR_CALL_PARENT(&element, phalcon_html_helper_input_checkbox_ce, getThis(), "__tostring", &_0, 0); zephir_check_call_status(); - _10 = ZEPHIR_GLOBAL(warning).enable; - if (!(_10)) { - _10 = Z_TYPE_P(&payload) != IS_ARRAY; - } - if (UNEXPECTED(_10)) { - array_init(return_value); - RETURN_MM(); - } - RETURN_CCTOR(&payload); + zephir_read_property(&_1, this_ptr, ZEND_STRL("label"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&label, &_1); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 3, 0); + add_assoc_stringl_ex(&_2, SL("start"), SL("")); + add_assoc_stringl_ex(&_2, SL("text"), SL("")); + add_assoc_stringl_ex(&_2, SL("end"), SL("")); + zephir_update_property_zval(this_ptr, ZEND_STRL("label"), &_2); + zephir_array_fetch_string(&_3, &label, SL("start"), PH_NOISY | PH_READONLY, "phalcon/Html/Helper/Input/Checkbox.zep", 70); + zephir_array_fetch_string(&_4, &label, SL("text"), PH_NOISY | PH_READONLY, "phalcon/Html/Helper/Input/Checkbox.zep", 72); + zephir_array_fetch_string(&_5, &label, SL("end"), PH_NOISY | PH_READONLY, "phalcon/Html/Helper/Input/Checkbox.zep", 72); + ZEPHIR_CONCAT_VVVVV(return_value, &unchecked, &_3, &element, &_4, &_5); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, isExpired) +static PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, label) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *payload_param = NULL, created, ttl, _0, _1, _2, _3, _4; - zval payload; + zval *attributes_param = NULL, text, _0, _2, _3, _5, _6; + zval attributes, _1, _4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&payload); - ZVAL_UNDEF(&created); - ZVAL_UNDEF(&ttl); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&attributes); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(payload) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &payload_param); - ZEPHIR_OBS_COPY_OR_DUP(&payload, payload_param); + zephir_fetch_params(1, 0, 1, &attributes_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } + ZEPHIR_OBS_VAR(&text); + if (!(zephir_array_isset_string_fetch(&text, &attributes, SL("text"), 0))) { + ZEPHIR_INIT_NVAR(&text); + ZVAL_STRING(&text, ""); + } + zephir_array_unset_string(&attributes, SL("text"), PH_SEPARATE); ZEPHIR_INIT_VAR(&_0); - zephir_time(&_0); ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "created"); - ZEPHIR_CALL_METHOD(&created, this_ptr, "getarrval", NULL, 0, &payload, &_1, &_0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "ttl"); - ZVAL_LONG(&_2, 3600); - ZEPHIR_CALL_METHOD(&ttl, this_ptr, "getarrval", NULL, 0, &payload, &_1, &_2); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "forever"); - if (ZEPHIR_IS_IDENTICAL(&_3, &ttl)) { - RETURN_MM_BOOL(0); - } + zephir_create_array(&_1, 1, 0); + zephir_read_property(&_2, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_3); + zephir_array_fetch_string(&_3, &_2, SL("id"), PH_NOISY, "phalcon/Html/Helper/Input/Checkbox.zep", 95); + zephir_array_update_string(&_1, SL("for"), &_3, PH_COPY | PH_SEPARATE); + zephir_fast_array_merge(&_0, &_1, &attributes); + ZEPHIR_CPY_WRT(&attributes, &_0); ZEPHIR_INIT_VAR(&_4); - zephir_add_function(&_4, &created, &ttl); - ZEPHIR_INIT_NVAR(&_1); - zephir_time(&_1); - RETURN_MM_BOOL(ZEPHIR_LT(&_4, &_1)); + zephir_create_array(&_4, 3, 0); + ZEPHIR_INIT_VAR(&_6); + ZVAL_STRING(&_6, "label"); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "rendertag", NULL, 0, &_6, &attributes); + zephir_check_call_status(); + zephir_array_update_string(&_4, SL("start"), &_5, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_4, SL("text"), &text, PH_COPY | PH_SEPARATE); + add_assoc_stringl_ex(&_4, SL("end"), SL("")); + zephir_update_property_zval(this_ptr, ZEND_STRL("label"), &_4); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, storePayload) +static PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, processChecked) { + zval attributes; + zval checked, value, _0, _1$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval key; - zval payload, *payload_param = NULL, *key_param = NULL, __$true, directory, _0, _2, _3, _4, _1$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&payload); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&directory); + ZVAL_UNDEF(&checked); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&key); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ARRAY(payload) - Z_PARAM_STR(key) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1$$6); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &payload_param, &key_param); - zephir_get_arrval(&payload, payload_param); - zephir_get_strval(&key, key_param); - - ZEPHIR_CALL_FUNCTION(&_0, "serialize", NULL, 15, &payload); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&payload, &_0); - ZEPHIR_CALL_METHOD(&directory, this_ptr, "getdir", NULL, 122, &key); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "is_dir", NULL, 133, &directory); - zephir_check_call_status(); - if (!(zephir_is_true(&_0))) { - ZVAL_LONG(&_1$$3, 0777); - ZEPHIR_CALL_FUNCTION(NULL, "mkdir", NULL, 134, &directory, &_1$$3, &__$true); - zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + ZEPHIR_OBS_VAR(&checked); + if (!(zephir_array_isset_string_fetch(&checked, &attributes, SL("checked"), 0))) { + ZEPHIR_INIT_NVAR(&checked); + ZVAL_NULL(&checked); } - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_VV(&_3, &directory, &key); - ZVAL_LONG(&_4, 2); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "phpfileputcontents", NULL, 0, &_3, &payload, &_4); - zephir_check_call_status(); - RETURN_MM_BOOL(!ZEPHIR_IS_FALSE_IDENTICAL(&_2)); + zephir_array_unset_string(&attributes, SL("checked"), PH_SEPARATE); + if (Z_TYPE_P(&checked) != IS_NULL) { + ZEPHIR_OBS_VAR(&value); + if (!(zephir_array_isset_string_fetch(&value, &attributes, SL("value"), 0))) { + ZEPHIR_INIT_NVAR(&value); + ZVAL_NULL(&value); + } + if (ZEPHIR_IS_IDENTICAL(&checked, &value)) { + ZEPHIR_INIT_VAR(&_1$$6); + ZVAL_STRING(&_1$$6, "checked"); + zephir_array_update_string(&attributes, SL("checked"), &_1$$6, PH_COPY | PH_SEPARATE); + } + } + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &attributes); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFileExists) +static PHP_METHOD(Phalcon_Html_Helper_Input_Checkbox, processUnchecked) { + zval attributes, _1$$4; + zval unchecked, _0, _2$$4, _3$$4, _4$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *filename_param = NULL; - zval filename; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filename); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filename) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&unchecked); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1$$4); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filename_param); - zephir_get_strval(&filename, filename_param); - - RETURN_MM_BOOL((zephir_file_exists(&filename) == SUCCESS)); + zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + ZEPHIR_OBS_VAR(&unchecked); + if (!(zephir_array_isset_string_fetch(&unchecked, &attributes, SL("unchecked"), 0))) { + ZEPHIR_INIT_NVAR(&unchecked); + ZVAL_STRING(&unchecked, ""); + } + zephir_array_unset_string(&attributes, SL("unchecked"), PH_SEPARATE); + if (!(ZEPHIR_IS_EMPTY(&unchecked))) { + ZEPHIR_INIT_VAR(&_1$$4); + zephir_create_array(&_1$$4, 2, 0); + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_3$$4); + zephir_array_fetch_string(&_3$$4, &_2$$4, SL("name"), PH_NOISY, "phalcon/Html/Helper/Input/Checkbox.zep", 156); + zephir_array_update_string(&_1$$4, SL("name"), &_3$$4, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_1$$4, SL("value"), &unchecked, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&_4$$4); + ZVAL_STRING(&_4$$4, "hidden"); + ZEPHIR_CALL_METHOD(&unchecked, this_ptr, "rendertag", NULL, 0, &_4$$4, &_1$$4); + zephir_check_call_status(); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &attributes); + RETURN_CCTOR(&unchecked); } -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFileGetContents) +zend_object *zephir_init_properties_Phalcon_Html_Helper_Input_Checkbox(zend_class_entry *class_type) { + zval _0, _2, _1$$3, _3$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *filename_param = NULL; - zval filename; - zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + - ZVAL_UNDEF(&filename); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filename) - ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("attributes"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("label"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("label"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filename_param); - zephir_get_strval(&filename, filename_param); - zephir_file_get_contents(return_value, &filename); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFilePutContents) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Color) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long flags, ZEPHIR_LAST_CALL_STATUS; - zval *filename_param = NULL, *data, data_sub, *flags_param = NULL, *context = NULL, context_sub, __$null, _0; - zval filename; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Color, phalcon, html_helper_input_color, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&filename); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&context_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR(filename) - Z_PARAM_ZVAL(data) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(flags) - Z_PARAM_ZVAL_OR_NULL(context) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_color_ce, SL("type"), "color", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 2, &filename_param, &data, &flags_param, &context); - zephir_get_strval(&filename, filename_param); - if (!flags_param) { - flags = 0; - } else { - flags = zephir_get_intval(flags_param); - } - if (!context) { - context = &context_sub; - context = &__$null; - } - ZVAL_LONG(&_0, flags); - ZEPHIR_RETURN_CALL_FUNCTION("file_put_contents", NULL, 135, &filename, data, &_0, context); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpFopen) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Date) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *filename_param = NULL, *mode_param = NULL; - zval filename, mode; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Date, phalcon, html_helper_input_date, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&filename); - ZVAL_UNDEF(&mode); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(filename) - Z_PARAM_STR(mode) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_date_ce, SL("type"), "date", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &filename_param, &mode_param); - zephir_get_strval(&filename, filename_param); - zephir_get_strval(&mode, mode_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, phpUnlink) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_DateTime) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *filename_param = NULL; - zval filename; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, DateTime, phalcon, html_helper_input_datetime, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&filename); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filename) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_datetime_ce, SL("type"), "datetime", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filename_param); - zephir_get_strval(&filename, filename_param); - ZEPHIR_RETURN_CALL_FUNCTION("unlink", NULL, 119, &filename); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDirFromFile) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_DateTimeLocal) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, name, start, _0, _1, _7, _8, _9, _2$$3, _3$$3, _4$$3, _5$$4, _6$$4; - zval file; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, DateTimeLocal, phalcon, html_helper_input_datetimelocal, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&file); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&start); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(file) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_datetimelocal_ce, SL("type"), "datetime-local", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &file_param); - if (UNEXPECTED(Z_TYPE_P(file_param) != IS_STRING && Z_TYPE_P(file_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'file' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(file_param) == IS_STRING)) { - zephir_get_strval(&file, file_param); - } else { - ZEPHIR_INIT_VAR(&file); - } - ZVAL_LONG(&_0, 8); - ZEPHIR_CALL_FUNCTION(&name, "pathinfo", NULL, 85, &file, &_0); - zephir_check_call_status(); - ZVAL_LONG(&_0, 0); - ZVAL_LONG(&_1, -2); - ZEPHIR_INIT_VAR(&start); - zephir_substr(&start, &name, 0 , -2 , 0); - if (!(ZEPHIR_IS_EMPTY(&start))) { - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_INIT_VAR(&_3$$3); - ZVAL_STRING(&_3$$3, "."); - ZEPHIR_INIT_VAR(&_4$$3); - ZVAL_STRING(&_4$$3, "-"); - zephir_fast_str_replace(&_2$$3, &_3$$3, &_4$$3, &start); - ZEPHIR_CPY_WRT(&start, &_2$$3); - } - if (!(zephir_is_true(&start))) { - ZVAL_LONG(&_5$$4, 0); - ZVAL_LONG(&_6$$4, 1); - ZEPHIR_INIT_NVAR(&start); - zephir_substr(&start, &name, 0 , 1 , 0); - } - ZEPHIR_INIT_VAR(&_7); - ZVAL_LONG(&_8, 2); - ZEPHIR_CALL_FUNCTION(&_9, "str_split", NULL, 84, &start, &_8); - zephir_check_call_status(); - zephir_fast_join_str(&_7, SL("/"), &_9); - ZEPHIR_CONCAT_VS(return_value, &_7, "/"); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDirSeparator) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Email) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *directory_param = NULL, _0, _1; - zval directory; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Email, phalcon, html_helper_input_email, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&directory); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(directory) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_email_ce, SL("type"), "email", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &directory_param); - if (UNEXPECTED(Z_TYPE_P(directory_param) != IS_STRING && Z_TYPE_P(directory_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'directory' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(directory_param) == IS_STRING)) { - zephir_get_strval(&directory, directory_param); - } else { - ZEPHIR_INIT_VAR(&directory); - } - ZEPHIR_INIT_VAR(&_0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "/"); - zephir_fast_trim(&_0, &directory, &_1, ZEPHIR_TRIM_RIGHT); - ZEPHIR_CONCAT_VS(return_value, &_0, "/"); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_File) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, File, phalcon, html_helper_input_file, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + + zend_declare_property_string(phalcon_html_helper_input_file_ce, SL("type"), "file", ZEND_ACC_PROTECTED); + return SUCCESS; } @@ -22917,157 +22566,108 @@ static PHP_METHOD(Phalcon_Storage_Adapter_Stream, getDirSeparator) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_AbstractSerializer) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Hidden) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Storage\\Serializer, AbstractSerializer, phalcon, storage_serializer_abstractserializer, phalcon_storage_serializer_abstractserializer_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Hidden, phalcon, html_helper_input_hidden, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - zend_declare_property_null(phalcon_storage_serializer_abstractserializer_ce, SL("data"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_storage_serializer_abstractserializer_ce, SL("isSuccess"), 1, ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_storage_serializer_abstractserializer_ce, 1, phalcon_storage_serializer_serializerinterface_ce); + zend_declare_property_string(phalcon_html_helper_input_hidden_ce, SL("type"), "hidden", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, __construct) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data = NULL, data_sub, __$null; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(data) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &data); - if (!data) { - data = &data_sub; - data = &__$null; - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setdata", NULL, 0, data); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, __serialize) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Image) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Image, phalcon, html_helper_input_image, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&_0); + zend_declare_property_string(phalcon_html_helper_input_image_ce, SL("type"), "image", ZEND_ACC_PROTECTED); + return SUCCESS; +} - ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - RETURN_MM_MEMBER(getThis(), "data"); - } - array_init(return_value); - RETURN_MM(); + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Input) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Input, phalcon, html_helper_input_input, phalcon_html_helper_input_abstractinput_ce, phalcon_html_helper_input_input_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, __unserialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Input, setType) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *data_param = NULL; - zval data; + zval *type_param = NULL; + zval type; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&type); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(data) + Z_PARAM_STR(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - zephir_get_arrval(&data, data_param); + zephir_fetch_params(1, 1, 0, &type_param); + zephir_get_strval(&type, type_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &data); - ZEPHIR_MM_RESTORE(); + zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &type); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, getData) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "data"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, isSuccess) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "isSuccess"); -} -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, setData) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Month) { - zval *data, data_sub; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Month, phalcon, html_helper_input_month, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&data_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) - ZEND_PARSE_PARAMETERS_END(); -#endif + zend_declare_property_string(phalcon_html_helper_input_month_ce, SL("type"), "month", ZEND_ACC_PROTECTED); + return SUCCESS; +} - zephir_fetch_params_without_memory_grow(1, 0, &data); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, isSerializable) -{ - zend_bool _0, _1; - zval *data, data_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) - ZEND_PARSE_PARAMETERS_END(); -#endif - zephir_fetch_params_without_memory_grow(1, 0, &data); +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Numeric) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Numeric, phalcon, html_helper_input_numeric, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - _0 = Z_TYPE_P(data) == IS_NULL; - if (!(_0)) { - _0 = 1 == (Z_TYPE_P(data) == IS_TRUE || Z_TYPE_P(data) == IS_FALSE); - } - _1 = _0; - if (!(_1)) { - _1 = 1 == zephir_is_numeric(data); - } - RETURN_BOOL(!(_1)); + zend_declare_property_string(phalcon_html_helper_input_numeric_ce, SL("type"), "number", ZEND_ACC_PROTECTED); + return SUCCESS; } @@ -23080,127 +22680,66 @@ static PHP_METHOD(Phalcon_Storage_Serializer_AbstractSerializer, isSerializable) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_Base64) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Password) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, Base64, phalcon, storage_serializer_base64, phalcon_storage_serializer_abstractserializer_ce, phalcon_storage_serializer_base64_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Password, phalcon, html_helper_input_password, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + zend_declare_property_string(phalcon_html_helper_input_password_ce, SL("type"), "password", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_Base64, serialize) -{ - zval _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); - if (Z_TYPE_P(&_0) != IS_STRING) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Data for the serializer must of type string", "phalcon/Storage/Serializer/Base64.zep", 27); - return; - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", NULL, 230, &_1); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Storage_Serializer_Base64, unserialize) + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Radio) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval data_sub, __$true, __$false, result, _0, _1; - zval *data; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Radio, phalcon, html_helper_input_radio, phalcon_html_helper_input_checkbox_ce, NULL, 0); - ZVAL_UNDEF(&data_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_radio_ce, SL("type"), "radio", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - ZEPHIR_INIT_VAR(&_0); - zephir_gettype(&_0, data); - if (!ZEPHIR_IS_STRING_IDENTICAL(&_0, "string")) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Data for the unserializer must of type string", "phalcon/Storage/Serializer/Base64.zep", 47); - return; - } - ZVAL_BOOL(&_1, 1); - ZEPHIR_CALL_METHOD(&result, this_ptr, "phpbase64decode", NULL, 0, data, &_1); - zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&result))) { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - ZEPHIR_INIT_NVAR(&result); - ZVAL_STRING(&result, ""); - } else { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - } - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &result); - ZEPHIR_MM_RESTORE(); -} -static PHP_METHOD(Phalcon_Storage_Serializer_Base64, phpBase64Decode) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Range) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool strict; - zval *input_param = NULL, *strict_param = NULL, _0; - zval input; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Range, phalcon, html_helper_input_range, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - ZVAL_UNDEF(&input); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(input) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(strict) - ZEND_PARSE_PARAMETERS_END(); + zend_declare_property_string(phalcon_html_helper_input_range_ce, SL("type"), "range", ZEND_ACC_PROTECTED); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &input_param, &strict_param); - zephir_get_strval(&input, input_param); - if (!strict_param) { - strict = 0; - } else { - strict = zephir_get_boolval(strict_param); - } - ZVAL_BOOL(&_0, (strict ? 1 : 0)); - ZEPHIR_RETURN_CALL_FUNCTION("base64_decode", NULL, 229, &input, &_0); - zephir_check_call_status(); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Search) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Search, phalcon, html_helper_input_search, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + + zend_declare_property_string(phalcon_html_helper_input_search_ce, SL("type"), "search", ZEND_ACC_PROTECTED); + return SUCCESS; } @@ -23213,467 +22752,403 @@ static PHP_METHOD(Phalcon_Storage_Serializer_Base64, phpBase64Decode) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_Igbinary) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Select) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, Igbinary, phalcon, storage_serializer_igbinary, phalcon_storage_serializer_abstractserializer_ce, phalcon_storage_serializer_igbinary_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Select, phalcon, html_helper_input_select, phalcon_html_helper_abstractlist_ce, phalcon_html_helper_input_select_method_entry, 0); + zend_declare_property_string(phalcon_html_helper_input_select_ce, SL("elementTag"), "option", ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_html_helper_input_select_ce, SL("inOptGroup"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_helper_input_select_ce, SL("selected"), "", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, serialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, result, _0, _1, _2; zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool raw; + zval attributes, _1, _3; + zval *text_param = NULL, *value_param = NULL, *attributes_param = NULL, *raw_param = NULL, _0, _2, _4, _5; + zval text, value; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(text) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(value) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); - - zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isserializable", NULL, 0, &_1); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETURN_MM_MEMBER(getThis(), "data"); + zephir_fetch_params(1, 1, 3, &text_param, &value_param, &attributes_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!value_param) { + ZEPHIR_INIT_VAR(&value); + } else { + zephir_get_strval(&value, value_param); } - zephir_read_property(&_2, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, this_ptr, "doserialize", NULL, 0, &_2); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&result) == IS_NULL)) { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - ZEPHIR_INIT_NVAR(&result); - ZVAL_STRING(&result, ""); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } + zephir_get_arrval(&attributes, attributes_param); } - RETURN_CCTOR(&result); + if (!raw_param) { + raw = 0; + } else { + raw = zephir_get_boolval(raw_param); + } + + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "processvalue", NULL, 330, &attributes, &value); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&attributes, &_0); + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 3, 0); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "renderFullElement"); + zephir_array_fast_append(&_1, &_2); + ZEPHIR_INIT_VAR(&_3); + zephir_create_array(&_3, 4, 0); + ZEPHIR_OBS_VAR(&_4); + zephir_read_property(&_4, this_ptr, ZEND_STRL("elementTag"), PH_NOISY_CC); + zephir_array_fast_append(&_3, &_4); + zephir_array_fast_append(&_3, &text); + zephir_array_fast_append(&_3, &attributes); + ZEPHIR_INIT_NVAR(&_2); + ZVAL_BOOL(&_2, raw); + zephir_array_fast_append(&_3, &_2); + zephir_array_fast_append(&_1, &_3); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "indent", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_1, &_5); + zephir_update_property_array_append(this_ptr, SL("store"), &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, unserialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, addPlaceholder) { - zend_bool _8$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval data_sub, __$false, __$true, result, version, _0, _1$$4, _2$$4, _3$$4, _4$$5, _5$$5, _6$$6, _7$$6; - zval *data; + zend_bool raw; + zval attributes, _1, _3; + zval *text_param = NULL, *value = NULL, value_sub, *attributes_param = NULL, *raw_param = NULL, __$null, _2, _4, _5; + zval text, _0$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_BOOL(&__$false, 0); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&version); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&text); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(text) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_ARRAY(attributes) + Z_PARAM_BOOL(raw) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isserializable", NULL, 0, data); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); + zephir_fetch_params(1, 1, 3, &text_param, &value, &attributes_param, &raw_param); + zephir_get_strval(&text, text_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); - zephir_check_call_status(); - ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); - ZEPHIR_INIT_VAR(&_1$$4); - ZVAL_STRING(&_1$$4, "8.0"); - ZEPHIR_INIT_VAR(&_2$$4); - ZVAL_STRING(&_2$$4, ">="); - ZEPHIR_CALL_FUNCTION(&_3$$4, "version_compare", NULL, 130, &version, &_1$$4, &_2$$4); - zephir_check_call_status(); - if (zephir_is_true(&_3$$4)) { - ZEPHIR_INIT_VAR(&_4$$5); - ZEPHIR_INIT_NVAR(&_4$$5); - zephir_create_closure_ex(&_4$$5, NULL, phalcon_3__closure_ce, SL("__invoke")); - ZVAL_LONG(&_5$$5, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_4$$5, &_5$$5); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(&_6$$6); - ZEPHIR_INIT_NVAR(&_6$$6); - zephir_create_closure_ex(&_6$$6, NULL, phalcon_4__closure_ce, SL("__invoke")); - ZVAL_LONG(&_7$$6, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_6$$6, &_7$$6); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&result, this_ptr, "dounserialize", NULL, 0, data); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); - zephir_check_call_status(); - _8$$4 = ZEPHIR_GLOBAL(warning).enable; - if (!(_8$$4)) { - _8$$4 = ZEPHIR_IS_FALSE_IDENTICAL(&result); - } - if (UNEXPECTED(_8$$4)) { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - ZEPHIR_INIT_NVAR(&result); - ZVAL_STRING(&result, ""); - } else { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - } - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &result); + zephir_get_arrval(&attributes, attributes_param); + } + if (!raw_param) { + raw = 0; + } else { + raw = zephir_get_boolval(raw_param); } - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, phpIgbinarySerialize) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); - ZEPHIR_RETURN_CALL_FUNCTION("igbinary_serialize", NULL, 137, value); + if (Z_TYPE_P(value) != IS_NULL) { + zephir_cast_to_string(&_0$$3, value); + zephir_array_update_string(&attributes, SL("value"), &_0$$3, PH_COPY | PH_SEPARATE); + } + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 3, 0); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "renderFullElement"); + zephir_array_fast_append(&_1, &_2); + ZEPHIR_INIT_VAR(&_3); + zephir_create_array(&_3, 4, 0); + ZEPHIR_OBS_VAR(&_4); + zephir_read_property(&_4, this_ptr, ZEND_STRL("elementTag"), PH_NOISY_CC); + zephir_array_fast_append(&_3, &_4); + zephir_array_fast_append(&_3, &text); + zephir_array_fast_append(&_3, &attributes); + ZEPHIR_INIT_NVAR(&_2); + ZVAL_BOOL(&_2, raw); + zephir_array_fast_append(&_3, &_2); + zephir_array_fast_append(&_1, &_3); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "indent", NULL, 0); zephir_check_call_status(); - RETURN_MM(); + zephir_array_fast_append(&_1, &_5); + zephir_update_property_array_append(this_ptr, SL("store"), &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, doSerialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, optGroup) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub; + zval attributes, _1$$3, _3$$3, _8$$4; + zval *label_param = NULL, *attributes_param = NULL, __$true, __$false, _0, _11, _2$$3, _4$$3, _5$$3, _6$$4, _7$$4, _9$$4, _10$$4; + zval label; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&label); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_8$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(label) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); + zephir_fetch_params(1, 0, 2, &label_param, &attributes_param); + if (!label_param) { + ZEPHIR_INIT_VAR(&label); + } else { + zephir_get_strval(&label, label_param); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "phpigbinaryserialize", NULL, 0, value); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("inOptGroup"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_0))) { + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 3, 0); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "optGroupStart"); + zephir_array_fast_append(&_1$$3, &_2$$3); + ZEPHIR_INIT_VAR(&_3$$3); + zephir_create_array(&_3$$3, 2, 0); + zephir_array_fast_append(&_3$$3, &label); + zephir_array_fast_append(&_3$$3, &attributes); + zephir_array_fast_append(&_1$$3, &_3$$3); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "indent", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_1$$3, &_4$$3); + zephir_update_property_array_append(this_ptr, SL("store"), &_1$$3); + ZEPHIR_INIT_NVAR(&_2$$3); + ZVAL_LONG(&_2$$3, 1); + zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("indentLevel"), PH_NOISY_CC); + ZEPHIR_ADD_ASSIGN(&_5$$3, &_2$$3) + zephir_update_property_zval(this_ptr, ZEND_STRL("indentLevel"), &_5$$3); + } else { + ZEPHIR_INIT_VAR(&_7$$4); + ZVAL_LONG(&_7$$4, 1); + zephir_read_property(&_6$$4, this_ptr, ZEND_STRL("indentLevel"), PH_NOISY_CC); + ZEPHIR_SUB_ASSIGN(&_6$$4, &_7$$4) + zephir_update_property_zval(this_ptr, ZEND_STRL("indentLevel"), &_6$$4); + ZEPHIR_INIT_VAR(&_8$$4); + zephir_create_array(&_8$$4, 3, 0); + ZEPHIR_INIT_VAR(&_9$$4); + ZVAL_STRING(&_9$$4, "optGroupEnd"); + zephir_array_fast_append(&_8$$4, &_9$$4); + ZEPHIR_INIT_NVAR(&_9$$4); + array_init(&_9$$4); + zephir_array_fast_append(&_8$$4, &_9$$4); + ZEPHIR_CALL_METHOD(&_10$$4, this_ptr, "indent", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_8$$4, &_10$$4); + zephir_update_property_array_append(this_ptr, SL("store"), &_8$$4); + } + ZEPHIR_OBS_VAR(&_11); + zephir_read_property(&_11, this_ptr, ZEND_STRL("inOptGroup"), PH_NOISY_CC); + if (!zephir_is_true(&_11)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("inOptGroup"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("inOptGroup"), &__$false); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Igbinary, doUnserialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, selected) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub; + zval *selected_param = NULL; + zval selected; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&selected); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + Z_PARAM_STR(selected) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); - - - ZEPHIR_RETURN_CALL_FUNCTION("igbinary_unserialize", NULL, 138, value); - zephir_check_call_status(); - RETURN_MM(); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - + zephir_fetch_params(1, 1, 0, &selected_param); + zephir_get_strval(&selected, selected_param); -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_Json) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, Json, phalcon, storage_serializer_json, phalcon_storage_serializer_abstractserializer_ce, phalcon_storage_serializer_json_method_entry, 0); - return SUCCESS; + zephir_update_property_zval(this_ptr, ZEND_STRL("selected"), &selected); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Json, serialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, getTag) { - zval _4$$3; - zend_bool _1; - zval _0, _2, _5, _6, _7, _3$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - - ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); - _1 = Z_TYPE_P(&_0) == IS_OBJECT; - if (_1) { - ZEPHIR_OBS_VAR(&_2); - zephir_read_property(&_2, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); - _1 = !(zephir_is_instance_of(&_2, SL("JsonSerializable"))); - } - if (_1) { - ZEPHIR_INIT_VAR(&_3$$3); - object_init_ex(&_3$$3, spl_ce_InvalidArgumentException); - ZEPHIR_INIT_VAR(&_4$$3); - ZEPHIR_CONCAT_SS(&_4$$3, "Data for the JSON serializer cannot be of type 'object' ", "without implementing 'JsonSerializable'"); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 195, &_4$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$3, "phalcon/Storage/Serializer/Json.zep", 29); - ZEPHIR_MM_RESTORE(); - return; - } - zephir_read_property(&_6, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "isserializable", NULL, 0, &_6); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_5)) { - RETURN_MM_MEMBER(getThis(), "data"); - } - zephir_read_property(&_7, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getencode", NULL, 0, &_7); - zephir_check_call_status(); - RETURN_MM(); + RETURN_STRING("select"); } -static PHP_METHOD(Phalcon_Storage_Serializer_Json, unserialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, optGroupEnd) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval data_sub, _0, _1$$4; - zval *data; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isserializable", NULL, 0, data); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); - } else { - ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getdecode", NULL, 0, data); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &_1$$4); - } - ZEPHIR_MM_RESTORE(); + RETURN_STRING(""); } -static PHP_METHOD(Phalcon_Storage_Serializer_Json, getDecode) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, optGroupStart) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long depth, options, ZEPHIR_LAST_CALL_STATUS; - zend_bool associative; - zval *data_param = NULL, *associative_param = NULL, *depth_param = NULL, *options_param = NULL, decoded, _0, _1, _2, _3, _4$$3, _5$$3, _6$$3; - zval data; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval attributes; + zval *label_param = NULL, *attributes_param = NULL, _0; + zval label; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&decoded); + ZVAL_UNDEF(&label); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(data) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(associative) - Z_PARAM_LONG(depth) - Z_PARAM_LONG(options) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(label) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &data_param, &associative_param, &depth_param, &options_param); - if (UNEXPECTED(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(data_param) == IS_STRING)) { - zephir_get_strval(&data, data_param); - } else { - ZEPHIR_INIT_VAR(&data); - } - if (!associative_param) { - associative = 0; - } else { - associative = zephir_get_boolval(associative_param); - } - if (!depth_param) { - depth = 512; - } else { - depth = zephir_get_intval(depth_param); - } - if (!options_param) { - options = 0; - } else { - options = zephir_get_intval(options_param); - } + zephir_fetch_params(1, 2, 0, &label_param, &attributes_param); + zephir_get_strval(&label, label_param); + zephir_get_arrval(&attributes, attributes_param); - ZVAL_BOOL(&_0, (associative ? 1 : 0)); - ZVAL_LONG(&_1, depth); - ZVAL_LONG(&_2, options); - ZEPHIR_INIT_VAR(&decoded); - zephir_json_decode(&decoded, &data, zephir_get_intval(&_0) ); - ZEPHIR_CALL_FUNCTION(&_3, "json_last_error", NULL, 193); + zephir_array_update_string(&attributes, SL("label"), &label, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "optgroup"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rendertag", NULL, 0, &_0, &attributes); zephir_check_call_status(); - if (!ZEPHIR_IS_LONG_IDENTICAL(&_3, 0)) { - ZEPHIR_INIT_VAR(&_4$$3); - object_init_ex(&_4$$3, spl_ce_InvalidArgumentException); - ZEPHIR_CALL_FUNCTION(&_5$$3, "json_last_error_msg", NULL, 194); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6$$3); - ZEPHIR_CONCAT_SV(&_6$$3, "json_decode error: ", &_5$$3); - ZEPHIR_CALL_METHOD(NULL, &_4$$3, "__construct", NULL, 195, &_6$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_4$$3, "phalcon/Storage/Serializer/Json.zep", 71); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_CCTOR(&decoded); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Json, getEncode) +static PHP_METHOD(Phalcon_Html_Helper_Input_Select, processValue) { + zend_bool _0, _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long options, depth, ZEPHIR_LAST_CALL_STATUS; - zval *data, data_sub, *options_param = NULL, *depth_param = NULL, encoded, _0, _1, _2, _3$$3, _4$$3, _5$$3; + zval *attributes_param = NULL, *value = NULL, value_sub, __$null, _1$$3, _3$$3, _4$$4; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&encoded); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_4$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(attributes) Z_PARAM_OPTIONAL - Z_PARAM_LONG(options) - Z_PARAM_LONG(depth) + Z_PARAM_ZVAL_OR_NULL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &data, &options_param, &depth_param); - if (!options_param) { - options = 0; - } else { - options = zephir_get_intval(options_param); - } - if (!depth_param) { - depth = 512; - } else { - depth = zephir_get_intval(depth_param); + zephir_fetch_params(1, 1, 1, &attributes_param, &value); + zephir_get_arrval(&attributes, attributes_param); + if (!value) { + value = &value_sub; + value = &__$null; } - ZVAL_LONG(&_0, options); - ZVAL_LONG(&_1, depth); - ZEPHIR_INIT_VAR(&encoded); - zephir_json_encode(&encoded, data, zephir_get_intval(&_0) ); - ZEPHIR_CALL_FUNCTION(&_2, "json_last_error", NULL, 193); - zephir_check_call_status(); - if (!ZEPHIR_IS_LONG_IDENTICAL(&_2, 0)) { - ZEPHIR_INIT_VAR(&_3$$3); - object_init_ex(&_3$$3, spl_ce_InvalidArgumentException); - ZEPHIR_CALL_FUNCTION(&_4$$3, "json_last_error_msg", NULL, 194); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_5$$3); - ZEPHIR_CONCAT_SV(&_5$$3, "json_encode error: ", &_4$$3); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 195, &_5$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$3, "phalcon/Storage/Serializer/Json.zep", 92); - ZEPHIR_MM_RESTORE(); - return; + _0 = zephir_is_numeric(value); + if (!(_0)) { + _0 = !(ZEPHIR_IS_EMPTY(value)); + } + if (_0) { + zephir_array_update_string(&attributes, SL("value"), value, PH_COPY | PH_SEPARATE); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("selected"), PH_NOISY_CC | PH_READONLY); + _2$$3 = !(ZEPHIR_IS_EMPTY(&_1$$3)); + if (_2$$3) { + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("selected"), PH_NOISY_CC | PH_READONLY); + _2$$3 = ZEPHIR_IS_IDENTICAL(value, &_3$$3); + } + if (_2$$3) { + ZEPHIR_INIT_VAR(&_4$$4); + ZVAL_STRING(&_4$$4, "selected"); + zephir_array_update_string(&attributes, SL("selected"), &_4$$4, PH_COPY | PH_SEPARATE); + } } - RETURN_CCTOR(&encoded); + RETURN_CTOR(&attributes); } @@ -23686,10 +23161,11 @@ static PHP_METHOD(Phalcon_Storage_Serializer_Json, getEncode) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedIgbinary) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Submit) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, MemcachedIgbinary, phalcon, storage_serializer_memcachedigbinary, phalcon_storage_serializer_none_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Submit, phalcon, html_helper_input_submit, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + zend_declare_property_string(phalcon_html_helper_input_submit_ce, SL("type"), "submit", ZEND_ACC_PROTECTED); return SUCCESS; } @@ -23703,10 +23179,11 @@ ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedIgbinary) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedJson) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Tel) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, MemcachedJson, phalcon, storage_serializer_memcachedjson, phalcon_storage_serializer_none_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Tel, phalcon, html_helper_input_tel, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + zend_declare_property_string(phalcon_html_helper_input_tel_ce, SL("type"), "tel", ZEND_ACC_PROTECTED); return SUCCESS; } @@ -23720,9 +23197,9 @@ ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedJson) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedPhp) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Text) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, MemcachedPhp, phalcon, storage_serializer_memcachedphp, phalcon_storage_serializer_none_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Text, phalcon, html_helper_input_text, phalcon_html_helper_input_abstractinput_ce, NULL, 0); return SUCCESS; } @@ -23737,63 +23214,65 @@ ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_MemcachedPhp) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_Msgpack) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Textarea) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, Msgpack, phalcon, storage_serializer_msgpack, phalcon_storage_serializer_igbinary_ce, phalcon_storage_serializer_msgpack_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Textarea, phalcon, html_helper_input_textarea, phalcon_html_helper_input_abstractinput_ce, phalcon_html_helper_input_textarea_method_entry, 0); + zend_declare_property_string(phalcon_html_helper_input_textarea_ce, SL("type"), "textarea", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_Msgpack, doSerialize) +static PHP_METHOD(Phalcon_Html_Helper_Input_Textarea, __toString) { + zval attributes; + zval value, _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("msgpack_pack", NULL, 0, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_1); + ZEPHIR_OBS_VAR(&value); + if (!(zephir_array_isset_string_fetch(&value, &attributes, SL("value"), 0))) { + ZEPHIR_INIT_NVAR(&value); + ZVAL_STRING(&value, ""); + } + zephir_array_unset_string(&attributes, SL("type"), PH_SEPARATE); + zephir_array_unset_string(&attributes, SL("value"), PH_SEPARATE); + zephir_read_property(&_2, this_ptr, ZEND_STRL("type"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderfullelement", NULL, 0, &_2, &value, &attributes); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Msgpack, doUnserialize) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); - ZEPHIR_RETURN_CALL_FUNCTION("msgpack_unpack", NULL, 0, value); - zephir_check_call_status(); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Time) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Time, phalcon, html_helper_input_time, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + + zend_declare_property_string(phalcon_html_helper_input_time_ce, SL("type"), "time", ZEND_ACC_PROTECTED); + return SUCCESS; } @@ -23806,41 +23285,30 @@ static PHP_METHOD(Phalcon_Storage_Serializer_Msgpack, doUnserialize) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_None) +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Url) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, None, phalcon, storage_serializer_none, phalcon_storage_serializer_abstractserializer_ce, phalcon_storage_serializer_none_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Url, phalcon, html_helper_input_url, phalcon_html_helper_input_abstractinput_ce, NULL, 0); + zend_declare_property_string(phalcon_html_helper_input_url_ce, SL("type"), "url", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_None, serialize) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "data"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Storage_Serializer_None, unserialize) -{ - zval data_sub; - zval *data; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) - ZEND_PARSE_PARAMETERS_END(); -#endif - zephir_fetch_params_without_memory_grow(1, 0, &data); +ZEPHIR_INIT_CLASS(Phalcon_Html_Helper_Input_Week) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Helper\\Input, Week, phalcon, html_helper_input_week, phalcon_html_helper_input_abstractinput_ce, NULL, 0); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); + zend_declare_property_string(phalcon_html_helper_input_week_ce, SL("type"), "week", ZEND_ACC_PROTECTED); + return SUCCESS; } @@ -23853,272 +23321,362 @@ static PHP_METHOD(Phalcon_Storage_Serializer_None, unserialize) -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_Php) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_AbstractLink) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, Php, phalcon, storage_serializer_php, phalcon_storage_serializer_abstractserializer_ce, phalcon_storage_serializer_php_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Html\\Link, AbstractLink, phalcon, html_link_abstractlink, phalcon_html_link_abstractlink_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_declare_property_null(phalcon_html_link_abstractlink_ce, SL("attributes"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_html_link_abstractlink_ce, SL("href"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_html_link_abstractlink_ce, SL("rels"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_html_link_abstractlink_ce, SL("templated"), 0, ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Storage_Serializer_Php, serialize) -{ - zval _0, _1, _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); - - zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isserializable", NULL, 0, &_1); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - RETURN_MM_MEMBER(getThis(), "data"); - } - zephir_read_property(&_2, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 15, &_2); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Storage_Serializer_Php, unserialize) +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, __construct) { - zend_bool _8; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval data_sub, __$false, __$true, result, version, _0, _1, _2, _3, _4$$4, _5$$4, _6$$5, _7$$5; - zval *data; + zval attributes; + zval *rel_param = NULL, *href_param = NULL, *attributes_param = NULL, _0, _1, _2, _3$$3, _4$$3; + zval rel, href; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_BOOL(&__$false, 0); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&version); + ZVAL_UNDEF(&rel); + ZVAL_UNDEF(&href); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_START(0, 3) + Z_PARAM_OPTIONAL + Z_PARAM_STR(rel) + Z_PARAM_STR(href) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data); + zephir_fetch_params(1, 0, 3, &rel_param, &href_param, &attributes_param); + if (!rel_param) { + ZEPHIR_INIT_VAR(&rel); + ZVAL_STRING(&rel, ""); + } else { + zephir_get_strval(&rel, rel_param); + } + if (!href_param) { + ZEPHIR_INIT_VAR(&href); + ZVAL_STRING(&href, ""); + } else { + zephir_get_strval(&href, href_param); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isserializable", NULL, 0, data); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), data); - RETURN_MM_NULL(); - } - ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 129); + ZEPHIR_INIT_VAR(&_0); + object_init_ex(&_0, phalcon_support_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 22, &attributes); zephir_check_call_status(); - ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); + zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_0); ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "8.0"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ">="); - ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 130, &version, &_1, &_2); - zephir_check_call_status(); - if (zephir_is_true(&_3)) { - ZEPHIR_INIT_VAR(&_4$$4); - ZEPHIR_INIT_NVAR(&_4$$4); - zephir_create_closure_ex(&_4$$4, NULL, phalcon_11__closure_ce, SL("__invoke")); - ZVAL_LONG(&_5$$4, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_4$$4, &_5$$4); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_VAR(&_6$$5); - ZEPHIR_INIT_NVAR(&_6$$5); - zephir_create_closure_ex(&_6$$5, NULL, phalcon_12__closure_ce, SL("__invoke")); - ZVAL_LONG(&_7$$5, 8); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 131, &_6$$5, &_7$$5); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&result, this_ptr, "phpunserialize", NULL, 0, data); + object_init_ex(&_1, phalcon_support_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 22); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 132); + zephir_update_property_zval(this_ptr, ZEND_STRL("rels"), &_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("href"), &href); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "hrefistemplated", NULL, 0, &href); zephir_check_call_status(); - _8 = ZEPHIR_GLOBAL(warning).enable; - if (!(_8)) { - _8 = ZEPHIR_IS_FALSE_IDENTICAL(&result); - } - if (UNEXPECTED(_8)) { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } - ZEPHIR_INIT_NVAR(&result); - ZVAL_STRING(&result, ""); - } else { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("isSuccess"), &__$false); - } + zephir_update_property_zval(this_ptr, ZEND_STRL("templated"), &_2); + if (1 != ZEPHIR_IS_EMPTY(&rel)) { + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("rels"), PH_NOISY_CC | PH_READONLY); + ZVAL_BOOL(&_4$$3, 1); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "set", NULL, 0, &rel, &_4$$3); + zephir_check_call_status(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &result); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Storage_Serializer_Php, phpUnserialize) +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doGetAttributes) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *data_param = NULL, *options_param = NULL; - zval data; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&options); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(data) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &data_param, &options_param); - zephir_get_strval(&data, data_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); - } - - ZEPHIR_RETURN_CALL_FUNCTION("unserialize", NULL, 16, &data, &options); + zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "toarray", NULL, 0); zephir_check_call_status(); RETURN_MM(); } +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doGetHref) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif - + RETURN_MEMBER(getThis(), "href"); +} +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doGetRels) +{ + zval _0, _1; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_RedisIgbinary) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, RedisIgbinary, phalcon, storage_serializer_redisigbinary, phalcon_storage_serializer_none_ce, NULL, 0); + ZEPHIR_MM_GROW(); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("rels"), PH_NOISY_CC | PH_READONLY); + ZVAL_BOOL(&_1, 0); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getkeys", NULL, 0, &_1); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doIsTemplated) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(getThis(), "templated"); +} +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, hrefIsTemplated) +{ + zend_bool _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *href_param = NULL, _0, _1, _3; + zval href; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&href); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(href) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &href_param); + zephir_get_strval(&href, href_param); -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_RedisJson) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, RedisJson, phalcon, storage_serializer_redisjson, phalcon_storage_serializer_none_ce, NULL, 0); - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "{"); + ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 85, &href, &_0); + zephir_check_call_status(); + _2 = !ZEPHIR_IS_FALSE_IDENTICAL(&_1); + if (_2) { + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "}"); + ZEPHIR_CALL_FUNCTION(&_3, "mb_strpos", NULL, 85, &href, &_0); + zephir_check_call_status(); + _2 = !ZEPHIR_IS_FALSE_IDENTICAL(&_3); + } + RETURN_MM_BOOL(_2); } +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doWithAttribute) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *value, value_sub, newInstance, _0; + zval key; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + zephir_get_strval(&key, key_param); - -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_RedisMsgpack) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, RedisMsgpack, phalcon, storage_serializer_redismsgpack, phalcon_storage_serializer_none_ce, NULL, 0); - - return SUCCESS; + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_read_property(&_0, &newInstance, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "set", NULL, 0, &key, value); + zephir_check_call_status(); + RETURN_CCTOR(&newInstance); } +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doWithHref) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *href_param = NULL, newInstance, _0; + zval href; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&href); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(href) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &href_param); + zephir_get_strval(&href, href_param); - -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_RedisNone) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, RedisNone, phalcon, storage_serializer_redisnone, phalcon_storage_serializer_none_ce, NULL, 0); - - return SUCCESS; + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_update_property_zval(&newInstance, ZEND_STRL("href"), &href); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hrefistemplated", NULL, 0, &href); + zephir_check_call_status(); + zephir_update_property_zval(&newInstance, ZEND_STRL("templated"), &_0); + RETURN_CCTOR(&newInstance); } +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doWithRel) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, newInstance, _0, _1; + zval key; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_read_property(&_0, &newInstance, ZEND_STRL("rels"), PH_NOISY_CC | PH_READONLY); + ZVAL_BOOL(&_1, 1); + ZEPHIR_CALL_METHOD(NULL, &_0, "set", NULL, 0, &key, &_1); + zephir_check_call_status(); + RETURN_CCTOR(&newInstance); +} -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_RedisPhp) +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doWithoutAttribute) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Storage\\Serializer, RedisPhp, phalcon, storage_serializer_redisphp, phalcon_storage_serializer_none_ce, NULL, 0); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, newInstance, _0; + zval key; + zval *this_ptr = getThis(); - return SUCCESS; -} + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_read_property(&_0, &newInstance, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &key); + zephir_check_call_status(); + RETURN_CCTOR(&newInstance); +} +static PHP_METHOD(Phalcon_Html_Link_AbstractLink, doWithoutRel) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, newInstance, _0; + zval key; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); -ZEPHIR_INIT_CLASS(Phalcon_Storage_Serializer_SerializerInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Storage\\Serializer, SerializerInterface, phalcon, storage_serializer_serializerinterface, phalcon_storage_serializer_serializerinterface_method_entry); - zend_class_implements(phalcon_storage_serializer_serializerinterface_ce, 1, zend_ce_serializable); - return SUCCESS; + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_read_property(&_0, &newInstance, ZEND_STRL("rels"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &key); + zephir_check_call_status(); + RETURN_CCTOR(&newInstance); } -ZEPHIR_DOC_METHOD(Phalcon_Storage_Serializer_SerializerInterface, getData); -ZEPHIR_DOC_METHOD(Phalcon_Storage_Serializer_SerializerInterface, setData); @@ -24129,538 +23687,290 @@ ZEPHIR_DOC_METHOD(Phalcon_Storage_Serializer_SerializerInterface, setData); -ZEPHIR_INIT_CLASS(Phalcon_Cli_Console) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_AbstractLinkProvider) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli, Console, phalcon, cli_console, phalcon_application_abstractapplication_ce, phalcon_cli_console_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Html\\Link, AbstractLinkProvider, phalcon, html_link_abstractlinkprovider, phalcon_html_link_abstractlinkprovider_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - zend_declare_property_null(phalcon_cli_console_ce, SL("arguments"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_console_ce, SL("options"), ZEND_ACC_PROTECTED); - phalcon_cli_console_ce->create_object = zephir_init_properties_Phalcon_Cli_Console; + zend_declare_property_null(phalcon_html_link_abstractlinkprovider_ce, SL("links"), ZEND_ACC_PROTECTED); + phalcon_html_link_abstractlinkprovider_ce->create_object = zephir_init_properties_Phalcon_Html_Link_AbstractLinkProvider; return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Console, handle) +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, __construct) { - zend_bool _8; + zend_bool _5$$3, _11$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_8 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *arguments_param = NULL, __$false, className, dispatcher, module, moduleName, moduleObject, modules, path, router, task, _0, _1, _5, _6, _7, _9, _26, _27, _28, _29, _30, _31, _35, _2$$4, _3$$4, _4$$4, _10$$6, _11$$9, _15$$9, _20$$9, _21$$9, _22$$9, _12$$10, _13$$10, _14$$10, _16$$12, _17$$12, _18$$16, _19$$16, _23$$18, _24$$18, _25$$18, _32$$20, _33$$20, _34$$20, _36$$22, _37$$22; - zval arguments; + zval *links_param = NULL, link, *_0, _1, _2$$3, _3$$3, _6$$3, _7$$4, _9$$5, _10$$5, _12$$5, _13$$6; + zval links; zval *this_ptr = getThis(); - ZVAL_UNDEF(&arguments); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&dispatcher); - ZVAL_UNDEF(&module); - ZVAL_UNDEF(&moduleName); - ZVAL_UNDEF(&moduleObject); - ZVAL_UNDEF(&modules); - ZVAL_UNDEF(&path); - ZVAL_UNDEF(&router); - ZVAL_UNDEF(&task); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&links); + ZVAL_UNDEF(&link); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_26); - ZVAL_UNDEF(&_27); - ZVAL_UNDEF(&_28); - ZVAL_UNDEF(&_29); - ZVAL_UNDEF(&_30); - ZVAL_UNDEF(&_31); - ZVAL_UNDEF(&_35); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$9); - ZVAL_UNDEF(&_15$$9); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&_21$$9); - ZVAL_UNDEF(&_22$$9); - ZVAL_UNDEF(&_12$$10); - ZVAL_UNDEF(&_13$$10); - ZVAL_UNDEF(&_14$$10); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$16); - ZVAL_UNDEF(&_19$$16); - ZVAL_UNDEF(&_23$$18); - ZVAL_UNDEF(&_24$$18); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&_32$$20); - ZVAL_UNDEF(&_33$$20); - ZVAL_UNDEF(&_34$$20); - ZVAL_UNDEF(&_36$$22); - ZVAL_UNDEF(&_37$$22); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$5); + ZVAL_UNDEF(&_10$$5); + ZVAL_UNDEF(&_12$$5); + ZVAL_UNDEF(&_13$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(arguments) + Z_PARAM_ARRAY(links) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &arguments_param); - if (!arguments_param) { - ZEPHIR_INIT_VAR(&arguments); + zephir_fetch_params(1, 0, 1, &links_param); + if (!links_param) { + ZEPHIR_INIT_VAR(&links); + array_init(&links); } else { - zephir_get_arrval(&arguments, arguments_param); + zephir_get_arrval(&links, links_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "A dependency injection container is required to access internal services", "phalcon/Cli/Console.zep", 45); - return; - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_1) != IS_NULL) { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_4$$4); - ZVAL_STRING(&_4$$4, "console:boot"); - ZEPHIR_CALL_METHOD(&_3$$4, &_2$$4, "fire", NULL, 0, &_4$$4, this_ptr); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_3$$4)) { - RETURN_MM_BOOL(0); - } - } - zephir_read_property(&_5, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_7); - ZVAL_STRING(&_7, "router"); - ZEPHIR_CALL_METHOD(&_6, &_5, "getshared", NULL, 0, &_7); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&router, &_6); - _8 = !(zephir_fast_count_int(&arguments)); - if (_8) { - zephir_read_property(&_9, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - _8 = zephir_is_true(&_9); - } - if (_8) { - zephir_read_property(&_10$$6, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &_10$$6); - zephir_check_call_status(); + zephir_is_iterable(&links, 0, "phalcon/Html/Link/AbstractLinkProvider.zep", 42); + if (Z_TYPE_P(&links) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&links), _0) + { + ZEPHIR_INIT_NVAR(&link); + ZVAL_COPY(&link, _0); + ZEPHIR_INIT_NVAR(&_2$$3); + ZVAL_STRING(&_2$$3, "Phalcon\\Html\\Link\\Interfaces\\LinkInterface"); + ZEPHIR_CALL_FUNCTION(&_3$$3, "is_a", &_4, 86, &link, &_2$$3); + zephir_check_call_status(); + _5$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_3$$3); + if (!(_5$$3)) { + ZEPHIR_INIT_NVAR(&_2$$3); + ZVAL_STRING(&_2$$3, "Psr\\Link\\LinkInterface"); + ZEPHIR_CALL_FUNCTION(&_6$$3, "is_a", &_4, 86, &link, &_2$$3); + zephir_check_call_status(); + _5$$3 = ZEPHIR_IS_TRUE_IDENTICAL(&_6$$3); + } + if (_5$$3) { + ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "getkey", &_8, 0, &link); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("links"), &_7$$4, &link); + } + } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &arguments); + ZEPHIR_CALL_METHOD(NULL, &links, "rewind", NULL, 0); zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&moduleName, &router, "getmodulename", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(&moduleName))) { - ZEPHIR_OBS_NVAR(&moduleName); - zephir_read_property(&moduleName, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC); - } - if (zephir_is_true(&moduleName)) { - zephir_read_property(&_11$$9, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_11$$9) != IS_NULL) { - zephir_read_property(&_12$$10, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_14$$10); - ZVAL_STRING(&_14$$10, "console:beforeStartModule"); - ZEPHIR_CALL_METHOD(&_13$$10, &_12$$10, "fire", NULL, 0, &_14$$10, this_ptr, &moduleName); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &links, "valid", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_13$$10)) { - RETURN_MM_BOOL(0); + if (!zend_is_true(&_1)) { + break; } - } - zephir_read_property(&_15$$9, this_ptr, ZEND_STRL("modules"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&modules, &_15$$9); - if (UNEXPECTED(!(zephir_array_isset(&modules, &moduleName)))) { - ZEPHIR_INIT_VAR(&_16$$12); - object_init_ex(&_16$$12, phalcon_cli_console_exception_ce); - ZEPHIR_INIT_VAR(&_17$$12); - ZEPHIR_CONCAT_SVS(&_17$$12, "Module '", &moduleName, "' isn't registered in the console container"); - ZEPHIR_CALL_METHOD(NULL, &_16$$12, "__construct", NULL, 29, &_17$$12); + ZEPHIR_CALL_METHOD(&link, &links, "current", NULL, 0); zephir_check_call_status(); - zephir_throw_exception_debug(&_16$$12, "phalcon/Cli/Console.zep", 87); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_VAR(&module); - zephir_array_fetch(&module, &modules, &moduleName, PH_NOISY, "phalcon/Cli/Console.zep", 90); - if (UNEXPECTED(Z_TYPE_P(&module) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "Invalid module definition path", "phalcon/Cli/Console.zep", 93); - return; - } - ZEPHIR_OBS_VAR(&className); - if (!(zephir_array_isset_string_fetch(&className, &module, SL("className"), 0))) { - ZEPHIR_INIT_NVAR(&className); - ZVAL_STRING(&className, "Module"); - } - ZEPHIR_OBS_VAR(&path); - if (zephir_array_isset_string_fetch(&path, &module, SL("path"), 0)) { - if (UNEXPECTED(!((zephir_file_exists(&path) == SUCCESS)))) { - ZEPHIR_INIT_VAR(&_18$$16); - object_init_ex(&_18$$16, phalcon_cli_console_exception_ce); - ZEPHIR_INIT_VAR(&_19$$16); - ZEPHIR_CONCAT_SVS(&_19$$16, "Module definition path '", &path, "' doesn't exist"); - ZEPHIR_CALL_METHOD(NULL, &_18$$16, "__construct", NULL, 29, &_19$$16); + ZEPHIR_INIT_NVAR(&_9$$5); + ZVAL_STRING(&_9$$5, "Phalcon\\Html\\Link\\Interfaces\\LinkInterface"); + ZEPHIR_CALL_FUNCTION(&_10$$5, "is_a", &_4, 86, &link, &_9$$5); zephir_check_call_status(); - zephir_throw_exception_debug(&_18$$16, "phalcon/Cli/Console.zep", 104); - ZEPHIR_MM_RESTORE(); - return; - } - if (!(zephir_class_exists(&className, zephir_is_true(&__$false) ))) { - if (zephir_require_once_zval(&path) == FAILURE) { - RETURN_MM_NULL(); + _11$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_10$$5); + if (!(_11$$5)) { + ZEPHIR_INIT_NVAR(&_9$$5); + ZVAL_STRING(&_9$$5, "Psr\\Link\\LinkInterface"); + ZEPHIR_CALL_FUNCTION(&_12$$5, "is_a", &_4, 86, &link, &_9$$5); + zephir_check_call_status(); + _11$$5 = ZEPHIR_IS_TRUE_IDENTICAL(&_12$$5); } - } - } - zephir_read_property(&_15$$9, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&moduleObject, &_15$$9, "get", NULL, 0, &className); - zephir_check_call_status(); - zephir_read_property(&_20$$9, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerautoloaders", NULL, 0, &_20$$9); - zephir_check_call_status(); - zephir_read_property(&_21$$9, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerservices", NULL, 0, &_21$$9); - zephir_check_call_status(); - zephir_read_property(&_22$$9, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_22$$9) != IS_NULL) { - zephir_read_property(&_23$$18, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_25$$18); - ZVAL_STRING(&_25$$18, "console:afterStartModule"); - ZEPHIR_CALL_METHOD(&_24$$18, &_23$$18, "fire", NULL, 0, &_25$$18, this_ptr, &moduleObject); + if (_11$$5) { + ZEPHIR_CALL_METHOD(&_13$$6, this_ptr, "getkey", &_8, 0, &link); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("links"), &_13$$6, &link); + } + ZEPHIR_CALL_METHOD(NULL, &links, "next", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_24$$18)) { - RETURN_MM_BOOL(0); - } - } - } - zephir_read_property(&_26, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&_7); - ZVAL_STRING(&_7, "dispatcher"); - ZEPHIR_CALL_METHOD(&_6, &_26, "getshared", NULL, 0, &_7); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&dispatcher, &_6); - ZEPHIR_CALL_METHOD(&_6, &router, "getmodulename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setmodulename", NULL, 0, &_6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_27, &router, "gettaskname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &dispatcher, "settaskname", NULL, 0, &_27); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_28, &router, "getactionname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setactionname", NULL, 0, &_28); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_29, &router, "getparameters", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setparams", NULL, 0, &_29); - zephir_check_call_status(); - zephir_read_property(&_30, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setoptions", NULL, 0, &_30); - zephir_check_call_status(); - zephir_read_property(&_31, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_31) != IS_NULL) { - zephir_read_property(&_32$$20, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_34$$20); - ZVAL_STRING(&_34$$20, "console:beforeHandleTask"); - ZEPHIR_CALL_METHOD(&_33$$20, &_32$$20, "fire", NULL, 0, &_34$$20, this_ptr, &dispatcher); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_33$$20)) { - RETURN_MM_BOOL(0); } } - ZEPHIR_CALL_METHOD(&task, &dispatcher, "dispatch", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_35, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_35) != IS_NULL) { - zephir_read_property(&_36$$22, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_37$$22); - ZVAL_STRING(&_37$$22, "console:afterHandleTask"); - ZEPHIR_CALL_METHOD(NULL, &_36$$22, "fire", NULL, 0, &_37$$22, this_ptr, &task); - zephir_check_call_status(); - } - RETURN_CCTOR(&task); + ZEPHIR_INIT_NVAR(&link); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Console, setArgument) +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, doGetLinks) { + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "links"); +} + +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, doGetLinksByRel) +{ + zval filtered; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_44 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool str, shift, _0; - zval *arguments_param = NULL, *str_param = NULL, *shift_param = NULL, __$true, arg, pos, args, opts, handleArgs, *_1, _2, _3$$5, _4$$5, _5$$5, _7$$6, _8$$7, _9$$7, _10$$7, _11$$7, _12$$7, _13$$7, _14$$7, _15$$8, _16$$8, _17$$8, _18$$9, _19$$9, _20$$9, _21$$10, _22$$10, _23$$14, _24$$14, _25$$14, _26$$15, _27$$16, _28$$16, _29$$16, _30$$16, _31$$16, _32$$16, _33$$16, _34$$17, _35$$17, _36$$17, _37$$18, _38$$18, _39$$18, _40$$19, _41$$19, _42$$22, _43$$22, _45$$24, _46$$25, _47$$26; - zval arguments; + zval *rel_param = NULL, link, rels, _0, *_1, _2; + zval rel; zval *this_ptr = getThis(); - ZVAL_UNDEF(&arguments); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&arg); - ZVAL_UNDEF(&pos); - ZVAL_UNDEF(&args); - ZVAL_UNDEF(&opts); - ZVAL_UNDEF(&handleArgs); + ZVAL_UNDEF(&rel); + ZVAL_UNDEF(&link); + ZVAL_UNDEF(&rels); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_13$$7); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_18$$9); - ZVAL_UNDEF(&_19$$9); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&_21$$10); - ZVAL_UNDEF(&_22$$10); - ZVAL_UNDEF(&_23$$14); - ZVAL_UNDEF(&_24$$14); - ZVAL_UNDEF(&_25$$14); - ZVAL_UNDEF(&_26$$15); - ZVAL_UNDEF(&_27$$16); - ZVAL_UNDEF(&_28$$16); - ZVAL_UNDEF(&_29$$16); - ZVAL_UNDEF(&_30$$16); - ZVAL_UNDEF(&_31$$16); - ZVAL_UNDEF(&_32$$16); - ZVAL_UNDEF(&_33$$16); - ZVAL_UNDEF(&_34$$17); - ZVAL_UNDEF(&_35$$17); - ZVAL_UNDEF(&_36$$17); - ZVAL_UNDEF(&_37$$18); - ZVAL_UNDEF(&_38$$18); - ZVAL_UNDEF(&_39$$18); - ZVAL_UNDEF(&_40$$19); - ZVAL_UNDEF(&_41$$19); - ZVAL_UNDEF(&_42$$22); - ZVAL_UNDEF(&_43$$22); - ZVAL_UNDEF(&_45$$24); - ZVAL_UNDEF(&_46$$25); - ZVAL_UNDEF(&_47$$26); + ZVAL_UNDEF(&filtered); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 3) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(arguments) - Z_PARAM_BOOL(str) - Z_PARAM_BOOL(shift) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(rel) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &arguments_param, &str_param, &shift_param); - if (!arguments_param) { - ZEPHIR_INIT_VAR(&arguments); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&arguments, arguments_param); - } - if (!str_param) { - str = 1; - } else { - if (UNEXPECTED(Z_TYPE_P(str_param) != IS_TRUE && Z_TYPE_P(str_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type bool")); - RETURN_MM_NULL(); - } - str = (Z_TYPE_P(str_param) == IS_TRUE); - } - if (!shift_param) { - shift = 1; - } else { - if (UNEXPECTED(Z_TYPE_P(shift_param) != IS_TRUE && Z_TYPE_P(shift_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'shift' must be of the type bool")); - RETURN_MM_NULL(); - } - shift = (Z_TYPE_P(shift_param) == IS_TRUE); - } + zephir_fetch_params(1, 1, 0, &rel_param); + zephir_get_strval(&rel, rel_param); - ZEPHIR_INIT_VAR(&args); - array_init(&args); - ZEPHIR_INIT_VAR(&opts); - array_init(&opts); - ZEPHIR_INIT_VAR(&handleArgs); - array_init(&handleArgs); - _0 = shift; - if (_0) { - _0 = ((zephir_fast_count_int(&arguments)) ? 1 : 0); - } - if (_0) { - ZEPHIR_MAKE_REF(&arguments); - ZEPHIR_CALL_FUNCTION(NULL, "array_shift", NULL, 21, &arguments); - ZEPHIR_UNREF(&arguments); - zephir_check_call_status(); - } - zephir_is_iterable(&arguments, 0, "phalcon/Cli/Console.zep", 185); - if (Z_TYPE_P(&arguments) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&arguments), _1) + ZEPHIR_INIT_VAR(&filtered); + array_init(&filtered); + zephir_read_property(&_0, this_ptr, ZEND_STRL("links"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_0, 0, "phalcon/Html/Link/AbstractLinkProvider.zep", 80); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) { - ZEPHIR_INIT_NVAR(&arg); - ZVAL_COPY(&arg, _1); - if (Z_TYPE_P(&arg) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_3$$5); - ZVAL_STRING(&_3$$5, "--"); - ZVAL_LONG(&_4$$5, 2); - ZEPHIR_CALL_FUNCTION(&_5$$5, "strncmp", &_6, 186, &arg, &_3$$5, &_4$$5); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_5$$5, 0)) { - ZEPHIR_INIT_NVAR(&_7$$6); - ZVAL_STRING(&_7$$6, "="); - ZEPHIR_INIT_NVAR(&pos); - zephir_fast_strpos(&pos, &arg, &_7$$6, 0 ); - if (zephir_is_true(&pos)) { - ZEPHIR_INIT_NVAR(&_8$$7); - ZVAL_LONG(&_9$$7, (zephir_get_numberval(&pos) + 1)); - ZEPHIR_INIT_NVAR(&_10$$7); - zephir_substr(&_10$$7, &arg, zephir_get_intval(&_9$$7), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_fast_trim(&_8$$7, &_10$$7, NULL , ZEPHIR_TRIM_BOTH); - ZEPHIR_INIT_NVAR(&_11$$7); - ZVAL_LONG(&_12$$7, 2); - ZVAL_LONG(&_13$$7, (zephir_get_numberval(&pos) - 2)); - ZEPHIR_INIT_NVAR(&_14$$7); - zephir_substr(&_14$$7, &arg, 2 , zephir_get_intval(&_13$$7), 0); - zephir_fast_trim(&_11$$7, &_14$$7, NULL , ZEPHIR_TRIM_BOTH); - zephir_array_update_zval(&opts, &_11$$7, &_8$$7, PH_COPY | PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&_15$$8); - ZVAL_LONG(&_16$$8, 2); - ZEPHIR_INIT_NVAR(&_17$$8); - zephir_substr(&_17$$8, &arg, 2 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_fast_trim(&_15$$8, &_17$$8, NULL , ZEPHIR_TRIM_BOTH); - zephir_array_update_zval(&opts, &_15$$8, &__$true, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_NVAR(&_18$$9); - ZVAL_STRING(&_18$$9, "-"); - ZVAL_LONG(&_19$$9, 1); - ZEPHIR_CALL_FUNCTION(&_20$$9, "strncmp", &_6, 186, &arg, &_18$$9, &_19$$9); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_20$$9, 0)) { - ZVAL_LONG(&_21$$10, 1); - ZEPHIR_INIT_NVAR(&_22$$10); - zephir_substr(&_22$$10, &arg, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_array_update_zval(&opts, &_22$$10, &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&args, &arg, PH_SEPARATE, "phalcon/Cli/Console.zep", 177); - } - } - } else { - zephir_array_append(&args, &arg, PH_SEPARATE, "phalcon/Cli/Console.zep", 181); + ZEPHIR_INIT_NVAR(&link); + ZVAL_COPY(&link, _1); + ZEPHIR_CALL_METHOD(&rels, &link, "getrels", NULL, 0); + zephir_check_call_status(); + if (1 == zephir_fast_in_array(&rel, &rels)) { + zephir_array_append(&filtered, &link, PH_SEPARATE, "phalcon/Html/Link/AbstractLinkProvider.zep", 76); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &arguments, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_2, &arguments, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); zephir_check_call_status(); if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&arg, &arguments, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&link, &_0, "current", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&arg) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_23$$14); - ZVAL_STRING(&_23$$14, "--"); - ZVAL_LONG(&_24$$14, 2); - ZEPHIR_CALL_FUNCTION(&_25$$14, "strncmp", &_6, 186, &arg, &_23$$14, &_24$$14); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_25$$14, 0)) { - ZEPHIR_INIT_NVAR(&_26$$15); - ZVAL_STRING(&_26$$15, "="); - ZEPHIR_INIT_NVAR(&pos); - zephir_fast_strpos(&pos, &arg, &_26$$15, 0 ); - if (zephir_is_true(&pos)) { - ZEPHIR_INIT_NVAR(&_27$$16); - ZVAL_LONG(&_28$$16, (zephir_get_numberval(&pos) + 1)); - ZEPHIR_INIT_NVAR(&_29$$16); - zephir_substr(&_29$$16, &arg, zephir_get_intval(&_28$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_fast_trim(&_27$$16, &_29$$16, NULL , ZEPHIR_TRIM_BOTH); - ZEPHIR_INIT_NVAR(&_30$$16); - ZVAL_LONG(&_31$$16, 2); - ZVAL_LONG(&_32$$16, (zephir_get_numberval(&pos) - 2)); - ZEPHIR_INIT_NVAR(&_33$$16); - zephir_substr(&_33$$16, &arg, 2 , zephir_get_intval(&_32$$16), 0); - zephir_fast_trim(&_30$$16, &_33$$16, NULL , ZEPHIR_TRIM_BOTH); - zephir_array_update_zval(&opts, &_30$$16, &_27$$16, PH_COPY | PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&_34$$17); - ZVAL_LONG(&_35$$17, 2); - ZEPHIR_INIT_NVAR(&_36$$17); - zephir_substr(&_36$$17, &arg, 2 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_fast_trim(&_34$$17, &_36$$17, NULL , ZEPHIR_TRIM_BOTH); - zephir_array_update_zval(&opts, &_34$$17, &__$true, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_NVAR(&_37$$18); - ZVAL_STRING(&_37$$18, "-"); - ZVAL_LONG(&_38$$18, 1); - ZEPHIR_CALL_FUNCTION(&_39$$18, "strncmp", &_6, 186, &arg, &_37$$18, &_38$$18); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_39$$18, 0)) { - ZVAL_LONG(&_40$$19, 1); - ZEPHIR_INIT_NVAR(&_41$$19); - zephir_substr(&_41$$19, &arg, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_array_update_zval(&opts, &_41$$19, &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&args, &arg, PH_SEPARATE, "phalcon/Cli/Console.zep", 177); - } - } - } else { - zephir_array_append(&args, &arg, PH_SEPARATE, "phalcon/Cli/Console.zep", 181); + ZEPHIR_CALL_METHOD(&rels, &link, "getrels", NULL, 0); + zephir_check_call_status(); + if (1 == zephir_fast_in_array(&rel, &rels)) { + zephir_array_append(&filtered, &link, PH_SEPARATE, "phalcon/Html/Link/AbstractLinkProvider.zep", 76); } - ZEPHIR_CALL_METHOD(NULL, &arguments, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&arg); - if (str) { - ZEPHIR_INIT_VAR(&_42$$22); - ZEPHIR_CALL_CE_STATIC(&_43$$22, phalcon_cli_router_route_ce, "getdelimiter", &_44, 0); - zephir_check_call_status(); - zephir_fast_join(&_42$$22, &_43$$22, &args); - zephir_update_property_zval(this_ptr, ZEND_STRL("arguments"), &_42$$22); - } else { - if (zephir_fast_count_int(&args)) { - ZEPHIR_MAKE_REF(&args); - ZEPHIR_CALL_FUNCTION(&_45$$24, "array_shift", NULL, 21, &args); - ZEPHIR_UNREF(&args); - zephir_check_call_status(); - zephir_array_update_string(&handleArgs, SL("task"), &_45$$24, PH_COPY | PH_SEPARATE); - } - if (zephir_fast_count_int(&args)) { - ZEPHIR_MAKE_REF(&args); - ZEPHIR_CALL_FUNCTION(&_46$$25, "array_shift", NULL, 21, &args); - ZEPHIR_UNREF(&args); - zephir_check_call_status(); - zephir_array_update_string(&handleArgs, SL("action"), &_46$$25, PH_COPY | PH_SEPARATE); - } - if (zephir_fast_count_int(&args)) { - ZEPHIR_INIT_VAR(&_47$$26); - zephir_fast_array_merge(&_47$$26, &handleArgs, &args); - ZEPHIR_CPY_WRT(&handleArgs, &_47$$26); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("arguments"), &handleArgs); + ZEPHIR_INIT_NVAR(&link); + RETURN_CTOR(&filtered); +} + +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, doWithLink) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *link, link_sub, key, newInstance; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&link_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&newInstance); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(link) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &link); + + + ZEPHIR_CALL_METHOD(&key, this_ptr, "getkey", NULL, 0, link); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &opts); - RETURN_THIS(); + zephir_update_property_array(&newInstance, SL("links"), &key, link); + RETURN_CCTOR(&newInstance); } -zend_object *zephir_init_properties_Phalcon_Cli_Console(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, doWithoutLink) { - zval _0, _2, _4, _1$$3, _3$$4, _5$$5; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *link, link_sub, key, newInstance, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&link_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&newInstance); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(link) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &link); + + + ZEPHIR_CALL_METHOD(&key, this_ptr, "getkey", NULL, 0, link); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&newInstance); + if (zephir_clone(&newInstance, this_ptr) == FAILURE) { + RETURN_MM(); + } + zephir_unset_property_array(&newInstance, ZEND_STRL("links"), &key); + zephir_read_property(&_0, &newInstance, ZEND_STRL("links"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_0, &key, PH_SEPARATE); + RETURN_CCTOR(&newInstance); +} + +static PHP_METHOD(Phalcon_Html_Link_AbstractLinkProvider, getKey) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *link, link_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&link_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(link) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &link); + + + ZEPHIR_RETURN_CALL_FUNCTION("spl_object_hash", NULL, 80, link); + zephir_check_call_status(); + RETURN_MM(); +} + +zend_object *zephir_init_properties_Phalcon_Html_Link_AbstractLinkProvider(zend_class_entry *class_type) +{ + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$5); ZEPHIR_MM_GROW(); @@ -24668,23 +23978,11 @@ zend_object *zephir_init_properties_Phalcon_Cli_Console(zend_class_entry *class_ { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("links"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("modules"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("modules"), &_3$$4); - } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_4) == IS_NULL) { - ZEPHIR_INIT_VAR(&_5$$5); - array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("arguments"), &_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("links"), &_1$$3); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -24701,452 +23999,293 @@ zend_object *zephir_init_properties_Phalcon_Cli_Console(zend_class_entry *class_ -ZEPHIR_INIT_CLASS(Phalcon_Cli_Dispatcher) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_EvolvableLink) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli, Dispatcher, phalcon, cli_dispatcher, phalcon_dispatcher_abstractdispatcher_ce, phalcon_cli_dispatcher_method_entry, 0); - - zend_declare_property_string(phalcon_cli_dispatcher_ce, SL("defaultHandler"), "main", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_dispatcher_ce, SL("defaultAction"), "main", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_dispatcher_ce, SL("handlerSuffix"), "Task", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_dispatcher_ce, SL("options"), ZEND_ACC_PROTECTED); - phalcon_cli_dispatcher_ce->create_object = zephir_init_properties_Phalcon_Cli_Dispatcher; + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Link, EvolvableLink, phalcon, html_link_evolvablelink, phalcon_html_link_link_ce, phalcon_html_link_evolvablelink_method_entry, 0); - zend_class_implements(phalcon_cli_dispatcher_ce, 1, phalcon_cli_dispatcherinterface_ce); + zend_class_implements(phalcon_html_link_evolvablelink_ce, 1, phalcon_html_link_interfaces_evolvablelinkinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Dispatcher, callActionMethod) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLink, withAttribute) { - zval _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval actionMethod; - zval *handler, handler_sub, *actionMethod_param = NULL, params, *params_param = NULL, _0, _1, _2; + zval *attribute, attribute_sub, *value, value_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&handler_sub); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&actionMethod); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&attribute_sub); + ZVAL_UNDEF(&value_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_ZVAL(handler) - Z_PARAM_STR(actionMethod) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(params) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(attribute) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &handler, &actionMethod_param, ¶ms_param); - zephir_get_strval(&actionMethod, actionMethod_param); - if (!params_param) { - ZEPHIR_INIT_VAR(¶ms); - array_init(¶ms); - } else { - ZEPHIR_OBS_COPY_OR_DUP(¶ms, params_param); - } + zephir_fetch_params(1, 2, 0, &attribute, &value); - ZEPHIR_CALL_FUNCTION(&_0, "array_values", NULL, 14, ¶ms); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(¶ms, &_0); - ZEPHIR_INIT_VAR(&_1); - zephir_read_property(&_2, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - zephir_fast_array_merge(&_1, ¶ms, &_2); - ZEPHIR_CPY_WRT(¶ms, &_1); - ZEPHIR_INIT_VAR(&_3); - zephir_create_array(&_3, 2, 0); - zephir_array_fast_append(&_3, handler); - zephir_array_fast_append(&_3, &actionMethod); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_3, ¶ms); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithattribute", NULL, 0, attribute, value); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, getActiveTask) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLink, withHref) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *href_param = NULL; + zval href; zval *this_ptr = getThis(); + ZVAL_UNDEF(&href); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(href) + ZEND_PARSE_PARAMETERS_END(); +#endif + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &href_param); + zephir_get_strval(&href, href_param); - RETURN_MEMBER(getThis(), "activeHandler"); + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithhref", NULL, 0, &href); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, getLastTask) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLink, withRel) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *rel_param = NULL; + zval rel; zval *this_ptr = getThis(); + ZVAL_UNDEF(&rel); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(rel) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &rel_param); + zephir_get_strval(&rel, rel_param); - RETURN_MEMBER(getThis(), "lastHandler"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithrel", NULL, 0, &rel); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, getOption) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLink, withoutAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *option, option_sub, *filters = NULL, filters_sub, *defaultValue = NULL, defaultValue_sub, __$null, options, filter, optionValue, container, _0, _3, _4, _1$$5, _2$$5; + zval *attribute_param = NULL; + zval attribute; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option_sub); - ZVAL_UNDEF(&filters_sub); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&filter); - ZVAL_UNDEF(&optionValue); - ZVAL_UNDEF(&container); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&attribute); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(option) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(filters) - Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(attribute) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &option, &filters, &defaultValue); - if (!filters) { - filters = &filters_sub; - filters = &__$null; - } - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } + zephir_fetch_params(1, 1, 0, &attribute_param); + zephir_get_strval(&attribute, attribute_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&options, &_0); - ZEPHIR_OBS_VAR(&optionValue); - if (!(zephir_array_isset_fetch(&optionValue, &options, option, 0))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - if (Z_TYPE_P(filters) == IS_NULL) { - RETURN_CCTOR(&optionValue); - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&container, &_0); - if (Z_TYPE_P(&container) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$5); - ZVAL_STRING(&_1$$5, "A dependency injection container is required to access the 'filter' service"); - ZVAL_LONG(&_2$$5, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwdispatchexception", NULL, 0, &_1$$5, &_2$$5); - zephir_check_call_status(); - } - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "filter"); - ZEPHIR_CALL_METHOD(&_3, &container, "getshared", NULL, 0, &_4); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&filter, &_3); - ZEPHIR_RETURN_CALL_METHOD(&filter, "sanitize", NULL, 0, &optionValue, filters); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithoutattribute", NULL, 0, &attribute); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, getOptions) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLink, withoutRel) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *rel_param = NULL; + zval rel; zval *this_ptr = getThis(); + ZVAL_UNDEF(&rel); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(rel) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &rel_param); + zephir_get_strval(&rel, rel_param); - RETURN_MEMBER(getThis(), "options"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithoutrel", NULL, 0, &rel); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, getTaskName) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "handlerName"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Cli_Dispatcher, getTaskSuffix) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "handlerSuffix"); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_EvolvableLinkProvider) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Link, EvolvableLinkProvider, phalcon, html_link_evolvablelinkprovider, phalcon_html_link_linkprovider_ce, phalcon_html_link_evolvablelinkprovider_method_entry, 0); + + zend_class_implements(phalcon_html_link_evolvablelinkprovider_ce, 1, phalcon_html_link_interfaces_evolvablelinkproviderinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Dispatcher, hasOption) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLinkProvider, withLink) { - zval *option, option_sub, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *link, link_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&link_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(option) + Z_PARAM_OBJECT_OF_CLASS(link, phalcon_html_link_interfaces_linkinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &option); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &link); - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_array_isset(&_0, option)); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithlink", NULL, 0, link); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, setDefaultTask) +static PHP_METHOD(Phalcon_Html_Link_EvolvableLinkProvider, withoutLink) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *taskName_param = NULL; - zval taskName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *link, link_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&taskName); + ZVAL_UNDEF(&link_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(taskName) + Z_PARAM_OBJECT_OF_CLASS(link, phalcon_html_link_interfaces_linkinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &taskName_param); - zephir_get_strval(&taskName, taskName_param); + zephir_fetch_params(1, 1, 0, &link); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultHandler"), &taskName); - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dowithoutlink", NULL, 0, link); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, setOptions) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL; - zval options; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(options) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - zephir_get_arrval(&options, options_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); - ZEPHIR_MM_RESTORE(); + +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Link) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Link, Link, phalcon, html_link_link, phalcon_html_link_abstractlink_ce, phalcon_html_link_link_method_entry, 0); + + zend_class_implements(phalcon_html_link_link_ce, 1, phalcon_html_link_interfaces_linkinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Dispatcher, setTaskName) +static PHP_METHOD(Phalcon_Html_Link_Link, getAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *taskName_param = NULL; - zval taskName; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&taskName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(taskName) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &taskName_param); - zephir_get_strval(&taskName, taskName_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("handlerName"), &taskName); - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogetattributes", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, setTaskSuffix) +static PHP_METHOD(Phalcon_Html_Link_Link, getHref) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *taskSuffix_param = NULL; - zval taskSuffix; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&taskSuffix); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(taskSuffix) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &taskSuffix_param); - zephir_get_strval(&taskSuffix, taskSuffix_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("handlerSuffix"), &taskSuffix); - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogethref", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, handleException) +static PHP_METHOD(Phalcon_Html_Link_Link, getRels) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *exception, exception_sub, eventsManager, _0, _1$$3, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&exception_sub); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(exception, zend_ce_exception) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &exception); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) != IS_NULL) { - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "dispatch:beforeException"); - ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr, exception); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { - RETURN_MM_BOOL(0); - } - } - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogetrels", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Dispatcher, throwDispatchException) +static PHP_METHOD(Phalcon_Html_Link_Link, isTemplated) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long exceptionCode, ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, *exceptionCode_param = NULL, exception, _0, _1; - zval message; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&exception); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(exceptionCode) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &exceptionCode_param); - zephir_get_strval(&message, message_param); - if (!exceptionCode_param) { - exceptionCode = 0; - } else { - exceptionCode = zephir_get_intval(exceptionCode_param); - } - - ZEPHIR_INIT_VAR(&exception); - object_init_ex(&exception, phalcon_cli_dispatcher_exception_ce); - ZVAL_LONG(&_0, exceptionCode); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 29, &message, &_0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "handleexception", NULL, 0, &exception); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doistemplated", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1)) { - RETURN_MM_BOOL(0); - } - zephir_throw_exception_debug(&exception, "phalcon/Cli/Dispatcher.zep", 221); - ZEPHIR_MM_RESTORE(); - return; -} - -zend_object *zephir_init_properties_Phalcon_Cli_Dispatcher(zend_class_entry *class_type) -{ - zval _0, _2, _4, _6, _8, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_9$$7); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("handlerHashes"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("handlerHashes"), &_3$$4); - } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("camelCaseMap"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_4) == IS_NULL) { - ZEPHIR_INIT_VAR(&_5$$5); - array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("camelCaseMap"), &_5$$5); - } - zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("activeMethodMap"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_6) == IS_NULL) { - ZEPHIR_INIT_VAR(&_7$$6); - array_init(&_7$$6); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("activeMethodMap"), &_7$$6); - } - zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_8) == IS_NULL) { - ZEPHIR_INIT_VAR(&_9$$7); - array_init(&_9$$7); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_9$$7); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + RETURN_MM(); } @@ -25159,23 +24298,54 @@ zend_object *zephir_init_properties_Phalcon_Cli_Dispatcher(zend_class_entry *cla -ZEPHIR_INIT_CLASS(Phalcon_Cli_DispatcherInterface) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_LinkProvider) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cli, DispatcherInterface, phalcon, cli_dispatcherinterface, phalcon_cli_dispatcherinterface_method_entry); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Html\\Link, LinkProvider, phalcon, html_link_linkprovider, phalcon_html_link_abstractlinkprovider_ce, phalcon_html_link_linkprovider_method_entry, 0); - zend_class_implements(phalcon_cli_dispatcherinterface_ce, 1, phalcon_dispatcher_dispatcherinterface_ce); + zend_class_implements(phalcon_html_link_linkprovider_ce, 1, phalcon_html_link_interfaces_linkproviderinterface_ce); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, getActiveTask); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, getLastTask); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, getOptions); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, getTaskName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, getTaskSuffix); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, setDefaultTask); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, setOptions); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, setTaskName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, setTaskSuffix); +static PHP_METHOD(Phalcon_Html_Link_LinkProvider, getLinks) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + + + ZEPHIR_MM_GROW(); + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogetlinks", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Html_Link_LinkProvider, getLinksByRel) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *rel, rel_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&rel_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(rel) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &rel); + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogetlinksbyrel", NULL, 0, rel); + zephir_check_call_status(); + RETURN_MM(); +} + @@ -25186,944 +24356,1211 @@ ZEPHIR_DOC_METHOD(Phalcon_Cli_DispatcherInterface, setTaskSuffix); -ZEPHIR_INIT_CLASS(Phalcon_Cli_Router) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Serializer_Header) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli, Router, phalcon, cli_router, phalcon_di_abstractinjectionaware_ce, phalcon_cli_router_method_entry, 0); - - zend_declare_property_string(phalcon_cli_router_ce, SL("action"), "", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_ce, SL("defaultAction"), "", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_ce, SL("defaultModule"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_ce, SL("defaultParams"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_ce, SL("defaultTask"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_ce, SL("matchedRoute"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_ce, SL("matches"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_ce, SL("module"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_ce, SL("params"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_ce, SL("routes"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_ce, SL("task"), "", ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_cli_router_ce, SL("wasMatched"), 0, ZEND_ACC_PROTECTED); - phalcon_cli_router_ce->create_object = zephir_init_properties_Phalcon_Cli_Router; + ZEPHIR_REGISTER_CLASS(Phalcon\\Html\\Link\\Serializer, Header, phalcon, html_link_serializer_header, phalcon_html_link_serializer_header_method_entry, 0); + zend_class_implements(phalcon_html_link_serializer_header_ce, 1, phalcon_html_link_serializer_serializerinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router, __construct) +static PHP_METHOD(Phalcon_Html_Link_Serializer_Header, serialize) { - zval routes, _1$$3, _3$$3; + zend_string *_8$$3, *_28$$17; + zend_ulong _7$$3, _27$$17; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *defaultRoutes_param = NULL, _0$$3, _2$$3, _4$$3; - zend_bool defaultRoutes; + zval *links_param = NULL, attributes, key, link, rels, result, subValue, value, *_0, _1, _2$$3, _3$$3, _4$$3, *_5$$3, _6$$3, _19$$3, _20$$3, *_9$$6, _10$$6, _11$$7, _12$$8, _13$$9, *_14$$12, _15$$12, _16$$13, _17$$14, _18$$15, _21$$17, _22$$17, _23$$17, _24$$17, *_25$$17, _26$$17, _39$$17, _40$$17, *_29$$20, _30$$20, _31$$21, _32$$22, _33$$23, *_34$$26, _35$$26, _36$$27, _37$$28, _38$$29; + zval links, elements, parts; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&links); + ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&parts); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&link); + ZVAL_UNDEF(&rels); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&subValue); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&routes); - ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_19$$3); + ZVAL_UNDEF(&_20$$3); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$9); + ZVAL_UNDEF(&_15$$12); + ZVAL_UNDEF(&_16$$13); + ZVAL_UNDEF(&_17$$14); + ZVAL_UNDEF(&_18$$15); + ZVAL_UNDEF(&_21$$17); + ZVAL_UNDEF(&_22$$17); + ZVAL_UNDEF(&_23$$17); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_26$$17); + ZVAL_UNDEF(&_39$$17); + ZVAL_UNDEF(&_40$$17); + ZVAL_UNDEF(&_30$$20); + ZVAL_UNDEF(&_31$$21); + ZVAL_UNDEF(&_32$$22); + ZVAL_UNDEF(&_33$$23); + ZVAL_UNDEF(&_35$$26); + ZVAL_UNDEF(&_36$$27); + ZVAL_UNDEF(&_37$$28); + ZVAL_UNDEF(&_38$$29); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(defaultRoutes) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(links) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &defaultRoutes_param); - if (!defaultRoutes_param) { - defaultRoutes = 1; - } else { - defaultRoutes = zephir_get_boolval(defaultRoutes_param); - } + zephir_fetch_params(1, 1, 0, &links_param); + zephir_get_arrval(&links, links_param); - ZEPHIR_INIT_VAR(&routes); - array_init(&routes); - if (defaultRoutes) { - ZEPHIR_INIT_VAR(&_0$$3); - object_init_ex(&_0$$3, phalcon_cli_router_route_ce); - ZEPHIR_INIT_VAR(&_1$$3); - zephir_create_array(&_1$$3, 1, 0); - add_assoc_long_ex(&_1$$3, SL("task"), 1); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "#^(?::delimiter)?([a-zA-Z0-9\\_\\-]+)[:delimiter]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 187, &_2$$3, &_1$$3); - zephir_check_call_status(); - zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "phalcon/Cli/Router.zep", 119); - ZEPHIR_INIT_NVAR(&_2$$3); - object_init_ex(&_2$$3, phalcon_cli_router_route_ce); - ZEPHIR_INIT_VAR(&_3$$3); - zephir_create_array(&_3$$3, 3, 0); - add_assoc_long_ex(&_3$$3, SL("task"), 1); - add_assoc_long_ex(&_3$$3, SL("action"), 2); - add_assoc_long_ex(&_3$$3, SL("params"), 3); - ZEPHIR_INIT_VAR(&_4$$3); - ZVAL_STRING(&_4$$3, "#^(?::delimiter)?([a-zA-Z0-9\\_\\-]+):delimiter([a-zA-Z0-9\\.\\_]+)(:delimiter.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 187, &_4$$3, &_3$$3); + ZEPHIR_INIT_VAR(&result); + ZVAL_NULL(&result); + ZEPHIR_INIT_VAR(&elements); + array_init(&elements); + zephir_is_iterable(&links, 0, "phalcon/Html/Link/Serializer/Header.zep", 70); + if (Z_TYPE_P(&links) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&links), _0) + { + ZEPHIR_INIT_NVAR(&link); + ZVAL_COPY(&link, _0); + ZEPHIR_CALL_METHOD(&_2$$3, &link, "istemplated", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_2$$3)) { + continue; + } + ZEPHIR_CALL_METHOD(&attributes, &link, "getattributes", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&rels, &link, "getrels", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&parts); + zephir_create_array(&parts, 2, 0); + ZEPHIR_INIT_NVAR(&_3$$3); + ZVAL_STRING(&_3$$3, ""); + zephir_array_fast_append(&parts, &_3$$3); + ZEPHIR_INIT_NVAR(&_3$$3); + zephir_fast_join_str(&_3$$3, SL(" "), &rels); + ZEPHIR_INIT_NVAR(&_4$$3); + ZEPHIR_CONCAT_SVS(&_4$$3, "rel=\"", &_3$$3, "\""); + zephir_array_fast_append(&parts, &_4$$3); + zephir_is_iterable(&attributes, 0, "phalcon/Html/Link/Serializer/Header.zep", 64); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&attributes), _7$$3, _8$$3, _5$$3) + { + ZEPHIR_INIT_NVAR(&key); + if (_8$$3 != NULL) { + ZVAL_STR_COPY(&key, _8$$3); + } else { + ZVAL_LONG(&key, _7$$3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _5$$3); + if (Z_TYPE_P(&value) == IS_ARRAY) { + zephir_is_iterable(&value, 0, "phalcon/Html/Link/Serializer/Header.zep", 50); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&value), _9$$6) + { + ZEPHIR_INIT_NVAR(&subValue); + ZVAL_COPY(&subValue, _9$$6); + ZEPHIR_INIT_NVAR(&_11$$7); + ZEPHIR_CONCAT_VSVS(&_11$$7, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_11$$7, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$6, &value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$6)) { + break; + } + ZEPHIR_CALL_METHOD(&subValue, &value, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_12$$8); + ZEPHIR_CONCAT_VSVS(&_12$$8, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_12$$8, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&subValue); + continue; + } + if (((Z_TYPE_P(&value) == IS_TRUE || Z_TYPE_P(&value) == IS_FALSE) != 1)) { + ZEPHIR_INIT_NVAR(&_13$$9); + ZEPHIR_CONCAT_VSVS(&_13$$9, &key, "=\"", &value, "\""); + zephir_array_append(&parts, &_13$$9, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 54); + continue; + } + if (ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_array_append(&parts, &key, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 59); + continue; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_6$$3, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_6$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &attributes, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &attributes, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&value) == IS_ARRAY) { + zephir_is_iterable(&value, 0, "phalcon/Html/Link/Serializer/Header.zep", 50); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&value), _14$$12) + { + ZEPHIR_INIT_NVAR(&subValue); + ZVAL_COPY(&subValue, _14$$12); + ZEPHIR_INIT_NVAR(&_16$$13); + ZEPHIR_CONCAT_VSVS(&_16$$13, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_16$$13, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_15$$12, &value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_15$$12)) { + break; + } + ZEPHIR_CALL_METHOD(&subValue, &value, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_17$$14); + ZEPHIR_CONCAT_VSVS(&_17$$14, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_17$$14, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&subValue); + continue; + } + if (((Z_TYPE_P(&value) == IS_TRUE || Z_TYPE_P(&value) == IS_FALSE) != 1)) { + ZEPHIR_INIT_NVAR(&_18$$15); + ZEPHIR_CONCAT_VSVS(&_18$$15, &key, "=\"", &value, "\""); + zephir_array_append(&parts, &_18$$15, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 54); + continue; + } + if (ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_array_append(&parts, &key, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 59); + continue; + } + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_CALL_METHOD(&_19$$3, &link, "gethref", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_20$$3); + zephir_fast_join_str(&_20$$3, SL("; "), &parts); + ZEPHIR_INIT_NVAR(&_4$$3); + ZEPHIR_CONCAT_SVSV(&_4$$3, "<", &_19$$3, ">", &_20$$3); + zephir_array_append(&elements, &_4$$3, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 67); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &links, "rewind", NULL, 0); zephir_check_call_status(); - zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "phalcon/Cli/Router.zep", 128); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &links, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&link, &links, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_21$$17, &link, "istemplated", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_21$$17)) { + continue; + } + ZEPHIR_CALL_METHOD(&attributes, &link, "getattributes", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&rels, &link, "getrels", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_22$$17); + zephir_create_array(&_22$$17, 2, 0); + ZEPHIR_INIT_NVAR(&_23$$17); + ZVAL_STRING(&_23$$17, ""); + zephir_array_fast_append(&_22$$17, &_23$$17); + ZEPHIR_INIT_NVAR(&_23$$17); + zephir_fast_join_str(&_23$$17, SL(" "), &rels); + ZEPHIR_INIT_NVAR(&_24$$17); + ZEPHIR_CONCAT_SVS(&_24$$17, "rel=\"", &_23$$17, "\""); + zephir_array_fast_append(&_22$$17, &_24$$17); + ZEPHIR_CPY_WRT(&parts, &_22$$17); + zephir_is_iterable(&attributes, 0, "phalcon/Html/Link/Serializer/Header.zep", 64); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&attributes), _27$$17, _28$$17, _25$$17) + { + ZEPHIR_INIT_NVAR(&key); + if (_28$$17 != NULL) { + ZVAL_STR_COPY(&key, _28$$17); + } else { + ZVAL_LONG(&key, _27$$17); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _25$$17); + if (Z_TYPE_P(&value) == IS_ARRAY) { + zephir_is_iterable(&value, 0, "phalcon/Html/Link/Serializer/Header.zep", 50); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&value), _29$$20) + { + ZEPHIR_INIT_NVAR(&subValue); + ZVAL_COPY(&subValue, _29$$20); + ZEPHIR_INIT_NVAR(&_31$$21); + ZEPHIR_CONCAT_VSVS(&_31$$21, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_31$$21, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_30$$20, &value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_30$$20)) { + break; + } + ZEPHIR_CALL_METHOD(&subValue, &value, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_32$$22); + ZEPHIR_CONCAT_VSVS(&_32$$22, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_32$$22, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&subValue); + continue; + } + if (((Z_TYPE_P(&value) == IS_TRUE || Z_TYPE_P(&value) == IS_FALSE) != 1)) { + ZEPHIR_INIT_NVAR(&_33$$23); + ZEPHIR_CONCAT_VSVS(&_33$$23, &key, "=\"", &value, "\""); + zephir_array_append(&parts, &_33$$23, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 54); + continue; + } + if (ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_array_append(&parts, &key, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 59); + continue; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_26$$17, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_26$$17)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &attributes, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &attributes, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&value) == IS_ARRAY) { + zephir_is_iterable(&value, 0, "phalcon/Html/Link/Serializer/Header.zep", 50); + if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&value), _34$$26) + { + ZEPHIR_INIT_NVAR(&subValue); + ZVAL_COPY(&subValue, _34$$26); + ZEPHIR_INIT_NVAR(&_36$$27); + ZEPHIR_CONCAT_VSVS(&_36$$27, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_36$$27, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_35$$26, &value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_35$$26)) { + break; + } + ZEPHIR_CALL_METHOD(&subValue, &value, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_37$$28); + ZEPHIR_CONCAT_VSVS(&_37$$28, &key, "=\"", &subValue, "\""); + zephir_array_append(&parts, &_37$$28, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 48); + ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&subValue); + continue; + } + if (((Z_TYPE_P(&value) == IS_TRUE || Z_TYPE_P(&value) == IS_FALSE) != 1)) { + ZEPHIR_INIT_NVAR(&_38$$29); + ZEPHIR_CONCAT_VSVS(&_38$$29, &key, "=\"", &value, "\""); + zephir_array_append(&parts, &_38$$29, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 54); + continue; + } + if (ZEPHIR_IS_TRUE_IDENTICAL(&value)) { + zephir_array_append(&parts, &key, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 59); + continue; + } + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_CALL_METHOD(&_39$$17, &link, "gethref", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_40$$17); + zephir_fast_join_str(&_40$$17, SL("; "), &parts); + ZEPHIR_INIT_NVAR(&_24$$17); + ZEPHIR_CONCAT_SVSV(&_24$$17, "<", &_39$$17, ">", &_40$$17); + zephir_array_append(&elements, &_24$$17, PH_SEPARATE, "phalcon/Html/Link/Serializer/Header.zep", 67); + ZEPHIR_CALL_METHOD(NULL, &links, "next", NULL, 0); + zephir_check_call_status(); + } } - zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &routes); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_NVAR(&link); + if (zephir_fast_count_int(&elements) > 0) { + ZEPHIR_INIT_NVAR(&result); + zephir_fast_join_str(&result, SL(","), &elements); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Cli_Router, add) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, route; - zval pattern; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&paths_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&route); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(pattern) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(paths) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(&pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(&pattern); - } - if (!paths) { - paths = &paths_sub; - paths = &__$null; - } - ZEPHIR_INIT_VAR(&route); - object_init_ex(&route, phalcon_cli_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 187, &pattern, paths); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("routes"), &route); - RETURN_CCTOR(&route); -} -static PHP_METHOD(Phalcon_Cli_Router, getActionName) +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Serializer_SerializerInterface) { - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Link\\Serializer, SerializerInterface, phalcon, html_link_serializer_serializerinterface, phalcon_html_link_serializer_serializerinterface_method_entry); + return SUCCESS; +} +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Serializer_SerializerInterface, serialize); - RETURN_MEMBER(getThis(), "action"); -} -static PHP_METHOD(Phalcon_Cli_Router, getMatchedRoute) -{ - zval *this_ptr = getThis(); +#ifdef HAVE_CONFIG_H +#endif - RETURN_MEMBER(getThis(), "matchedRoute"); -} -static PHP_METHOD(Phalcon_Cli_Router, getMatches) -{ - zval *this_ptr = getThis(); +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Link\\Interfaces, EvolvableLinkInterface, phalcon, html_link_interfaces_evolvablelinkinterface, phalcon_html_link_interfaces_evolvablelinkinterface_method_entry); - RETURN_MEMBER(getThis(), "matches"); + zend_class_implements(phalcon_html_link_interfaces_evolvablelinkinterface_ce, 1, phalcon_html_link_interfaces_linkinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router, getModuleName) -{ - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface, withHref); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface, withRel); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface, withoutRel); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface, withAttribute); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkInterface, withoutAttribute); - RETURN_MEMBER(getThis(), "module"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Cli_Router, getParams) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getparameters", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Interfaces_EvolvableLinkProviderInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Link\\Interfaces, EvolvableLinkProviderInterface, phalcon, html_link_interfaces_evolvablelinkproviderinterface, phalcon_html_link_interfaces_evolvablelinkproviderinterface_method_entry); + + zend_class_implements(phalcon_html_link_interfaces_evolvablelinkproviderinterface_ce, 1, phalcon_html_link_interfaces_linkproviderinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router, getParameters) -{ - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkProviderInterface, withLink); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_EvolvableLinkProviderInterface, withoutLink); - RETURN_MEMBER(getThis(), "params"); +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Interfaces_LinkInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Link\\Interfaces, LinkInterface, phalcon, html_link_interfaces_linkinterface, phalcon_html_link_interfaces_linkinterface_method_entry); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router, getRouteById) +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkInterface, getAttributes); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkInterface, getHref); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkInterface, getRels); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkInterface, isTemplated); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Html_Link_Interfaces_LinkProviderInterface) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *id, id_sub, route, _0, *_1, _2, _3$$3, _4$$5; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Html\\Link\\Interfaces, LinkProviderInterface, phalcon, html_link_interfaces_linkproviderinterface, phalcon_html_link_interfaces_linkproviderinterface_method_entry); - ZVAL_UNDEF(&id_sub); - ZVAL_UNDEF(&route); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(id) - ZEND_PARSE_PARAMETERS_END(); + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkProviderInterface, getLinks); +ZEPHIR_DOC_METHOD(Phalcon_Html_Link_Interfaces_LinkProviderInterface, getLinksByRel); + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &id); - zephir_read_property(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_0, 0, "phalcon/Cli/Router.zep", 218); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &route, "getrouteid", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_3$$3, id)) { - RETURN_CCTOR(&route); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&route, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, &route, "getrouteid", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_4$$5, id)) { - RETURN_CCTOR(&route); - } - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&route); - RETURN_MM_BOOL(0); + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo, Connection, phalcon, datamapper_pdo_connection, phalcon_datamapper_pdo_connection_abstractconnection_ce, phalcon_datamapper_pdo_connection_method_entry, 0); + + zend_declare_property_null(phalcon_datamapper_pdo_connection_ce, SL("arguments"), ZEND_ACC_PROTECTED); + phalcon_datamapper_pdo_connection_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Connection; + + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router, getRouteByName) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, route, _0, *_1, _2, _3$$3, _4$$5; - zval name; + zval options, queries, available, _5; + zval *dsn_param = NULL, *username_param = NULL, *password_param = NULL, *options_param = NULL, *queries_param = NULL, *profiler = NULL, profiler_sub, __$true, __$null, parts, _0, _1$$3, _2$$3, _3$$3, _4$$4; + zval dsn, username, password; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&route); + ZVAL_UNDEF(&dsn); + ZVAL_UNDEF(&username); + ZVAL_UNDEF(&password); + ZVAL_UNDEF(&profiler_sub); + ZVAL_BOOL(&__$true, 1); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&parts); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&queries); + ZVAL_UNDEF(&available); + ZVAL_UNDEF(&_5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 6) + Z_PARAM_STR(dsn) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(username) + Z_PARAM_STR_OR_NULL(password) + Z_PARAM_ARRAY(options) + Z_PARAM_ARRAY(queries) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 5, &dsn_param, &username_param, &password_param, &options_param, &queries_param, &profiler); + zephir_get_strval(&dsn, dsn_param); + if (!username_param) { + ZEPHIR_INIT_VAR(&username); + } else { + zephir_get_strval(&username, username_param); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!password_param) { + ZEPHIR_INIT_VAR(&password); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_strval(&password, password_param); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + if (!queries_param) { + ZEPHIR_INIT_VAR(&queries); + array_init(&queries); + } else { + zephir_get_arrval(&queries, queries_param); + } + if (!profiler) { + profiler = &profiler_sub; + ZEPHIR_CPY_WRT(profiler, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(profiler); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_0, 0, "phalcon/Cli/Router.zep", 234); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &route, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_3$$3, &name)) { - RETURN_CCTOR(&route); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + ZEPHIR_INIT_VAR(&parts); + zephir_fast_explode_str(&parts, SL(":"), &dsn, LONG_MAX); + ZEPHIR_INIT_VAR(&available); + zephir_create_array(&available, 4, 0); + zephir_array_update_string(&available, SL("mysql"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&available, SL("pgsql"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&available, SL("sqlite"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&available, SL("mssql"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_fetch_long(&_0, &parts, 0, PH_READONLY, "phalcon/DataMapper/Pdo/Connection.zep", 65); + if (!(zephir_array_isset(&available, &_0))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, spl_ce_InvalidArgumentException); + zephir_array_fetch_long(&_2$$3, &parts, 0, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection.zep", 67); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "Driver not supported [", &_2$$3, "]"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 199, &_3$$3); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&route, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, &route, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_4$$5, &name)) { - RETURN_CCTOR(&route); - } - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } + zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection.zep", 68); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_INIT_NVAR(&route); - RETURN_MM_BOOL(0); + if (!(zephir_array_isset_long(&options, 3))) { + ZEPHIR_INIT_VAR(&_4$$4); + ZVAL_LONG(&_4$$4, 2); + zephir_array_update_long(&options, 3, &_4$$4, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + } + ZEPHIR_INIT_VAR(&_5); + zephir_create_array(&_5, 5, 0); + zephir_array_fast_append(&_5, &dsn); + zephir_array_fast_append(&_5, &username); + zephir_array_fast_append(&_5, &password); + zephir_array_fast_append(&_5, &options); + zephir_array_fast_append(&_5, &queries); + zephir_update_property_zval(this_ptr, ZEND_STRL("arguments"), &_5); + if (Z_TYPE_P(profiler) == IS_NULL) { + ZEPHIR_INIT_NVAR(profiler); + object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); + ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 200); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router, getRoutes) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __debugInfo) { + zval _1, _2, _3, _4, _5; + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "routes"); + zephir_create_array(return_value, 1, 0); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 5, 0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_2); + zephir_array_fetch_long(&_2, &_1, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 102); + zephir_array_fast_append(&_0, &_2); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "****"); + zephir_array_fast_append(&_0, &_3); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "****"); + zephir_array_fast_append(&_0, &_3); + zephir_read_property(&_4, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_NVAR(&_2); + zephir_array_fetch_long(&_2, &_4, 3, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 105); + zephir_array_fast_append(&_0, &_2); + zephir_read_property(&_5, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_NVAR(&_2); + zephir_array_fetch_long(&_2, &_5, 4, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 107); + zephir_array_fast_append(&_0, &_2); + zephir_array_update_string(return_value, SL("arguments"), &_0, PH_COPY | PH_SEPARATE); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Router, getTaskName) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, connect) { + zval dsn, options, password, query, queries, username, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3, *_9$$3, _10$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_11 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&dsn); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&password); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&queries); + ZVAL_UNDEF(&username); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$3); + ZVAL_UNDEF(&_10$$3); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "task"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_0))) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "connect"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "start", NULL, 0, &_2$$3); + zephir_check_call_status(); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&dsn); + zephir_array_fetch_long(&dsn, &_3$$3, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 122); + zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&username); + zephir_array_fetch_long(&username, &_4$$3, 1, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 123); + zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&password); + zephir_array_fetch_long(&password, &_5$$3, 2, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 124); + zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&options); + zephir_array_fetch_long(&options, &_6$$3, 3, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 125); + zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&queries); + zephir_array_fetch_long(&queries, &_7$$3, 4, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 126); + ZEPHIR_INIT_NVAR(&_2$$3); + object_init_ex(&_2$$3, php_pdo_get_dbh_ce()); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 0, &dsn, &username, &password, &options); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &_2$$3); + zephir_read_property(&_8$$3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_8$$3, "finish", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&queries, 0, "phalcon/DataMapper/Pdo/Connection.zep", 136); + if (Z_TYPE_P(&queries) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&queries), _9$$3) + { + ZEPHIR_INIT_NVAR(&query); + ZVAL_COPY(&query, _9$$3); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "exec", &_11, 0, &query); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &queries, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$3, &queries, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&query, &queries, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "exec", &_11, 0, &query); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &queries, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&query); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router, handle) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, disconnect) { - zval _34$$55; - zend_string *_8$$12, *_21$$32; - zend_ulong _7$$12, _20$$32; - zval _4$$9, _10$$15, _12$$18, _14$$21, _16$$24, _17$$29, _23$$35, _25$$38, _27$$41, _29$$44; - zend_bool _0$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_37 = NULL; + zval __$null, _0, _1, _2; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *arguments = NULL, arguments_sub, __$true, __$false, __$null, moduleName, taskName, actionName, params, route, parts, pattern, routeFound, matches, paths, beforeMatch, converters, converter, part, position, matchPosition, strParams, _1$$3, *_2$$3, _3$$3, *_5$$12, _6$$12, _9$$15, _11$$18, _13$$21, _15$$24, *_18$$32, _19$$32, _22$$35, _24$$38, _26$$41, _28$$44, _30$$46, _31$$46, _32$$46, _33$$46, _35$$55, _36$$56, _38$$58; zval *this_ptr = getThis(); - ZVAL_UNDEF(&arguments_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&moduleName); - ZVAL_UNDEF(&taskName); - ZVAL_UNDEF(&actionName); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&route); - ZVAL_UNDEF(&parts); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&routeFound); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&paths); - ZVAL_UNDEF(&beforeMatch); - ZVAL_UNDEF(&converters); - ZVAL_UNDEF(&converter); - ZVAL_UNDEF(&part); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&matchPosition); - ZVAL_UNDEF(&strParams); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_6$$12); - ZVAL_UNDEF(&_9$$15); - ZVAL_UNDEF(&_11$$18); - ZVAL_UNDEF(&_13$$21); - ZVAL_UNDEF(&_15$$24); - ZVAL_UNDEF(&_19$$32); - ZVAL_UNDEF(&_22$$35); - ZVAL_UNDEF(&_24$$38); - ZVAL_UNDEF(&_26$$41); - ZVAL_UNDEF(&_28$$44); - ZVAL_UNDEF(&_30$$46); - ZVAL_UNDEF(&_31$$46); - ZVAL_UNDEF(&_32$$46); - ZVAL_UNDEF(&_33$$46); - ZVAL_UNDEF(&_35$$55); - ZVAL_UNDEF(&_36$$56); - ZVAL_UNDEF(&_38$$58); - ZVAL_UNDEF(&_4$$9); - ZVAL_UNDEF(&_10$$15); - ZVAL_UNDEF(&_12$$18); - ZVAL_UNDEF(&_14$$21); - ZVAL_UNDEF(&_16$$24); - ZVAL_UNDEF(&_17$$29); - ZVAL_UNDEF(&_23$$35); - ZVAL_UNDEF(&_25$$38); - ZVAL_UNDEF(&_27$$41); - ZVAL_UNDEF(&_29$$44); - ZVAL_UNDEF(&_34$$55); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "disconnect"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &__$null); + zephir_read_property(&_2, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_2, "finish", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); +} + +zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Connection(zend_class_entry *class_type) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("arguments"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_ConnectionLocator) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo, ConnectionLocator, phalcon, datamapper_pdo_connectionlocator, phalcon_datamapper_pdo_connectionlocator_method_entry, 0); + + zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("master"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("read"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("write"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("instances"), ZEND_ACC_PRIVATE); + phalcon_datamapper_pdo_connectionlocator_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_ConnectionLocator; + + zend_class_implements(phalcon_datamapper_pdo_connectionlocator_ce, 1, phalcon_datamapper_pdo_connectionlocatorinterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, __construct) +{ + zend_string *_3, *_8; + zend_ulong _2, _7; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval read, write; + zval *master, master_sub, *read_param = NULL, *write_param = NULL, name, callableObject, *_0, _1, *_5, _6; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&master_sub); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&callableObject); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&read); + ZVAL_UNDEF(&write); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_OBJECT_OF_CLASS(master, phalcon_datamapper_pdo_connection_connectioninterface_ce) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(arguments) + Z_PARAM_ARRAY(read) + Z_PARAM_ARRAY(write) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &arguments); - if (!arguments) { - arguments = &arguments_sub; - arguments = &__$null; + zephir_fetch_params(1, 1, 2, &master, &read_param, &write_param); + if (!read_param) { + ZEPHIR_INIT_VAR(&read); + array_init(&read); + } else { + zephir_get_arrval(&read, read_param); + } + if (!write_param) { + ZEPHIR_INIT_VAR(&write); + array_init(&write); + } else { + zephir_get_arrval(&write, write_param); } - ZEPHIR_INIT_VAR(&routeFound); - ZVAL_BOOL(&routeFound, 0); - ZEPHIR_INIT_VAR(&parts); - array_init(&parts); - ZEPHIR_INIT_VAR(¶ms); - array_init(¶ms); - ZEPHIR_INIT_VAR(&matches); - ZVAL_NULL(&matches); - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setmaster", NULL, 0, master); + zephir_check_call_status(); + zephir_is_iterable(&read, 0, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 74); + if (Z_TYPE_P(&read) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&read), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&name); + if (_3 != NULL) { + ZVAL_STR_COPY(&name, _3); + } else { + ZVAL_LONG(&name, _2); + } + ZEPHIR_INIT_NVAR(&callableObject); + ZVAL_COPY(&callableObject, _0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setread", &_4, 0, &name, &callableObject); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &__$null); - if (Z_TYPE_P(arguments) != IS_ARRAY) { - _0$$3 = Z_TYPE_P(arguments) != IS_STRING; - if (_0$$3) { - _0$$3 = Z_TYPE_P(arguments) != IS_NULL; - } - if (UNEXPECTED(_0$$3)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Arguments must be an array or string", "phalcon/Cli/Router.zep", 273); - return; - } - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_1$$3, 0, "phalcon/Cli/Router.zep", 379); - if (Z_TYPE_P(&_1$$3) == IS_ARRAY) { - ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&_1$$3), _2$$3) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _2$$3); - ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); - zephir_check_call_status(); - if (zephir_memnstr_str(&pattern, SL("^"), "phalcon/Cli/Router.zep", 282)) { - ZEPHIR_INIT_NVAR(&routeFound); - zephir_preg_match(&routeFound, &pattern, arguments, &matches, 0, 0 , 0 ); - } else { - ZEPHIR_INIT_NVAR(&routeFound); - ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, arguments)); - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&beforeMatch) != IS_NULL) { - if (UNEXPECTED(!(zephir_is_callable(&beforeMatch)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/Cli/Router.zep", 301); - return; - } - ZEPHIR_INIT_NVAR(&_4$$9); - zephir_create_array(&_4$$9, 3, 0); - zephir_array_fast_append(&_4$$9, arguments); - zephir_array_fast_append(&_4$$9, &route); - zephir_array_fast_append(&_4$$9, this_ptr); - ZEPHIR_INIT_NVAR(&routeFound); - ZEPHIR_CALL_USER_FUNC_ARRAY(&routeFound, &beforeMatch, &_4$$9); - zephir_check_call_status(); - } - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&parts, &paths); - if (Z_TYPE_P(&matches) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&paths, 0, "phalcon/Cli/Router.zep", 366); - if (Z_TYPE_P(&paths) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _7$$12, _8$$12, _5$$12) - { - ZEPHIR_INIT_NVAR(&part); - if (_8$$12 != NULL) { - ZVAL_STR_COPY(&part, _8$$12); - } else { - ZVAL_LONG(&part, _7$$12); - } - ZEPHIR_INIT_NVAR(&position); - ZVAL_COPY(&position, _5$$12); - ZEPHIR_OBS_NVAR(&matchPosition); - if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_9$$15); - ZEPHIR_INIT_NVAR(&_10$$15); - zephir_create_array(&_10$$15, 1, 0); - zephir_array_fast_append(&_10$$15, &matchPosition); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_9$$15, &converter, &_10$$15); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_9$$15, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_11$$18); - ZEPHIR_INIT_NVAR(&_12$$18); - zephir_create_array(&_12$$18, 1, 0); - zephir_array_fast_append(&_12$$18, &position); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_11$$18, &converter, &_12$$18); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_11$$18, PH_COPY | PH_SEPARATE); - } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_6$$12, &paths, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_6$$12)) { - break; - } - ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&matchPosition); - if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_13$$21); - ZEPHIR_INIT_NVAR(&_14$$21); - zephir_create_array(&_14$$21, 1, 0); - zephir_array_fast_append(&_14$$21, &matchPosition); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_13$$21, &converter, &_14$$21); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_13$$21, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_15$$24); - ZEPHIR_INIT_NVAR(&_16$$24); - zephir_create_array(&_16$$24, 1, 0); - zephir_array_fast_append(&_16$$24, &position); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_15$$24, &converter, &_16$$24); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_15$$24, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&position); - ZEPHIR_INIT_NVAR(&part); - zephir_update_property_zval(this_ptr, ZEND_STRL("matches"), &matches); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &route); - break; - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &read, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &read, "valid", NULL, 0); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3$$3, &_1$$3, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&route, &_1$$3, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); - zephir_check_call_status(); - if (zephir_memnstr_str(&pattern, SL("^"), "phalcon/Cli/Router.zep", 282)) { - ZEPHIR_INIT_NVAR(&routeFound); - zephir_preg_match(&routeFound, &pattern, arguments, &matches, 0, 0 , 0 ); - } else { - ZEPHIR_INIT_NVAR(&routeFound); - ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, arguments)); - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&beforeMatch) != IS_NULL) { - if (UNEXPECTED(!(zephir_is_callable(&beforeMatch)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/Cli/Router.zep", 301); - return; - } - ZEPHIR_INIT_NVAR(&_17$$29); - zephir_create_array(&_17$$29, 3, 0); - zephir_array_fast_append(&_17$$29, arguments); - zephir_array_fast_append(&_17$$29, &route); - zephir_array_fast_append(&_17$$29, this_ptr); - ZEPHIR_INIT_NVAR(&routeFound); - ZEPHIR_CALL_USER_FUNC_ARRAY(&routeFound, &beforeMatch, &_17$$29); - zephir_check_call_status(); - } - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&parts, &paths); - if (Z_TYPE_P(&matches) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&paths, 0, "phalcon/Cli/Router.zep", 366); - if (Z_TYPE_P(&paths) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _20$$32, _21$$32, _18$$32) - { - ZEPHIR_INIT_NVAR(&part); - if (_21$$32 != NULL) { - ZVAL_STR_COPY(&part, _21$$32); - } else { - ZVAL_LONG(&part, _20$$32); - } - ZEPHIR_INIT_NVAR(&position); - ZVAL_COPY(&position, _18$$32); - ZEPHIR_OBS_NVAR(&matchPosition); - if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_22$$35); - ZEPHIR_INIT_NVAR(&_23$$35); - zephir_create_array(&_23$$35, 1, 0); - zephir_array_fast_append(&_23$$35, &matchPosition); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_22$$35, &converter, &_23$$35); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_22$$35, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_24$$38); - ZEPHIR_INIT_NVAR(&_25$$38); - zephir_create_array(&_25$$38, 1, 0); - zephir_array_fast_append(&_25$$38, &position); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_24$$38, &converter, &_25$$38); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_24$$38, PH_COPY | PH_SEPARATE); - } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_19$$32, &paths, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_19$$32)) { - break; - } - ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&matchPosition); - if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_26$$41); - ZEPHIR_INIT_NVAR(&_27$$41); - zephir_create_array(&_27$$41, 1, 0); - zephir_array_fast_append(&_27$$41, &matchPosition); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_26$$41, &converter, &_27$$41); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_26$$41, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_OBS_NVAR(&converter); - if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { - ZEPHIR_INIT_NVAR(&_28$$44); - ZEPHIR_INIT_NVAR(&_29$$44); - zephir_create_array(&_29$$44, 1, 0); - zephir_array_fast_append(&_29$$44, &position); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_28$$44, &converter, &_29$$44); - zephir_check_call_status(); - zephir_array_update_zval(&parts, &part, &_28$$44, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&position); - ZEPHIR_INIT_NVAR(&part); - zephir_update_property_zval(this_ptr, ZEND_STRL("matches"), &matches); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &route); - break; - } - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "next", NULL, 0); - zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; } + ZEPHIR_CALL_METHOD(&name, &read, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&callableObject, &read, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setread", &_4, 0, &name, &callableObject); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &read, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&route); - if (zephir_is_true(&routeFound)) { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); - } - } else { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); + } + ZEPHIR_INIT_NVAR(&callableObject); + ZEPHIR_INIT_NVAR(&name); + zephir_is_iterable(&write, 0, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 77); + if (Z_TYPE_P(&write) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&write), _7, _8, _5) + { + ZEPHIR_INIT_NVAR(&name); + if (_8 != NULL) { + ZVAL_STR_COPY(&name, _8); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); + ZVAL_LONG(&name, _7); } - zephir_read_property(&_30$$46, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, ZEND_STRL("module"), &_30$$46); - zephir_read_property(&_31$$46, this_ptr, ZEND_STRL("defaultTask"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, ZEND_STRL("task"), &_31$$46); - zephir_read_property(&_32$$46, this_ptr, ZEND_STRL("defaultAction"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, ZEND_STRL("action"), &_32$$46); - zephir_read_property(&_33$$46, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, ZEND_STRL("params"), &_33$$46); - RETURN_THIS(); - } - } else { - ZEPHIR_CPY_WRT(&parts, arguments); - } - ZEPHIR_INIT_VAR(&moduleName); - ZVAL_NULL(&moduleName); - ZEPHIR_INIT_VAR(&taskName); - ZVAL_NULL(&taskName); - ZEPHIR_INIT_VAR(&actionName); - ZVAL_NULL(&actionName); - ZEPHIR_OBS_NVAR(&moduleName); - if (zephir_array_isset_string_fetch(&moduleName, &parts, SL("module"), 0)) { - zephir_array_unset_string(&parts, SL("module"), PH_SEPARATE); - } else { - ZEPHIR_OBS_NVAR(&moduleName); - zephir_read_property(&moduleName, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC); - } - ZEPHIR_OBS_NVAR(&taskName); - if (zephir_array_isset_string_fetch(&taskName, &parts, SL("task"), 0)) { - zephir_array_unset_string(&parts, SL("task"), PH_SEPARATE); - } else { - ZEPHIR_OBS_NVAR(&taskName); - zephir_read_property(&taskName, this_ptr, ZEND_STRL("defaultTask"), PH_NOISY_CC); - } - ZEPHIR_OBS_NVAR(&actionName); - if (zephir_array_isset_string_fetch(&actionName, &parts, SL("action"), 0)) { - zephir_array_unset_string(&parts, SL("action"), PH_SEPARATE); + ZEPHIR_INIT_NVAR(&callableObject); + ZVAL_COPY(&callableObject, _5); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setwrite", &_9, 0, &name, &callableObject); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_OBS_NVAR(&actionName); - zephir_read_property(&actionName, this_ptr, ZEND_STRL("defaultAction"), PH_NOISY_CC); - } - ZEPHIR_OBS_NVAR(¶ms); - if (zephir_array_isset_string_fetch(¶ms, &parts, SL("params"), 0)) { - if (Z_TYPE_P(¶ms) != IS_ARRAY) { - zephir_cast_to_string(&_34$$55, ¶ms); - ZVAL_LONG(&_35$$55, 1); - ZEPHIR_INIT_VAR(&strParams); - zephir_substr(&strParams, &_34$$55, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - if (zephir_is_true(&strParams)) { - ZEPHIR_CALL_CE_STATIC(&_36$$56, phalcon_cli_router_route_ce, "getdelimiter", &_37, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(¶ms); - zephir_fast_explode(¶ms, &_36$$56, &strParams, LONG_MAX); - } else { - ZEPHIR_INIT_NVAR(¶ms); - array_init(¶ms); + ZEPHIR_CALL_METHOD(NULL, &write, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_6, &write, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_6)) { + break; } + ZEPHIR_CALL_METHOD(&name, &write, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&callableObject, &write, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setwrite", &_9, 0, &name, &callableObject); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &write, "next", NULL, 0); + zephir_check_call_status(); } - zephir_array_unset_string(&parts, SL("params"), PH_SEPARATE); } - if (zephir_fast_count_int(¶ms)) { - ZEPHIR_INIT_VAR(&_38$$58); - zephir_fast_array_merge(&_38$$58, ¶ms, &parts); - ZEPHIR_CPY_WRT(¶ms, &_38$$58); - } else { - ZEPHIR_CPY_WRT(¶ms, &parts); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("module"), &moduleName); - zephir_update_property_zval(this_ptr, ZEND_STRL("task"), &taskName); - zephir_update_property_zval(this_ptr, ZEND_STRL("action"), &actionName); - zephir_update_property_zval(this_ptr, ZEND_STRL("params"), ¶ms); + ZEPHIR_INIT_NVAR(&callableObject); + ZEPHIR_INIT_NVAR(&name); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router, setDefaultAction) +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getMaster) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "master"); +} + +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getRead) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *actionName_param = NULL; - zval actionName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(actionName) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &actionName_param); - zephir_get_strval(&actionName, actionName_param); + zephir_fetch_params(1, 0, 1, &name_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + ZVAL_STRING(&name, ""); + } else { + zephir_get_strval(&name, name_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultAction"), &actionName); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "read"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getconnection", NULL, 0, &_0, &name); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Router, setDefaultModule) +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getWrite) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *moduleName_param = NULL; - zval moduleName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&moduleName); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(moduleName) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &moduleName_param); - zephir_get_strval(&moduleName, moduleName_param); + zephir_fetch_params(1, 0, 1, &name_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + ZVAL_STRING(&name, ""); + } else { + zephir_get_strval(&name, name_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultModule"), &moduleName); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "write"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getconnection", NULL, 0, &_0, &name); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Cli_Router, setDefaults) +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setMaster) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *defaults_param = NULL, module, task, action, params; - zval defaults; + zval *callableObject, callableObject_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&defaults); - ZVAL_UNDEF(&module); - ZVAL_UNDEF(&task); - ZVAL_UNDEF(&action); - ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&callableObject_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(defaults) + Z_PARAM_OBJECT_OF_CLASS(callableObject, phalcon_datamapper_pdo_connection_connectioninterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &callableObject); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("master"), callableObject); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setRead) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *name_param = NULL, *callableObject, callableObject_sub; + zval name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&callableObject_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_ZVAL(callableObject) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &defaults_param); - ZEPHIR_OBS_COPY_OR_DUP(&defaults, defaults_param); + zephir_fetch_params(1, 2, 0, &name_param, &callableObject); + zephir_get_strval(&name, name_param); - if (zephir_array_isset_string_fetch(&module, &defaults, SL("module"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultModule"), &module); - } - if (zephir_array_isset_string_fetch(&task, &defaults, SL("task"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultTask"), &task); - } - if (zephir_array_isset_string_fetch(&action, &defaults, SL("action"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultAction"), &action); - } - if (zephir_array_isset_string_fetch(¶ms, &defaults, SL("params"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultParams"), ¶ms); - } + zephir_update_property_array(this_ptr, SL("read"), &name, callableObject); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Cli_Router, setDefaultTask) +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setWrite) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *taskName_param = NULL; - zval taskName; + zval *name_param = NULL, *callableObject, callableObject_sub; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&taskName); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&callableObject_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(taskName) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(name) + Z_PARAM_ZVAL(callableObject) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &taskName_param); - zephir_get_strval(&taskName, taskName_param); + zephir_fetch_params(1, 2, 0, &name_param, &callableObject); + zephir_get_strval(&name, name_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultTask"), &taskName); - ZEPHIR_MM_RESTORE(); + zephir_update_property_array(this_ptr, SL("write"), &name, callableObject); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Cli_Router, wasMatched) +static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getConnection) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *type_param = NULL, *name_param = NULL, collection, instanceName, instances, requested, _0, _1, _6, _2$$5, _3$$5, _4$$6, _5$$6; + zval type, name; zval *this_ptr = getThis(); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&collection); + ZVAL_UNDEF(&instanceName); + ZVAL_UNDEF(&instances); + ZVAL_UNDEF(&requested); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$6); + ZVAL_UNDEF(&_5$$6); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(type) + Z_PARAM_OPTIONAL + Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_END(); +#endif + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &type_param, &name_param); + zephir_get_strval(&type, type_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + ZVAL_STRING(&name, ""); + } else { + zephir_get_strval(&name, name_param); + } - RETURN_MEMBER(getThis(), "wasMatched"); + + ZEPHIR_OBS_VAR(&collection); + zephir_read_property_zval(&collection, this_ptr, &type, PH_NOISY_CC); + ZEPHIR_CPY_WRT(&requested, &name); + zephir_read_property(&_0, this_ptr, ZEND_STRL("instances"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&instances, &_0); + if (ZEPHIR_IS_EMPTY(&collection)) { + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmaster", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, ""); + if (ZEPHIR_IS_IDENTICAL(&_1, &requested)) { + ZEPHIR_CALL_FUNCTION(&requested, "array_rand", NULL, 201, &collection); + zephir_check_call_status(); + } + if (!(zephir_array_isset(&collection, &requested))) { + ZEPHIR_INIT_VAR(&_2$$5); + object_init_ex(&_2$$5, phalcon_datamapper_pdo_exception_connectionnotfound_ce); + ZEPHIR_INIT_VAR(&_3$$5); + ZEPHIR_CONCAT_SVSV(&_3$$5, "Connection not found: ", &type, ":", &requested); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 32, &_3$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$5, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 206); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(&instanceName); + ZEPHIR_CONCAT_VSV(&instanceName, &type, "-", &requested); + if (!(zephir_array_isset(&instances, &instanceName))) { + ZEPHIR_INIT_VAR(&_4$$6); + zephir_array_fetch(&_5$$6, &collection, &requested, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 217); + ZEPHIR_CALL_USER_FUNC(&_4$$6, &_5$$6); + zephir_check_call_status(); + zephir_array_update_zval(&instances, &instanceName, &_4$$6, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("instances"), &instances); + } + zephir_array_fetch(&_6, &instances, &instanceName, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 221); + RETURN_CTOR(&_6); } -zend_object *zephir_init_properties_Phalcon_Cli_Router(zend_class_entry *class_type) +zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_ConnectionLocator(zend_class_entry *class_type) { - zval _0, _2, _4, _6, _1$$3, _3$$4, _5$$5, _7$$6; + zval _0, _2, _4, _1$$3, _3$$4, _5$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_3$$4); ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$6); ZEPHIR_MM_GROW(); @@ -26131,29 +25568,23 @@ zend_object *zephir_init_properties_Phalcon_Cli_Router(zend_class_entry *class_t { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("instances"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("routes"), &_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("instances"), &_1$$3); } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("write"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_2) == IS_NULL) { ZEPHIR_INIT_VAR(&_3$$4); array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("write"), &_3$$4); } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("matches"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("read"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_4) == IS_NULL) { ZEPHIR_INIT_VAR(&_5$$5); array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("matches"), &_5$$5); - } - zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_6) == IS_NULL) { - ZEPHIR_INIT_VAR(&_7$$6); - array_init(&_7$$6); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("defaultParams"), &_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("read"), &_5$$5); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -26170,30 +25601,19 @@ zend_object *zephir_init_properties_Phalcon_Cli_Router(zend_class_entry *class_t -ZEPHIR_INIT_CLASS(Phalcon_Cli_RouterInterface) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cli, RouterInterface, phalcon, cli_routerinterface, phalcon_cli_routerinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo, ConnectionLocatorInterface, phalcon, datamapper_pdo_connectionlocatorinterface, phalcon_datamapper_pdo_connectionlocatorinterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, add); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getActionName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getMatchedRoute); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getMatches); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getModuleName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getParams); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getParameters); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getRouteById); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getRouteByName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getRoutes); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, getTaskName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, handle); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, setDefaultAction); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, setDefaultModule); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, setDefaults); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, setDefaultTask); -ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, wasMatched); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getMaster); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getRead); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getWrite); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setMaster); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setRead); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setWrite); @@ -26204,1013 +25624,936 @@ ZEPHIR_DOC_METHOD(Phalcon_Cli_RouterInterface, wasMatched); -ZEPHIR_INIT_CLASS(Phalcon_Cli_Task) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli, Task, phalcon, cli_task, phalcon_di_injectable_ce, phalcon_cli_task_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Profiler, MemoryLogger, phalcon, datamapper_pdo_profiler_memorylogger, phalcon_datamapper_pdo_profiler_memorylogger_method_entry, 0); - zend_declare_property_null(phalcon_cli_task_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_cli_task_ce, 1, phalcon_cli_taskinterface_ce); - zend_class_implements(phalcon_cli_task_ce, 1, phalcon_events_eventsawareinterface_ce); + zend_declare_property_null(phalcon_datamapper_pdo_profiler_memorylogger_ce, SL("messages"), ZEND_ACC_PROTECTED); + phalcon_datamapper_pdo_profiler_memorylogger_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_MemoryLogger; + + zend_class_implements(phalcon_datamapper_pdo_profiler_memorylogger_ce, 1, phalcon_logger_loggerinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Task, __construct) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, alert) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); - - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("onconstruct")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "onconstruct", NULL, 0); - zephir_check_call_status(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); } + + + ZVAL_LONG(&_0, 2); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Task, getEventsManager) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, critical) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); + } - RETURN_MEMBER(getThis(), "eventsManager"); + ZVAL_LONG(&_0, 1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Task, setEventsManager) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, debug) { - zval *eventsManager, eventsManager_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&eventsManager_sub); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); + ZVAL_LONG(&_0, 7); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, emergency) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); + } - -ZEPHIR_INIT_CLASS(Phalcon_Cli_TaskInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cli, TaskInterface, phalcon, cli_taskinterface, NULL); - - return SUCCESS; + ZVAL_LONG(&_0, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, error) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); + } + ZVAL_LONG(&_0, 3); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); +} -ZEPHIR_INIT_CLASS(Phalcon_Cli_Router_Exception) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli\\Router, Exception, phalcon, cli_router_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getAdapter) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL; + zval name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&name); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); + zephir_get_strval(&name, name_param); + + + object_init_ex(return_value, phalcon_logger_adapter_noop_ce); + if (zephir_has_constructor(return_value)) { + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); + zephir_check_call_status(); + } + + RETURN_MM(); } +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getAdapters) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif + array_init(return_value); + return; +} +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getLogLevel) +{ + zval *this_ptr = getThis(); + RETURN_LONG(8); +} -ZEPHIR_INIT_CLASS(Phalcon_Cli_Router_Route) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getMessages) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Cli\\Router, Route, phalcon, cli_router_route, phalcon_cli_router_route_method_entry, 0); + zval *this_ptr = getThis(); - zend_declare_property_null(phalcon_cli_router_route_ce, SL("beforeMatch"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_route_ce, SL("compiledPattern"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_route_ce, SL("converters"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_route_ce, SL("delimiter"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_route_ce, SL("delimiterPath"), " ", ZEND_ACC_PROTECTED|ZEND_ACC_STATIC); - zend_declare_property_string(phalcon_cli_router_route_ce, SL("description"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_route_ce, SL("routeId"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_route_ce, SL("name"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_cli_router_route_ce, SL("paths"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_cli_router_route_ce, SL("pattern"), "", ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_cli_router_route_ce, SL("uniqueId"), 0, ZEND_ACC_PROTECTED|ZEND_ACC_STATIC); - phalcon_cli_router_route_ce->create_object = zephir_init_properties_Phalcon_Cli_Router_Route; - zephir_declare_class_constant_string(phalcon_cli_router_route_ce, SL("DEFAULT_DELIMITER"), " "); - zend_class_implements(phalcon_cli_router_route_ce, 1, phalcon_cli_router_routeinterface_ce); - return SUCCESS; + + RETURN_MEMBER(getThis(), "messages"); } -static PHP_METHOD(Phalcon_Cli_Router_Route, __construct) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getName) +{ + zval *this_ptr = getThis(); + + + + RETURN_STRING("memory logger"); +} + +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, info) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, routeId, uniqueId, _0, _1; - zval pattern, _2; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&paths_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&routeId); - ZVAL_UNDEF(&uniqueId); + ZVAL_UNDEF(&message); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&context); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(pattern) + Z_PARAM_STR(message) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_ARRAY(context) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(&pattern, pattern_param); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); } else { - ZEPHIR_INIT_VAR(&pattern); - } - if (!paths) { - paths = &paths_sub; - paths = &__$null; + zephir_get_arrval(&context, context_param); } - ZEPHIR_OBS_VAR(&_0); - zephir_read_static_property_ce(&_0, phalcon_cli_router_route_ce, SL("delimiterPath"), PH_NOISY_CC); - zephir_update_property_zval(this_ptr, ZEND_STRL("delimiter"), &_0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, &pattern, paths); + ZVAL_LONG(&_0, 6); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); zephir_check_call_status(); - ZEPHIR_OBS_VAR(&_1); - zephir_read_static_property_ce(&_1, phalcon_cli_router_route_ce, SL("uniqueId"), PH_NOISY_CC); - ZEPHIR_CPY_WRT(&uniqueId, &_1); - ZEPHIR_CPY_WRT(&routeId, &uniqueId); - zephir_cast_to_string(&_2, &routeId); - zephir_update_property_zval(this_ptr, ZEND_STRL("routeId"), &_2); - ZEPHIR_INIT_ZVAL_NREF(_1); - ZVAL_LONG(&_1, (zephir_get_numberval(&uniqueId) + 1)); - zephir_update_static_property_ce(phalcon_cli_router_route_ce, ZEND_STRL("uniqueId"), &_1); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, beforeMatch) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, notice) { - zval *callback, callback_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&callback_sub); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(callback) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &callback); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("beforeMatch"), callback); - RETURN_THISW(); + ZVAL_LONG(&_0, 5); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, compilePattern) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, warning) { - zend_bool _20; - zval map; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *pattern_param = NULL, idPattern, _0$$3, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, _14$$3, _15$$3, _16$$3, _17$$3, _18$$3, _19$$3; - zval pattern; + zval context; + zval *message_param = NULL, *context_param = NULL, _0; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&idPattern); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_14$$3); - ZVAL_UNDEF(&_15$$3); - ZVAL_UNDEF(&_16$$3); - ZVAL_UNDEF(&_17$$3); - ZVAL_UNDEF(&_18$$3); - ZVAL_UNDEF(&_19$$3); - ZVAL_UNDEF(&map); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&context); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(pattern) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(&pattern, pattern_param); + zephir_fetch_params(1, 1, 1, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); } else { - ZEPHIR_INIT_VAR(&pattern); + zephir_get_arrval(&context, context_param); } - if (zephir_memnstr_str(&pattern, SL(":"), "phalcon/Cli/Router/Route.zep", 121)) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&idPattern); - ZEPHIR_CONCAT_VS(&idPattern, &_0$$3, "([a-zA-Z0-9\\_\\-]+)"); - ZEPHIR_INIT_VAR(&map); - zephir_create_array(&map, 7, 0); - ZEPHIR_OBS_VAR(&_1$$3); - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC); - zephir_array_update_string(&map, SL(":delimiter"), &_1$$3, PH_COPY | PH_SEPARATE); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_3$$3); - ZEPHIR_CONCAT_VS(&_3$$3, &_2$$3, ":module"); - zephir_array_update_zval(&map, &_3$$3, &idPattern, PH_COPY); - zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_5$$3); - ZEPHIR_CONCAT_VS(&_5$$3, &_4$$3, ":task"); - zephir_array_update_zval(&map, &_5$$3, &idPattern, PH_COPY); - zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_7$$3); - ZEPHIR_CONCAT_VS(&_7$$3, &_6$$3, ":namespace"); - zephir_array_update_zval(&map, &_7$$3, &idPattern, PH_COPY); - zephir_read_property(&_8$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_9$$3); - ZEPHIR_CONCAT_VS(&_9$$3, &_8$$3, ":action"); - zephir_array_update_zval(&map, &_9$$3, &idPattern, PH_COPY); - zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_11$$3); - ZEPHIR_CONCAT_VS(&_11$$3, &_10$$3, ":params"); - zephir_read_property(&_12$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_13$$3); - ZEPHIR_CONCAT_SVS(&_13$$3, "(", &_12$$3, ".*)*"); - zephir_array_update_zval(&map, &_11$$3, &_13$$3, PH_COPY); - zephir_read_property(&_14$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&_13$$3); - ZEPHIR_CONCAT_VS(&_13$$3, &_14$$3, ":int"); - zephir_read_property(&_15$$3, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_16$$3); - ZEPHIR_CONCAT_VS(&_16$$3, &_15$$3, "([0-9]+)"); - zephir_array_update_zval(&map, &_13$$3, &_16$$3, PH_COPY); - ZEPHIR_INIT_VAR(&_17$$3); - ZEPHIR_INIT_VAR(&_18$$3); - zephir_array_keys(&_18$$3, &map); - ZEPHIR_CALL_FUNCTION(&_19$$3, "array_values", NULL, 14, &map); - zephir_check_call_status(); - zephir_fast_str_replace(&_17$$3, &_18$$3, &_19$$3, &pattern); - zephir_get_strval(&pattern, &_17$$3); - } - _20 = zephir_memnstr_str(&pattern, SL("("), "phalcon/Cli/Router/Route.zep", 146); - if (!(_20)) { - _20 = zephir_memnstr_str(&pattern, SL("["), "phalcon/Cli/Router/Route.zep", 146); - } - if (_20) { - ZEPHIR_CONCAT_SVS(return_value, "#^", &pattern, "$#"); - RETURN_MM(); - } - RETURN_CTOR(&pattern); + ZVAL_LONG(&_0, 4); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, convert) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, log) { + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *converter, converter_sub; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval context, replace; + zval message; + zval *level, level_sub, *message_param = NULL, *context_param = NULL, key, value, *_0, _1, _6, _4$$3, _5$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&converter_sub); + ZVAL_UNDEF(&level_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&context); + ZVAL_UNDEF(&replace); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(converter) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_ZVAL(level) + Z_PARAM_STR(message) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(context) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &converter); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 2, 1, &level, &message_param, &context_param); + zephir_get_strval(&message, message_param); + if (!context_param) { + ZEPHIR_INIT_VAR(&context); + array_init(&context); + } else { + zephir_get_arrval(&context, context_param); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + + + ZEPHIR_INIT_VAR(&replace); + array_init(&replace); + zephir_is_iterable(&context, 0, "phalcon/DataMapper/Pdo/Profiler/MemoryLogger.zep", 170); + if (Z_TYPE_P(&context) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&context), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + ZEPHIR_INIT_NVAR(&_4$$3); + ZEPHIR_CONCAT_SVS(&_4$$3, "{", &key, "}"); + zephir_array_update_zval(&replace, &_4$$3, &value, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_CALL_METHOD(NULL, &context, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &context, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &context, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &context, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_CONCAT_SVS(&_5$$4, "{", &key, "}"); + zephir_array_update_zval(&replace, &_5$$4, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &context, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_CALL_FUNCTION(&_6, "strtr", NULL, 5, &message, &replace); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("messages"), &_6); + ZEPHIR_MM_RESTORE(); +} +zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_MemoryLogger(zend_class_entry *class_type) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + - zephir_update_property_array(this_ptr, SL("converters"), &name, converter); - RETURN_THIS(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("messages"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } } -static PHP_METHOD(Phalcon_Cli_Router_Route, delimiter) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_Profiler) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Profiler, Profiler, phalcon, datamapper_pdo_profiler_profiler, phalcon_datamapper_pdo_profiler_profiler_method_entry, 0); + + zend_declare_property_bool(phalcon_datamapper_pdo_profiler_profiler_ce, SL("active"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_profiler_profiler_ce, SL("context"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logFormat"), "", ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logLevel"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logger"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_profiler_profiler_ce, SL("encode"), ZEND_ACC_PRIVATE); + phalcon_datamapper_pdo_profiler_profiler_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_Profiler; + + zend_class_implements(phalcon_datamapper_pdo_profiler_profiler_ce, 1, phalcon_datamapper_pdo_profiler_profilerinterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *delimiter_param = NULL; - zval delimiter; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *logger = NULL, logger_sub, __$null, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&delimiter); + ZVAL_UNDEF(&logger_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(delimiter) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(logger, phalcon_logger_loggerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &delimiter_param); - if (!delimiter_param) { - ZEPHIR_INIT_VAR(&delimiter); + zephir_fetch_params(1, 0, 1, &logger); + if (!logger) { + logger = &logger_sub; + ZEPHIR_CPY_WRT(logger, &__$null); } else { - if (UNEXPECTED(Z_TYPE_P(delimiter_param) != IS_STRING && Z_TYPE_P(delimiter_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'delimiter' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_SEPARATE_PARAM(logger); } - if (EXPECTED(Z_TYPE_P(delimiter_param) == IS_STRING)) { - zephir_get_strval(&delimiter, delimiter_param); - } else { - ZEPHIR_INIT_VAR(&delimiter); + + + if (Z_TYPE_P(logger) == IS_NULL) { + ZEPHIR_INIT_NVAR(logger); + object_init_ex(logger, phalcon_datamapper_pdo_profiler_memorylogger_ce); + if (zephir_has_constructor(logger)) { + ZEPHIR_CALL_METHOD(NULL, logger, "__construct", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "{method} ({duration}s): {statement} {backtrace}"); + zephir_update_property_zval(this_ptr, ZEND_STRL("logFormat"), &_0); + ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_LONG(&_1, 7); + zephir_update_property_zval(this_ptr, ZEND_STRL("logLevel"), &_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("logger"), logger); + ZEPHIR_INIT_NVAR(&_0); + object_init_ex(&_0, phalcon_support_helper_json_encode_ce); + if (zephir_has_constructor(&_0)) { + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 0); + zephir_check_call_status(); } - - zephir_update_static_property_ce(phalcon_cli_router_route_ce, ZEND_STRL("delimiterPath"), &delimiter); + zephir_update_property_zval(this_ptr, ZEND_STRL("encode"), &_0); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, extractNamedParams) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, finish) { - long _0, _5$$10, _26$$18; - zend_long cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; - zend_bool notValid = 0, _6$$11, _7$$11, _8$$11, _9$$11, _10$$11, _11$$11, _12$$11, _13$$11, _14$$11, _15$$11, _16$$11, _17$$11, _25$$17; - zval matches; - char ch = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *pattern_param = NULL, tmp, _1$$10, _2$$10, _3$$10, _18$$15, _19$$15, _20$$15, _22$$15, _23$$15, _28$$27, _29$$27; - zval pattern, route, item, variable, regexp, _4$$10, _21$$15, _24$$15, _27$$25, _30$$28; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval values; + zval *statement_param = NULL, *values_param = NULL, __$true, ex, finish, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, _14$$3, _15$$3; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&route); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&variable); - ZVAL_UNDEF(®exp); - ZVAL_UNDEF(&_4$$10); - ZVAL_UNDEF(&_21$$15); - ZVAL_UNDEF(&_24$$15); - ZVAL_UNDEF(&_27$$25); - ZVAL_UNDEF(&_30$$28); - ZVAL_UNDEF(&tmp); - ZVAL_UNDEF(&_1$$10); - ZVAL_UNDEF(&_2$$10); - ZVAL_UNDEF(&_3$$10); - ZVAL_UNDEF(&_18$$15); - ZVAL_UNDEF(&_19$$15); - ZVAL_UNDEF(&_20$$15); - ZVAL_UNDEF(&_22$$15); - ZVAL_UNDEF(&_23$$15); - ZVAL_UNDEF(&_28$$27); - ZVAL_UNDEF(&_29$$27); - ZVAL_UNDEF(&matches); + ZVAL_UNDEF(&statement); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&ex); + ZVAL_UNDEF(&finish); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$3); + ZVAL_UNDEF(&_9$$3); + ZVAL_UNDEF(&_10$$3); + ZVAL_UNDEF(&_11$$3); + ZVAL_UNDEF(&_12$$3); + ZVAL_UNDEF(&_13$$3); + ZVAL_UNDEF(&_14$$3); + ZVAL_UNDEF(&_15$$3); + ZVAL_UNDEF(&values); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(pattern) + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(statement) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &pattern_param); - if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 0, 2, &statement_param, &values_param); + if (!statement_param) { + ZEPHIR_INIT_VAR(&statement); + } else { + zephir_get_strval(&statement, statement_param); } - if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(&pattern, pattern_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - ZEPHIR_INIT_VAR(&pattern); + zephir_get_arrval(&values, values_param); } - bracketCount = 0; - parenthesesCount = 0; - foundPattern = 0; - intermediate = 0; - numberMatches = 0; - if (zephir_fast_strlen_ev(&pattern) == 0) { - RETURN_MM_BOOL(0); - } - ZEPHIR_INIT_VAR(&matches); - array_init(&matches); - ZEPHIR_INIT_VAR(&route); - for (_0 = 0; _0 < Z_STRLEN_P(&pattern); _0++) { - cursor = _0; - ch = ZEPHIR_STRING_OFFSET(&pattern, _0); - if (parenthesesCount == 0) { - if (ch == '{') { - if (bracketCount == 0) { - marker = (cursor + 1); - intermediate = 0; - notValid = 0; - } - bracketCount++; - } else if (ch == '}') { - bracketCount--; - if (intermediate > 0) { - if (bracketCount == 0) { - numberMatches++; - ZEPHIR_INIT_NVAR(&variable); - ZEPHIR_INIT_NVAR(®exp); - ZVAL_LONG(&_1$$10, marker); - ZVAL_LONG(&_2$$10, (cursor - marker)); - ZEPHIR_INIT_NVAR(&_3$$10); - zephir_substr(&_3$$10, &pattern, zephir_get_intval(&_1$$10), zephir_get_intval(&_2$$10), 0); - zephir_cast_to_string(&_4$$10, &_3$$10); - ZEPHIR_CPY_WRT(&item, &_4$$10); - for (_5$$10 = 0; _5$$10 < Z_STRLEN_P(&item); _5$$10++) { - cursorVar = _5$$10; - ch = ZEPHIR_STRING_OFFSET(&item, _5$$10); - if (ch == '\0') { - break; - } - _6$$11 = cursorVar == 0; - if (_6$$11) { - _7$$11 = ch >= 'a'; - if (_7$$11) { - _7$$11 = ch <= 'z'; - } - _8$$11 = _7$$11; - if (!(_8$$11)) { - _9$$11 = ch >= 'A'; - if (_9$$11) { - _9$$11 = ch <= 'Z'; - } - _8$$11 = _9$$11; - } - _6$$11 = !(_8$$11); - } - if (_6$$11) { - notValid = 1; - break; - } - _10$$11 = ch >= 'a'; - if (_10$$11) { - _10$$11 = ch <= 'z'; - } - _11$$11 = _10$$11; - if (!(_11$$11)) { - _12$$11 = ch >= 'A'; - if (_12$$11) { - _12$$11 = ch <= 'Z'; - } - _11$$11 = _12$$11; - } - _13$$11 = _11$$11; - if (!(_13$$11)) { - _14$$11 = ch >= '0'; - if (_14$$11) { - _14$$11 = ch <= '9'; - } - _13$$11 = _14$$11; - } - _15$$11 = _13$$11; - if (!(_15$$11)) { - _15$$11 = ch == '-'; - } - _16$$11 = _15$$11; - if (!(_16$$11)) { - _16$$11 = ch == '_'; - } - _17$$11 = _16$$11; - if (!(_17$$11)) { - _17$$11 = ch == ':'; - } - if (_17$$11) { - if (ch == ':') { - ZVAL_LONG(&_18$$15, 0); - ZVAL_LONG(&_19$$15, cursorVar); - ZEPHIR_INIT_NVAR(&_20$$15); - zephir_substr(&_20$$15, &item, 0 , zephir_get_intval(&_19$$15), 0); - zephir_cast_to_string(&_21$$15, &_20$$15); - ZEPHIR_CPY_WRT(&variable, &_21$$15); - ZVAL_LONG(&_22$$15, (cursorVar + 1)); - ZEPHIR_INIT_NVAR(&_23$$15); - zephir_substr(&_23$$15, &item, zephir_get_intval(&_22$$15), 0, ZEPHIR_SUBSTR_NO_LENGTH); - zephir_cast_to_string(&_24$$15, &_23$$15); - ZEPHIR_CPY_WRT(®exp, &_24$$15); - break; - } - } else { - notValid = 1; - break; - } - } - if (!(notValid)) { - ZEPHIR_INIT_NVAR(&tmp); - ZVAL_LONG(&tmp, numberMatches); - _25$$17 = zephir_is_true(&variable); - if (_25$$17) { - _25$$17 = zephir_is_true(®exp); - } - if (_25$$17) { - foundPattern = 0; - for (_26$$18 = 0; _26$$18 < Z_STRLEN_P(®exp); _26$$18++) { - ch = ZEPHIR_STRING_OFFSET(®exp, _26$$18); - if (ch == '\0') { - break; - } - if (!(foundPattern)) { - if (ch == '(') { - foundPattern = 1; - } - } else { - if (ch == ')') { - foundPattern = 2; - break; - } - } - } - if (foundPattern != 2) { - ZEPHIR_INIT_NVAR(&_27$$25); - ZEPHIR_CONCAT_SVS(&_27$$25, "(", ®exp, ")"); - zephir_concat_self(&route, &_27$$25); - } else { - zephir_concat_self(&route, ®exp); - } - zephir_array_update_zval(&matches, &variable, &tmp, PH_COPY | PH_SEPARATE); - } else { - zephir_read_property(&_28$$27, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&_29$$27); - ZEPHIR_CONCAT_SVS(&_29$$27, "([^", &_28$$27, "]*)"); - zephir_concat_self(&route, &_29$$27); - zephir_array_update_zval(&matches, &item, &tmp, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_INIT_NVAR(&_30$$28); - ZEPHIR_CONCAT_SVS(&_30$$28, "{", &item, "}"); - zephir_concat_self(&route, &_30$$28); - } - continue; - } - } - } - } - if (bracketCount == 0) { - if (ch == '(') { - parenthesesCount++; - } else if (ch == ')') { - parenthesesCount--; - if (parenthesesCount == 0) { - numberMatches++; - } - } - } - if (bracketCount > 0) { - intermediate++; + zephir_read_property(&_0, this_ptr, ZEND_STRL("active"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(zephir_is_true(&_0))) { + ZEPHIR_INIT_VAR(&ex); + object_init_ex(&ex, phalcon_datamapper_pdo_exception_exception_ce); + ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 32); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&finish, "hrtime", NULL, 202, &__$true); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, &ex, "gettraceasstring", NULL, 203); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "backtrace"); + zephir_update_property_array(this_ptr, SL("context"), &_2$$3, &_1$$3); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_4$$3, &_3$$3, SL("start"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Profiler/Profiler.zep", 91); + ZEPHIR_INIT_VAR(&_5$$3); + zephir_sub_function(&_5$$3, &finish, &_4$$3); + ZEPHIR_INIT_VAR(&_6$$3); + ZVAL_STRING(&_6$$3, "duration"); + zephir_update_property_array(this_ptr, SL("context"), &_6$$3, &_5$$3); + ZEPHIR_INIT_VAR(&_7$$3); + ZVAL_STRING(&_7$$3, "finish"); + zephir_update_property_array(this_ptr, SL("context"), &_7$$3, &finish); + ZEPHIR_INIT_VAR(&_8$$3); + ZVAL_STRING(&_8$$3, "statement"); + zephir_update_property_array(this_ptr, SL("context"), &_8$$3, &statement); + ZEPHIR_INIT_NVAR(&_5$$3); + if (ZEPHIR_IS_EMPTY(&values)) { + ZEPHIR_INIT_NVAR(&_5$$3); + ZVAL_STRING(&_5$$3, ""); } else { - zephir_concat_self_char(&route, ch); + zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("encode"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_5$$3, &_9$$3, "__invoke", NULL, 0, &values); + zephir_check_call_status(); } + ZEPHIR_INIT_VAR(&_10$$3); + ZVAL_STRING(&_10$$3, "values"); + zephir_update_property_array(this_ptr, SL("context"), &_10$$3, &_5$$3); + zephir_read_property(&_11$$3, this_ptr, ZEND_STRL("logger"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_12$$3, this_ptr, ZEND_STRL("logLevel"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_13$$3, this_ptr, ZEND_STRL("logFormat"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_14$$3, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_11$$3, "log", NULL, 0, &_12$$3, &_13$$3, &_14$$3); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_15$$3); + array_init(&_15$$3); + zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &_15$$3); } - zephir_create_array(return_value, 2, 0); - zephir_array_fast_append(return_value, &route); - zephir_array_fast_append(return_value, &matches); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getBeforeMatch) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogFormat) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "beforeMatch"); + RETURN_MEMBER(getThis(), "logFormat"); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getCompiledPattern) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogger) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "compiledPattern"); + RETURN_MEMBER(getThis(), "logger"); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getConverters) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogLevel) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "converters"); + RETURN_MEMBER(getThis(), "logLevel"); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getDelimiter) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, isActive) { - zval _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - - zephir_read_static_property_ce(&_0, phalcon_cli_router_route_ce, SL("delimiterPath"), PH_NOISY_CC | PH_READONLY); - RETURN_CTORW(&_0); + RETURN_MEMBER(getThis(), "active"); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getDescription) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setActive) { + zval *active_param = NULL, __$true, __$false; + zend_bool active; zval *this_ptr = getThis(); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(active) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "description"); -} - -static PHP_METHOD(Phalcon_Cli_Router_Route, getName) -{ - zval *this_ptr = getThis(); - + zephir_fetch_params_without_memory_grow(1, 0, &active_param); + active = zephir_get_boolval(active_param); - RETURN_MEMBER(getThis(), "name"); + if (active) { + zephir_update_property_zval(this_ptr, ZEND_STRL("active"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("active"), &__$false); + } + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getPaths) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setLogFormat) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *logFormat_param = NULL; + zval logFormat; zval *this_ptr = getThis(); + ZVAL_UNDEF(&logFormat); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(logFormat) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &logFormat_param); + zephir_get_strval(&logFormat, logFormat_param); - RETURN_MEMBER(getThis(), "paths"); + zephir_update_property_zval(this_ptr, ZEND_STRL("logFormat"), &logFormat); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getPattern) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setLogLevel) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *logLevel_param = NULL; + zval logLevel; zval *this_ptr = getThis(); + ZVAL_UNDEF(&logLevel); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(logLevel) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &logLevel_param); + zephir_get_strval(&logLevel, logLevel_param); - RETURN_MEMBER(getThis(), "pattern"); + zephir_update_property_zval(this_ptr, ZEND_STRL("logLevel"), &logLevel); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getReversedPaths) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, start) { - zval _0; + zval _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *method_param = NULL, __$true, _0, _2$$3; + zval method; zval *this_ptr = getThis(); + ZVAL_UNDEF(&method); + ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_1$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(method) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &method_param); + zephir_get_strval(&method, method_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("array_flip", NULL, 96, &_0); - zephir_check_call_status(); - RETURN_MM(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("active"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(zephir_is_true(&_0))) { + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 2, 0); + zephir_array_update_string(&_1$$3, SL("method"), &method, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_FUNCTION(&_2$$3, "hrtime", NULL, 202, &__$true); + zephir_check_call_status(); + zephir_array_update_string(&_1$$3, SL("start"), &_2$$3, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Cli_Router_Route, getRouteId) +zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_Profiler(zend_class_entry *class_type) { - zval *this_ptr = getThis(); + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("context"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} - RETURN_MEMBER(getThis(), "routeId"); -} -static PHP_METHOD(Phalcon_Cli_Router_Route, reConfigure) +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface) { - zend_bool _1$$10; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS, _0$$4; - zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, moduleName, taskName, actionName, parts, routePaths, realClassName, namespaceName, pcrePattern, compiledPattern, extracted, _2$$9, _3$$18, _4$$18, _5$$21, _6$$21, _7$$21; - zval pattern; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Profiler, ProfilerInterface, phalcon, datamapper_pdo_profiler_profilerinterface, phalcon_datamapper_pdo_profiler_profilerinterface_method_entry); - ZVAL_UNDEF(&pattern); - ZVAL_UNDEF(&paths_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&moduleName); - ZVAL_UNDEF(&taskName); - ZVAL_UNDEF(&actionName); - ZVAL_UNDEF(&parts); - ZVAL_UNDEF(&routePaths); - ZVAL_UNDEF(&realClassName); - ZVAL_UNDEF(&namespaceName); - ZVAL_UNDEF(&pcrePattern); - ZVAL_UNDEF(&compiledPattern); - ZVAL_UNDEF(&extracted); - ZVAL_UNDEF(&_2$$9); - ZVAL_UNDEF(&_3$$18); - ZVAL_UNDEF(&_4$$18); - ZVAL_UNDEF(&_5$$21); - ZVAL_UNDEF(&_6$$21); - ZVAL_UNDEF(&_7$$21); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(pattern) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(paths) - ZEND_PARSE_PARAMETERS_END(); + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, finish); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogger); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogFormat); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogLevel); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, isActive); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setActive); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setLogFormat); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setLogLevel); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, start); + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pattern_param, &paths); - if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { - zephir_get_strval(&pattern, pattern_param); - } else { - ZEPHIR_INIT_VAR(&pattern); - } - if (!paths) { - paths = &paths_sub; - ZEPHIR_CPY_WRT(paths, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(paths); - } - if (Z_TYPE_P(paths) == IS_NULL) { - ZEPHIR_INIT_NVAR(paths); - array_init(paths); - } - if (Z_TYPE_P(paths) == IS_STRING) { - ZEPHIR_INIT_VAR(&moduleName); - ZVAL_NULL(&moduleName); - ZEPHIR_INIT_VAR(&taskName); - ZVAL_NULL(&taskName); - ZEPHIR_INIT_VAR(&actionName); - ZVAL_NULL(&actionName); - ZEPHIR_INIT_VAR(&parts); - zephir_fast_explode_str(&parts, SL("::"), paths, LONG_MAX); - do { - _0$$4 = zephir_fast_count_int(&parts); - if (_0$$4 == 3) { - ZEPHIR_OBS_NVAR(&moduleName); - zephir_array_fetch_long(&moduleName, &parts, 0, PH_NOISY, "phalcon/Cli/Router/Route.zep", 417); - ZEPHIR_OBS_NVAR(&taskName); - zephir_array_fetch_long(&taskName, &parts, 1, PH_NOISY, "phalcon/Cli/Router/Route.zep", 418); - ZEPHIR_OBS_NVAR(&actionName); - zephir_array_fetch_long(&actionName, &parts, 2, PH_NOISY, "phalcon/Cli/Router/Route.zep", 419); - break; - } - if (_0$$4 == 2) { - ZEPHIR_OBS_NVAR(&taskName); - zephir_array_fetch_long(&taskName, &parts, 0, PH_NOISY, "phalcon/Cli/Router/Route.zep", 423); - ZEPHIR_OBS_NVAR(&actionName); - zephir_array_fetch_long(&actionName, &parts, 1, PH_NOISY, "phalcon/Cli/Router/Route.zep", 424); - break; - } - if (_0$$4 == 1) { - ZEPHIR_OBS_NVAR(&taskName); - zephir_array_fetch_long(&taskName, &parts, 0, PH_NOISY, "phalcon/Cli/Router/Route.zep", 428); - break; - } - } while(0); - ZEPHIR_INIT_VAR(&routePaths); - array_init(&routePaths); - if (Z_TYPE_P(&moduleName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&taskName) != IS_NULL) { - if (zephir_memnstr_str(&taskName, SL("\\"), "phalcon/Cli/Router/Route.zep", 442)) { - ZEPHIR_INIT_VAR(&realClassName); - zephir_get_class_ns(&realClassName, &taskName, 0); - ZEPHIR_INIT_VAR(&namespaceName); - zephir_get_ns_class(&namespaceName, &taskName, 0); - _1$$10 = Z_TYPE_P(&namespaceName) == IS_NULL; - if (!(_1$$10)) { - _1$$10 = Z_TYPE_P(&realClassName) == IS_NULL; - } - if (UNEXPECTED(_1$$10)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "The route contains invalid paths", "phalcon/Cli/Router/Route.zep", 452); - return; - } - if (zephir_is_true(&namespaceName)) { - zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(&realClassName, &taskName); - } - ZEPHIR_INIT_VAR(&_2$$9); - zephir_uncamelize(&_2$$9, &realClassName, NULL ); - zephir_array_update_string(&routePaths, SL("task"), &_2$$9, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&actionName) != IS_NULL) { - zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(&routePaths, paths); - } - if (UNEXPECTED(Z_TYPE_P(&routePaths) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "The route contains invalid paths", "phalcon/Cli/Router/Route.zep", 476); - return; - } - if (!(zephir_start_with_str(&pattern, SL("#")))) { - if (zephir_memnstr_str(&pattern, SL("{"), "phalcon/Cli/Router/Route.zep", 484)) { - ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, &pattern); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(&pcrePattern); - zephir_array_fetch_long(&pcrePattern, &extracted, 0, PH_NOISY, "phalcon/Cli/Router/Route.zep", 489); - ZEPHIR_INIT_VAR(&_3$$18); - zephir_array_fetch_long(&_4$$18, &extracted, 1, PH_NOISY | PH_READONLY, "phalcon/Cli/Router/Route.zep", 490); - zephir_fast_array_merge(&_3$$18, &routePaths, &_4$$18); - ZEPHIR_CPY_WRT(&routePaths, &_3$$18); - } else { - ZEPHIR_CPY_WRT(&pcrePattern, &pattern); - } - ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, &pcrePattern); - zephir_check_call_status(); - } else { - if (zephir_memnstr_str(&pattern, SL(":delimiter"), "phalcon/Cli/Router/Route.zep", 501)) { - ZEPHIR_INIT_VAR(&_5$$21); - zephir_read_property(&_6$$21, this_ptr, ZEND_STRL("delimiter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_7$$21); - ZVAL_STRING(&_7$$21, ":delimiter"); - zephir_fast_str_replace(&_5$$21, &_7$$21, &_6$$21, &pattern); - zephir_get_strval(&pattern, &_5$$21); - } - ZEPHIR_CPY_WRT(&compiledPattern, &pattern); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("pattern"), &pattern); - zephir_update_property_zval(this_ptr, ZEND_STRL("compiledPattern"), &compiledPattern); - zephir_update_property_zval(this_ptr, ZEND_STRL("paths"), &routePaths); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Cli_Router_Route, reset) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_CannotDisconnect) { - zval _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, CannotDisconnect, phalcon, datamapper_pdo_exception_cannotdisconnect, phalcon_datamapper_pdo_exception_exception_ce, NULL, 0); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, 0); - zephir_update_static_property_ce(phalcon_cli_router_route_ce, ZEND_STRL("uniqueId"), &_0); + return SUCCESS; } -static PHP_METHOD(Phalcon_Cli_Router_Route, setDescription) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *description_param = NULL; - zval description; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&description); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(description) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &description_param); - if (UNEXPECTED(Z_TYPE_P(description_param) != IS_STRING && Z_TYPE_P(description_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'description' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(description_param) == IS_STRING)) { - zephir_get_strval(&description, description_param); - } else { - ZEPHIR_INIT_VAR(&description); - } - - zephir_update_property_zval(this_ptr, ZEND_STRL("description"), &description); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Cli_Router_Route, setName) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL; - zval name; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - RETURN_THIS(); -} -zend_object *zephir_init_properties_Phalcon_Cli_Router_Route(zend_class_entry *class_type) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_ConnectionNotFound) { - zval _0, _2, _1$$3, _3$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, ConnectionNotFound, phalcon, datamapper_pdo_exception_connectionnotfound, phalcon_datamapper_pdo_exception_exception_ce, NULL, 0); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("paths"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("converters"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("converters"), &_3$$4); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + return SUCCESS; } @@ -27223,27 +26566,13 @@ zend_object *zephir_init_properties_Phalcon_Cli_Router_Route(zend_class_entry *c -ZEPHIR_INIT_CLASS(Phalcon_Cli_Router_RouteInterface) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_Exception) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cli\\Router, RouteInterface, phalcon, cli_router_routeinterface, phalcon_cli_router_routeinterface_method_entry); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, Exception, phalcon, datamapper_pdo_exception_exception, zend_ce_exception, NULL, 0); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, compilePattern); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, delimiter); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getCompiledPattern); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getDelimiter); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getDescription); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getPaths); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getPattern); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getReversedPaths); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, getRouteId); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, reConfigure); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, reset); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, setDescription); -ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, setName); @@ -27254,1950 +26583,1657 @@ ZEPHIR_DOC_METHOD(Phalcon_Cli_Router_RouteInterface, setName); -ZEPHIR_INIT_CLASS(Phalcon_Cli_Console_Exception) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_AbstractConnection) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli\\Console, Exception, phalcon, cli_console_exception, phalcon_application_exception_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Connection, AbstractConnection, phalcon, datamapper_pdo_connection_abstractconnection, phalcon_datamapper_pdo_connection_abstractconnection_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_declare_property_null(phalcon_datamapper_pdo_connection_abstractconnection_ce, SL("pdo"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_pdo_connection_abstractconnection_ce, SL("profiler"), ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_datamapper_pdo_connection_abstractconnection_ce, 1, phalcon_datamapper_pdo_connection_connectioninterface_ce); return SUCCESS; } +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, __call) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval arguments, _2; + zval *name, name_sub, *arguments_param = NULL, className, message, _0, _3, _1$$3; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&name_sub); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(name) + Z_PARAM_ARRAY(arguments) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &name, &arguments_param); + zephir_get_arrval(&arguments, arguments_param); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + if (!((zephir_method_exists(&_0, name) == SUCCESS))) { + ZEPHIR_INIT_VAR(&className); + zephir_get_class(&className, this_ptr, 0); + ZEPHIR_INIT_VAR(&message); + ZEPHIR_CONCAT_SVSVS(&message, "Class '", &className, "' does not have a method '", name, "'"); + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, spl_ce_BadMethodCallException); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 75, &message); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 59); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 2, 0); + ZEPHIR_OBS_VAR(&_3); + zephir_read_property(&_3, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); + zephir_array_fast_append(&_2, &_3); + zephir_array_fast_append(&_2, name); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_2, &arguments); + zephir_check_call_status(); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Cli_Dispatcher_Exception) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, beginTransaction) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cli\\Dispatcher, Exception, phalcon, cli_dispatcher_exception, phalcon_dispatcher_exception_ce, NULL, 0); + zval result, _0, _1, _2, _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); - return SUCCESS; -} + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZEPHIR_MM_GROW(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "beginTransaction"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&result, &_2, "begintransaction", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + zephir_check_call_status(); + RETURN_CCTOR(&result); +} -#ifdef HAVE_CONFIG_H -#endif +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, commit) +{ + zval result, _0, _1, _2, _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZEPHIR_MM_GROW(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "commit"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&result, &_2, "commit", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + zephir_check_call_status(); + RETURN_CCTOR(&result); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Exception) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, connect) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms, Exception, phalcon, forms_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; } +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, disconnect) +{ +} +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, errorCode) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "errorcode", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, errorInfo) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); -ZEPHIR_INIT_CLASS(Phalcon_Forms_Form) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms, Form, phalcon, forms_form, phalcon_di_injectable_ce, phalcon_forms_form_method_entry, 0); - zend_declare_property_null(phalcon_forms_form_ce, SL("attributes"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("data"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("filteredData"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("elements"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("elementsIndexed"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("entity"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("messages"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_forms_form_ce, SL("position"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("options"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("tagFactory"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("validation"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_form_ce, SL("whitelist"), ZEND_ACC_PROTECTED); - phalcon_forms_form_ce->create_object = zephir_init_properties_Phalcon_Forms_Form; + ZEPHIR_MM_GROW(); - zend_class_implements(phalcon_forms_form_ce, 1, zend_ce_countable); - zend_class_implements(phalcon_forms_form_ce, 1, zend_ce_iterator); - zend_class_implements(phalcon_forms_form_ce, 1, phalcon_html_attributes_attributesinterface_ce); - return SUCCESS; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "errorinfo", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, __construct) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, exec) { - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval userOptions; - zval *entity = NULL, entity_sub, *userOptions_param = NULL, __$null, _1; + zval *statement_param = NULL, affectedRows, _0, _1, _2, _3; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&entity_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&affectedRows); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&userOptions); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 2) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(entity) - Z_PARAM_ARRAY(userOptions) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(statement) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, &entity, &userOptions_param); - if (!entity) { - entity = &entity_sub; - entity = &__$null; - } - if (!userOptions_param) { - ZEPHIR_INIT_VAR(&userOptions); - array_init(&userOptions); - } else { - zephir_get_arrval(&userOptions, userOptions_param); - } + zephir_fetch_params(1, 1, 0, &statement_param); + zephir_get_strval(&statement, statement_param); - _0 = Z_TYPE_P(entity) != IS_NULL; - if (_0) { - _0 = Z_TYPE_P(entity) != IS_OBJECT; - } - if (UNEXPECTED(_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "The base entity is not valid", "phalcon/Forms/Form.zep", 98); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("entity"), entity); - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &userOptions); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); - object_init_ex(&_1, phalcon_html_attributes_ce); - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 22); + ZVAL_STRING(&_1, "exec"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_1); - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("initialize")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, entity, &userOptions); - zephir_check_call_status(); - } - ZEPHIR_MM_RESTORE(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&affectedRows, &_2, "exec", NULL, 0, &statement); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0, &statement); + zephir_check_call_status(); + RETURN_CCTOR(&affectedRows); } -static PHP_METHOD(Phalcon_Forms_Form, add) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAffected) { - zend_string *_9$$5; - zend_ulong _8$$5; - zval elements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool type, _0, _3; - zval position; - zval *element, element_sub, *position_param = NULL, *type_param = NULL, name, key, value, _1, _4, _2$$3, _5$$5, *_6$$5, _7$$5; + zval values; + zval *statement_param = NULL, *values_param = NULL, sth; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&element_sub); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&sth); + ZVAL_UNDEF(&values); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_OBJECT_OF_CLASS(element, phalcon_forms_element_elementinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(position) - Z_PARAM_BOOL_OR_NULL(type, is_null_true) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &element, &position_param, &type_param); - if (!position_param) { - ZEPHIR_INIT_VAR(&position); - } else { - zephir_get_strval(&position, position_param); - } - if (!type_param) { - type = 0; + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - type = zephir_get_boolval(type_param); + zephir_get_arrval(&values, values_param); } - ZEPHIR_CALL_METHOD(&name, element, "getname", NULL, 0); + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, element, "setform", NULL, 0, this_ptr); + ZEPHIR_RETURN_CALL_METHOD(&sth, "rowcount", NULL, 0); zephir_check_call_status(); - _0 = (zephir_method_exists_ex(element, ZEND_STRL("settagfactory")) == SUCCESS); - if (_0) { - zephir_read_property(&_1, this_ptr, ZEND_STRL("tagFactory"), PH_NOISY_CC | PH_READONLY); - _0 = Z_TYPE_P(&_1) != IS_NULL; - } - if (_0) { - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("tagFactory"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, element, "settagfactory", NULL, 0, &_2$$3); - zephir_check_call_status(); - } - _3 = ZEPHIR_IS_NULL(&position); - if (!(_3)) { - zephir_read_property(&_4, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - _3 = ZEPHIR_IS_EMPTY(&_4); - } - if (_3) { - zephir_update_property_array(this_ptr, SL("elements"), &name, element); - } else { - ZEPHIR_INIT_VAR(&elements); - array_init(&elements); - zephir_read_property(&_5$$5, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_5$$5, 0, "phalcon/Forms/Form.zep", 176); - if (Z_TYPE_P(&_5$$5) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_5$$5), _8$$5, _9$$5, _6$$5) - { - ZEPHIR_INIT_NVAR(&key); - if (_9$$5 != NULL) { - ZVAL_STR_COPY(&key, _9$$5); - } else { - ZVAL_LONG(&key, _8$$5); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _6$$5); - if (ZEPHIR_IS_EQUAL(&key, &position)) { - if (type) { - zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); - } - } else { - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_5$$5, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_7$$5, &_5$$5, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_7$$5)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &_5$$5, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &_5$$5, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&key, &position)) { - if (type) { - zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); - } - } else { - zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); - } - ZEPHIR_CALL_METHOD(NULL, &_5$$5, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - zephir_update_property_zval(this_ptr, ZEND_STRL("elements"), &elements); - } - RETURN_THIS(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, bind) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAll) { - zend_bool _7$$5, _14$$13; - zend_string *_5; - zend_ulong _4; - zval method; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_8 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *entity = NULL, entity_sub, *whitelist_param = NULL, __$null, filter, key, value, element, filters, container, filteredValue, _0, *_2, _3, _1$$4, _6$$5, _9$$9, _10$$9, _11$$11, _12$$11, _13$$13, _15$$17, _16$$17, _17$$19, _18$$19; - zval data, whitelist, assignData, filteredData; + zval values, _0; + zval *statement_param = NULL, *values_param = NULL, _1; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&whitelist); - ZVAL_UNDEF(&assignData); - ZVAL_UNDEF(&filteredData); - ZVAL_UNDEF(&entity_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&filter); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&filters); - ZVAL_UNDEF(&container); - ZVAL_UNDEF(&filteredValue); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&values); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_9$$9); - ZVAL_UNDEF(&_10$$9); - ZVAL_UNDEF(&_11$$11); - ZVAL_UNDEF(&_12$$11); - ZVAL_UNDEF(&_13$$13); - ZVAL_UNDEF(&_15$$17); - ZVAL_UNDEF(&_16$$17); - ZVAL_UNDEF(&_17$$19); - ZVAL_UNDEF(&_18$$19); - ZVAL_UNDEF(&method); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(data) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(entity) - Z_PARAM_ARRAY(whitelist) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &data_param, &entity, &whitelist_param); - ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); - if (!entity) { - entity = &entity_sub; - ZEPHIR_CPY_WRT(entity, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(entity); - } - if (!whitelist_param) { - ZEPHIR_INIT_VAR(&whitelist); - array_init(&whitelist); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - zephir_get_arrval(&whitelist, whitelist_param); + zephir_get_arrval(&values, values_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&_0))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "There are no elements in the form", "phalcon/Forms/Form.zep", 195); - return; - } - if (ZEPHIR_IS_EMPTY(&whitelist)) { - zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("whitelist"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&whitelist, &_1$$4); - } - ZEPHIR_INIT_VAR(&filter); - ZVAL_NULL(&filter); - ZEPHIR_INIT_VAR(&assignData); - array_init(&assignData); - ZEPHIR_INIT_VAR(&filteredData); - array_init(&filteredData); - zephir_is_iterable(&data, 0, "phalcon/Forms/Form.zep", 261); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _4, _5, _2) - { - ZEPHIR_INIT_NVAR(&key); - if (_5 != NULL) { - ZVAL_STR_COPY(&key, _5); - } else { - ZVAL_LONG(&key, _4); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _2); - ZEPHIR_OBS_NVAR(&element); - zephir_read_property(&_6$$5, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&element, &_6$$5, &key, 0))) { - continue; - } - _7$$5 = !(ZEPHIR_IS_EMPTY(&whitelist)); - if (_7$$5) { - _7$$5 = !(zephir_fast_in_array(&key, &whitelist)); - } - if (_7$$5) { - continue; - } - ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&filters)) { - if (Z_TYPE_P(&filter) != IS_OBJECT) { - ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", &_8, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$9); - ZVAL_STRING(&_10$$9, "filter"); - ZEPHIR_CALL_METHOD(&_9$$9, &container, "getshared", NULL, 0, &_10$$9); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&filter, &_9$$9); - } - ZEPHIR_CALL_METHOD(&filteredValue, &filter, "sanitize", NULL, 0, &value, &filters); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&filteredValue, &value); - } - zephir_array_update_zval(&assignData, &key, &value, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&filteredData, &key, &filteredValue, PH_COPY | PH_SEPARATE); - if (Z_TYPE_P(entity) != IS_NULL) { - ZEPHIR_INIT_NVAR(&_11$$11); - zephir_camelize(&_11$$11, &key, NULL ); - ZEPHIR_INIT_NVAR(&_12$$11); - ZEPHIR_CONCAT_SV(&_12$$11, "set", &_11$$11); - zephir_get_strval(&method, &_12$$11); - if ((zephir_method_exists(entity, &method) == SUCCESS)) { - ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, &method, NULL, 0, &filteredValue); - zephir_check_call_status(); - continue; - } - zephir_update_property_zval_zval(entity, &key, &filteredValue); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &data, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&element); - zephir_read_property(&_13$$13, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&element, &_13$$13, &key, 0))) { - continue; - } - _14$$13 = !(ZEPHIR_IS_EMPTY(&whitelist)); - if (_14$$13) { - _14$$13 = !(zephir_fast_in_array(&key, &whitelist)); - } - if (_14$$13) { - continue; - } - ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&filters)) { - if (Z_TYPE_P(&filter) != IS_OBJECT) { - ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", &_8, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_16$$17); - ZVAL_STRING(&_16$$17, "filter"); - ZEPHIR_CALL_METHOD(&_15$$17, &container, "getshared", NULL, 0, &_16$$17); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&filter, &_15$$17); - } - ZEPHIR_CALL_METHOD(&filteredValue, &filter, "sanitize", NULL, 0, &value, &filters); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&filteredValue, &value); - } - zephir_array_update_zval(&assignData, &key, &value, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&filteredData, &key, &filteredValue, PH_COPY | PH_SEPARATE); - if (Z_TYPE_P(entity) != IS_NULL) { - ZEPHIR_INIT_NVAR(&_17$$19); - zephir_camelize(&_17$$19, &key, NULL ); - ZEPHIR_INIT_NVAR(&_18$$19); - ZEPHIR_CONCAT_SV(&_18$$19, "set", &_17$$19); - zephir_get_strval(&method, &_18$$19); - if ((zephir_method_exists(entity, &method) == SUCCESS)) { - ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, &method, NULL, 0, &filteredValue); - zephir_check_call_status(); - continue; - } - zephir_update_property_zval_zval(entity, &key, &filteredValue); - } - ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &assignData); - zephir_update_property_zval(this_ptr, ZEND_STRL("filteredData"), &filteredData); - RETURN_THIS(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, 2); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "fetchAll"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, clear) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAssoc) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_2 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *fields = NULL, fields_sub, __$null, elements, element, data, field, _0, *_1$$3, _2$$3, _3$$4, _4$$4, _5$$5, _6$$5, _7$$7, *_8$$6, _9$$6, _10$$10, _11$$10, _12$$13, _13$$13; + zval values; + zval *statement_param = NULL, *values_param = NULL, data, row, sth, _0, _1$$3, _3$$3; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&fields_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&elements); - ZVAL_UNDEF(&element); + ZVAL_UNDEF(&statement); ZVAL_UNDEF(&data); - ZVAL_UNDEF(&field); + ZVAL_UNDEF(&row); + ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_9$$6); - ZVAL_UNDEF(&_10$$10); - ZVAL_UNDEF(&_11$$10); - ZVAL_UNDEF(&_12$$13); - ZVAL_UNDEF(&_13$$13); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&values); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(fields) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &fields); - if (!fields) { - fields = &fields_sub; - ZEPHIR_CPY_WRT(fields, &__$null); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - ZEPHIR_SEPARATE_PARAM(fields); + zephir_get_arrval(&values, values_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&data, &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&elements, &_0); - if (Z_TYPE_P(fields) == IS_NULL) { - ZEPHIR_INIT_NVAR(&data); - array_init(&data); - zephir_is_iterable(&elements, 0, "phalcon/Forms/Form.zep", 290); - if (Z_TYPE_P(&elements) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&elements), _1$$3) - { - ZEPHIR_INIT_NVAR(&element); - ZVAL_COPY(&element, _1$$3); - ZEPHIR_CALL_METHOD(&_3$$4, &element, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$4, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_zval(&data, &_4$$4, &_3$$4, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &elements, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$3, &elements, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&element, &elements, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$5, &element, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$5, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_zval(&data, &_6$$5, &_5$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &elements, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&element); - } else { - if (Z_TYPE_P(fields) != IS_ARRAY) { - ZEPHIR_INIT_VAR(&_7$$7); - zephir_create_array(&_7$$7, 1, 0); - zephir_array_fast_append(&_7$$7, fields); - ZEPHIR_CPY_WRT(fields, &_7$$7); - } - zephir_is_iterable(fields, 0, "phalcon/Forms/Form.zep", 304); - if (Z_TYPE_P(fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(fields), _8$$6) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _8$$6); - if (zephir_array_isset(&data, &field)) { - zephir_array_unset(&data, &field, PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&element); - if (zephir_array_isset_fetch(&element, &elements, &field, 0)) { - ZEPHIR_CALL_METHOD(&_10$$10, &element, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_11$$10, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_zval(&data, &_11$$10, &_10$$10, PH_COPY | PH_SEPARATE); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, fields, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9$$6, fields, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9$$6)) { - break; - } - ZEPHIR_CALL_METHOD(&field, fields, "current", NULL, 0); - zephir_check_call_status(); - if (zephir_array_isset(&data, &field)) { - zephir_array_unset(&data, &field, PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&element); - if (zephir_array_isset_fetch(&element, &elements, &field, 0)) { - ZEPHIR_CALL_METHOD(&_12$$13, &element, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_13$$13, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_zval(&data, &_13$$13, &_12$$13, PH_COPY | PH_SEPARATE); - } - ZEPHIR_CALL_METHOD(NULL, fields, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_INIT_VAR(&data); + array_init(&data); + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); + zephir_check_call_status(); + ZVAL_LONG(&_0, 2); + ZEPHIR_CALL_METHOD(&row, &sth, "fetch", NULL, 0, &_0); + zephir_check_call_status(); + while (1) { + if (!(zephir_is_true(&row))) { + break; } - ZEPHIR_INIT_NVAR(&field); + ZEPHIR_CALL_FUNCTION(&_1$$3, "current", &_2, 4, &row); + zephir_check_call_status(); + zephir_array_update_zval(&data, &_1$$3, &row, PH_COPY | PH_SEPARATE); + ZVAL_LONG(&_3$$3, 2); + ZEPHIR_CALL_METHOD(&row, &sth, "fetch", NULL, 0, &_3$$3); + zephir_check_call_status(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &data); - RETURN_THIS(); + RETURN_CCTOR(&data); } -static PHP_METHOD(Phalcon_Forms_Form, count) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchColumn) { - zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long column, ZEPHIR_LAST_CALL_STATUS; + zval values, _0; + zval *statement_param = NULL, *values_param = NULL, *column_param = NULL, _1; + zval statement; zval *this_ptr = getThis(); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&values); ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) + Z_PARAM_LONG(column) + ZEND_PARSE_PARAMETERS_END(); +#endif - - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - RETURN_LONG(zephir_fast_count_int(&_0)); -} - -static PHP_METHOD(Phalcon_Forms_Form, current) -{ - zval element, _0, _1; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &statement_param, &values_param, &column_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); + } + if (!column_param) { + column = 0; + } else { + column = zephir_get_intval(column_param); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("elementsIndexed"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&element, &_0, &_1, 1))) { - RETURN_BOOL(0); - } - RETURN_CTORW(&element); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, 7); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_LONG(&_1, column); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "fetchAll"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, get) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchGroup) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, element, _0, _1$$3; - zval name, _2$$3; + zend_long flags, ZEPHIR_LAST_CALL_STATUS; + zval values, _0; + zval *statement_param = NULL, *values_param = NULL, *flags_param = NULL, _1; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&element); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&values); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) + Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 2, &statement_param, &values_param, &flags_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!flags_param) { + flags = 2; } else { - ZEPHIR_INIT_VAR(&name); + flags = zephir_get_intval(flags_param); } - ZEPHIR_OBS_VAR(&element); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_forms_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 343); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_CCTOR(&element); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, (65536 | flags)); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "fetchAll"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getAction) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchObject) { - zval _3; - zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval values, arguments; + zval *statement_param = NULL, *values_param = NULL, *className_param = NULL, *arguments_param = NULL, sth; + zval statement, className; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&sth); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&arguments); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) + Z_PARAM_STR(className) + Z_PARAM_ARRAY(arguments) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 3, &statement_param, &values_param, &className_param, &arguments_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); + } + if (!className_param) { + ZEPHIR_INIT_VAR(&className); + ZVAL_STRING(&className, "stdClass"); + } else { + zephir_get_strval(&className, className_param); + } + if (!arguments_param) { + ZEPHIR_INIT_VAR(&arguments); + array_init(&arguments); + } else { + zephir_get_arrval(&arguments, arguments_param); + } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getattributes", NULL, 0); + + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "action"); - ZEPHIR_CALL_METHOD(&_1, &_0, "get", NULL, 0, &_2); + ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchobject", NULL, 0, &className, &arguments); zephir_check_call_status(); - zephir_cast_to_string(&_3, &_1); - RETURN_CTOR(&_3); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getAttributes) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchObjects) { - zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval values, arguments; + zval *statement_param = NULL, *values_param = NULL, *className_param = NULL, *arguments_param = NULL, sth, _0; + zval statement, className; zval *this_ptr = getThis(); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&arguments); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) + Z_PARAM_STR(className) + Z_PARAM_ARRAY(arguments) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(Z_TYPE_P(&_0) == IS_NULL)) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_html_attributes_ce); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 22); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &_1$$3); + zephir_fetch_params(1, 1, 3, &statement_param, &values_param, &className_param, &arguments_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); + } + if (!className_param) { + ZEPHIR_INIT_VAR(&className); + ZVAL_STRING(&className, "stdClass"); + } else { + zephir_get_strval(&className, className_param); + } + if (!arguments_param) { + ZEPHIR_INIT_VAR(&arguments); + array_init(&arguments); + } else { + zephir_get_arrval(&arguments, arguments_param); } - RETURN_MM_MEMBER(getThis(), "attributes"); -} - -static PHP_METHOD(Phalcon_Forms_Form, getElements) -{ - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "elements"); + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); + zephir_check_call_status(); + ZVAL_LONG(&_0, 8); + ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchall", NULL, 0, &_0, &className, &arguments); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getEntity) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchOne) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval values, _0; + zval *statement_param = NULL, *values_param = NULL, _1; + zval statement; zval *this_ptr = getThis(); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); + } - RETURN_MEMBER(getThis(), "entity"); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, 2); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "fetch"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getFilteredValue) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchPairs) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, filteredData, value, _0; - zval name; + zval values, _0; + zval *statement_param = NULL, *values_param = NULL, _1; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&filteredData); - ZVAL_UNDEF(&value); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&values); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_arrval(&values, values_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("filteredData"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&filteredData, &_0); - if (Z_TYPE_P(&filteredData) == IS_ARRAY) { - ZEPHIR_OBS_VAR(&value); - if (zephir_array_isset_fetch(&value, &filteredData, &name, 0)) { - RETURN_CCTOR(&value); - } - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getvalue", NULL, 0, &name); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, 12); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "fetchAll"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getLabel) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchValue) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, element, label, _0, _1$$3; - zval name, _2$$3; + zval values; + zval *statement_param = NULL, *values_param = NULL, sth, _0; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&label); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&values); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_arrval(&values, values_param); } - ZEPHIR_OBS_VAR(&element); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_forms_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 418); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&label, &element, "getlabel", NULL, 0); + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); zephir_check_call_status(); - if (!(zephir_is_true(&label))) { - RETURN_CTOR(&name); - } - RETURN_CCTOR(&label); + ZVAL_LONG(&_0, 0); + ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchcolumn", NULL, 0, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getMessages) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAdapter) { - zend_bool _1; - zval messages, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&messages); - ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&messages, &_0); - _1 = Z_TYPE_P(&messages) == IS_OBJECT; - if (_1) { - _1 = zephir_instance_of_ev(&messages, phalcon_messages_messages_ce); - } - if (!(_1)) { - object_init_ex(return_value, phalcon_messages_messages_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 8); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_CCTOR(&messages); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + RETURN_MM_MEMBER(getThis(), "pdo"); } -static PHP_METHOD(Phalcon_Forms_Form, getMessagesFor) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0, _1; - zval name; + zval *attribute_param = NULL, _0, _1; + zend_long attribute, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_LONG(attribute) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } + zephir_fetch_params(1, 1, 0, &attribute_param); + attribute = zephir_get_intval(attribute_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &name); - zephir_check_call_status(); - if (!(zephir_is_true(&_0))) { - object_init_ex(return_value, phalcon_messages_messages_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 8); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "get", NULL, 0, &name); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_1, "getmessages", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, attribute); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getattribute", NULL, 0, &_1); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getTagFactory) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAvailableDrivers) { + zend_class_entry *_0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "tagFactory"); + ZEPHIR_MM_GROW(); + + _0 = zephir_fetch_class_str_ex(SL("PDO"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_RETURN_CALL_CE_STATIC(_0, "getavailabledrivers", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getUserOption) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getDriverName) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *option_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, value, _0; - zval option; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(option) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &option_param, &defaultValue); - zephir_get_strval(&option, option_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } - - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&value, &_0, &option, 1))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - RETURN_CTOR(&value); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, 16); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getattribute", NULL, 0, &_1); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, getUserOptions) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getProfiler) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "options"); + RETURN_MEMBER(getThis(), "profiler"); } -static PHP_METHOD(Phalcon_Forms_Form, getValue) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getQuoteNames) { - zval forbidden; + zval quotes; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, __$true, entity, value, data, internalEntity, element, _0, _3, _4, _1$$4, _2$$4; - zval name, method; + zval *driver_param = NULL, option, _0$$5, _1$$6; + zval driver; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&method); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&entity); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&internalEntity); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&forbidden); + ZVAL_UNDEF(&driver); + ZVAL_UNDEF(&option); + ZVAL_UNDEF(&_0$$5); + ZVAL_UNDEF(&_1$$6); + ZVAL_UNDEF("es); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(driver) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 0, 1, &driver_param); + if (!driver_param) { + ZEPHIR_INIT_VAR(&driver); + ZVAL_STRING(&driver, ""); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_strval(&driver, driver_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("entity"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&entity, &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&data, &_0); - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("getcustomvalue")) == SUCCESS)) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getcustomvalue", NULL, 0, &name, &entity, &data); + ZEPHIR_CPY_WRT(&option, &driver); + if (ZEPHIR_IS_EMPTY(&option)) { + ZEPHIR_CALL_METHOD(&option, this_ptr, "getdrivername", NULL, 0); zephir_check_call_status(); - RETURN_MM(); } - if (Z_TYPE_P(&entity) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_1$$4); - zephir_camelize(&_1$$4, &name, NULL ); - ZEPHIR_INIT_VAR(&_2$$4); - ZEPHIR_CONCAT_SV(&_2$$4, "get", &_1$$4); - zephir_get_strval(&method, &_2$$4); - if ((zephir_method_exists(&entity, &method) == SUCCESS)) { - ZEPHIR_RETURN_CALL_METHOD_ZVAL(&entity, &method, NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&value); - if (zephir_fetch_property_zval(&value, &entity, &name, PH_SILENT_CC)) { - RETURN_CCTOR(&value); + do { + if (ZEPHIR_IS_STRING(&option, "mysql")) { + ZEPHIR_INIT_VAR("es); + zephir_create_array("es, 4, 0); + add_assoc_stringl_ex("es, SL("prefix"), SL("`")); + add_assoc_stringl_ex("es, SL("suffix"), SL("`")); + add_assoc_stringl_ex("es, SL("find"), SL("`")); + add_assoc_stringl_ex("es, SL("replace"), SL("``")); + break; } - } - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&value); - if (zephir_array_isset_fetch(&value, &data, &name, 0)) { - RETURN_CCTOR(&value); + if (ZEPHIR_IS_STRING(&option, "sqlsrv")) { + ZEPHIR_INIT_VAR(&_0$$5); + zephir_create_array(&_0$$5, 4, 0); + add_assoc_stringl_ex(&_0$$5, SL("prefix"), SL("[")); + add_assoc_stringl_ex(&_0$$5, SL("suffix"), SL("]")); + add_assoc_stringl_ex(&_0$$5, SL("find"), SL("]")); + add_assoc_stringl_ex(&_0$$5, SL("replace"), SL("][")); + ZEPHIR_CPY_WRT("es, &_0$$5); + break; } - } - ZEPHIR_INIT_VAR(&forbidden); - zephir_create_array(&forbidden, 14, 0); - zephir_array_update_string(&forbidden, SL("attributes"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("validation"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("action"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("useroption"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("useroptions"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("entity"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("elements"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("messages"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("messagesfor"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("label"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("value"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("di"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("tagFactory"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&forbidden, SL("eventsmanager"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(&internalEntity); - zephir_fast_strtolower(&internalEntity, &name); - if (zephir_array_isset(&forbidden, &internalEntity)) { - RETURN_MM_NULL(); - } - ZEPHIR_INIT_VAR(&_3); - zephir_camelize(&_3, &name, NULL ); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_SV(&_4, "get", &_3); - zephir_get_strval(&method, &_4); - if ((zephir_method_exists(this_ptr, &method) == SUCCESS)) { - ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &method, NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&element); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&element, &_0, &name, 0)) { - ZEPHIR_RETURN_CALL_METHOD(&element, "getdefault", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_MM_NULL(); -} - -static PHP_METHOD(Phalcon_Forms_Form, getValidation) -{ - zval *this_ptr = getThis(); - - + ZEPHIR_INIT_VAR(&_1$$6); + zephir_create_array(&_1$$6, 4, 0); + add_assoc_stringl_ex(&_1$$6, SL("prefix"), SL("\"")); + add_assoc_stringl_ex(&_1$$6, SL("suffix"), SL("\"")); + add_assoc_stringl_ex(&_1$$6, SL("find"), SL("\"")); + add_assoc_stringl_ex(&_1$$6, SL("replace"), SL("\"\"")); + ZEPHIR_CPY_WRT("es, &_1$$6); + break; + } while(0); - RETURN_MEMBER(getThis(), "validation"); + RETURN_CTOR("es); } -static PHP_METHOD(Phalcon_Forms_Form, getWhitelist) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, inTransaction) { + zval result, _0, _1, _2, _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "whitelist"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "inTransaction"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&result, &_2, "intransaction", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + zephir_check_call_status(); + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Forms_Form, has) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, isConnected) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _0; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); + ZEPHIR_OBS_VAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); + RETURN_MM_BOOL(zephir_get_boolval(&_0)); } -static PHP_METHOD(Phalcon_Forms_Form, hasMessagesFor) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, lastInsertId) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0, _1; - zval name; + zval *name_param = NULL, result, _0, _1, _2, _3; + zval name, _4; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { + zephir_fetch_params(1, 0, 1, &name_param); + if (!name_param) { ZEPHIR_INIT_VAR(&name); + } else { + zephir_get_strval(&name, name_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmessagesfor", NULL, 0, &name); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, &_0, "count", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "lastInsertId"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); zephir_check_call_status(); - RETURN_MM_BOOL(ZEPHIR_GT_LONG(&_1, 0)); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&result, &_2, "lastinsertid", NULL, 0, &name); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + zephir_check_call_status(); + zephir_cast_to_string(&_4, &result); + RETURN_CTOR(&_4); } -static PHP_METHOD(Phalcon_Forms_Form, isValid) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, perform) { - zend_object_iterator *_18$$20; - zend_bool validationStatus = 0, _3, _7; + zend_string *_5; + zend_ulong _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_13 = NULL, *_14 = NULL, *_21 = NULL; + zephir_fcall_cache_entry *_6 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval whitelist; - zval *data = NULL, data_sub, *entity = NULL, entity_sub, *whitelist_param = NULL, __$null, messages, element, validators, name, filters, validator, validation, elementMessage, _0, _4, _8, *_9, _10, _17, _1$$4, _2$$5, _5$$6, _6$$7, *_11$$10, _12$$10, *_15$$15, _16$$15, _19$$21, _20$$21; + zval values; + zval *statement_param = NULL, *values_param = NULL, name, sth, value, _0, _1, *_2, _3, _7; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&entity_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&messages); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&validators); + ZVAL_UNDEF(&statement); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&filters); - ZVAL_UNDEF(&validator); - ZVAL_UNDEF(&validation); - ZVAL_UNDEF(&elementMessage); + ZVAL_UNDEF(&sth); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_17); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_12$$10); - ZVAL_UNDEF(&_16$$15); - ZVAL_UNDEF(&_19$$21); - ZVAL_UNDEF(&_20$$21); - ZVAL_UNDEF(&whitelist); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&values); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 3) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(statement) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(data) - Z_PARAM_ZVAL_OR_NULL(entity) - Z_PARAM_ARRAY(whitelist) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &data, &entity, &whitelist_param); - if (!data) { - data = &data_sub; - ZEPHIR_CPY_WRT(data, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(data); - } - if (!entity) { - entity = &entity_sub; - ZEPHIR_CPY_WRT(entity, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(entity); - } - if (!whitelist_param) { - ZEPHIR_INIT_VAR(&whitelist); - array_init(&whitelist); + zephir_fetch_params(1, 1, 1, &statement_param, &values_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); } else { - zephir_get_arrval(&whitelist, whitelist_param); + zephir_get_arrval(&values, values_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_EMPTY(&_0)) { - RETURN_MM_BOOL(1); - } - if (ZEPHIR_IS_EMPTY(&whitelist)) { - zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("whitelist"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&whitelist, &_1$$4); - } - if (Z_TYPE_P(data) != IS_ARRAY) { - zephir_read_property(&_2$$5, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(data, &_2$$5); - } - _3 = Z_TYPE_P(entity) != IS_OBJECT; - if (_3) { - ZEPHIR_OBS_VAR(&_4); - zephir_read_property(&_4, this_ptr, ZEND_STRL("entity"), PH_NOISY_CC); - _3 = Z_TYPE_P(&_4) == IS_OBJECT; - } - if (_3) { - zephir_read_property(&_5$$6, this_ptr, ZEND_STRL("entity"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(entity, &_5$$6); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", NULL, 0, data, entity, &whitelist); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("beforevalidation")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(&_6$$7, this_ptr, "beforevalidation", NULL, 0, data, entity); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_6$$7)) { - RETURN_MM_BOOL(0); - } - } - validationStatus = 1; - ZEPHIR_CALL_METHOD(&validation, this_ptr, "getvalidation", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "perform"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); zephir_check_call_status(); - _7 = Z_TYPE_P(&validation) != IS_OBJECT; - if (!(_7)) { - _7 = !((zephir_instance_of_ev(&validation, phalcon_filter_validation_validationinterface_ce))); - } - if (_7) { - ZEPHIR_INIT_NVAR(&validation); - object_init_ex(&validation, phalcon_filter_validation_ce); - ZEPHIR_CALL_METHOD(NULL, &validation, "__construct", NULL, 319); - zephir_check_call_status(); - } - zephir_read_property(&_8, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_8, 0, "phalcon/Forms/Form.zep", 714); - if (Z_TYPE_P(&_8) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_8), _9) + ZEPHIR_CALL_METHOD(&sth, this_ptr, "prepare", NULL, 0, &statement); + zephir_check_call_status(); + zephir_is_iterable(&values, 0, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 579); + if (Z_TYPE_P(&values) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&values), _4, _5, _2) { - ZEPHIR_INIT_NVAR(&element); - ZVAL_COPY(&element, _9); - ZEPHIR_CALL_METHOD(&validators, &element, "getvalidators", NULL, 0); - zephir_check_call_status(); - if (zephir_fast_count_int(&validators) == 0) { - continue; - } - ZEPHIR_CALL_METHOD(&name, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&validators, 0, "phalcon/Forms/Form.zep", 701); - if (Z_TYPE_P(&validators) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&validators), _11$$10) - { - ZEPHIR_INIT_NVAR(&validator); - ZVAL_COPY(&validator, _11$$10); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 320, &name, &validator); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); + ZEPHIR_INIT_NVAR(&name); + if (_5 != NULL) { + ZVAL_STR_COPY(&name, _5); } else { - ZEPHIR_CALL_METHOD(NULL, &validators, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_12$$10, &validators, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_12$$10)) { - break; - } - ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 320, &name, &validator); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); - zephir_check_call_status(); - } + ZVAL_LONG(&name, _4); } - ZEPHIR_INIT_NVAR(&validator); - ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _2); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "performbind", &_6, 0, &sth, &name, &value); zephir_check_call_status(); - if (Z_TYPE_P(&filters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 321, &name, &filters); - zephir_check_call_status(); - } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &_8, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_10, &_8, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_3, &values, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_10)) { + if (!zend_is_true(&_3)) { break; } - ZEPHIR_CALL_METHOD(&element, &_8, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&name, &values, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&validators, &element, "getvalidators", NULL, 0); - zephir_check_call_status(); - if (zephir_fast_count_int(&validators) == 0) { - continue; - } - ZEPHIR_CALL_METHOD(&name, &element, "getname", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&validators, 0, "phalcon/Forms/Form.zep", 701); - if (Z_TYPE_P(&validators) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&validators), _15$$15) - { - ZEPHIR_INIT_NVAR(&validator); - ZVAL_COPY(&validator, _15$$15); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 320, &name, &validator); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &validators, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_16$$15, &validators, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_16$$15)) { - break; - } - ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_13, 320, &name, &validator); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&validator); - ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "performbind", &_6, 0, &sth, &name, &value); zephir_check_call_status(); - if (Z_TYPE_P(&filters) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_14, 321, &name, &filters); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &_8, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&element); - ZEPHIR_CALL_METHOD(&messages, &validation, "validate", NULL, 322, data, entity); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&name); + ZEPHIR_CALL_METHOD(NULL, &sth, "execute", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_17, &messages, "count", NULL, 0); + zephir_read_property(&_7, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_7, "finish", NULL, 0, &statement, &values); zephir_check_call_status(); - if (zephir_is_true(&_17)) { - _18$$20 = zephir_get_iterator(&messages); - _18$$20->funcs->rewind(_18$$20); - for (;_18$$20->funcs->valid(_18$$20) == SUCCESS && !EG(exception); _18$$20->funcs->move_forward(_18$$20)) { - { - ZEPHIR_ITERATOR_COPY(&elementMessage, _18$$20); - } - ZEPHIR_CALL_METHOD(&_20$$21, &elementMessage, "getfield", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_19$$21, this_ptr, "get", &_21, 0, &_20$$21); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_19$$21, "appendmessage", NULL, 0, &elementMessage); - zephir_check_call_status(); - } - zend_iterator_dtor(_18$$20); - ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); - zephir_check_call_status(); - validationStatus = 0; - } - if (!(validationStatus)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("messages"), &messages); - } - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("aftervalidation")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "aftervalidation", NULL, 0, &messages); - zephir_check_call_status(); - } - RETURN_MM_BOOL(validationStatus); -} - -static PHP_METHOD(Phalcon_Forms_Form, key) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "position"); + RETURN_CCTOR(&sth); } -static PHP_METHOD(Phalcon_Forms_Form, label) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, prepare) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval attributes; - zval *name_param = NULL, *attributes_param = NULL, element, _0, _1$$3; - zval name, _2$$3; + zval options; + zval *statement_param = NULL, *options_param = NULL, sth, _0, _1, _2, _3, _4; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&element); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) + Z_PARAM_STR(statement) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &attributes_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); + zephir_fetch_params(1, 1, 1, &statement_param, &options_param); + zephir_get_strval(&statement, statement_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - zephir_get_arrval(&attributes, attributes_param); + zephir_get_arrval(&options, options_param); } - ZEPHIR_OBS_VAR(&element); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_forms_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 764); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_METHOD(&element, "label", NULL, 0, &attributes); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Forms_Form, next) -{ - zval *this_ptr = getThis(); - - - - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "prepare"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&sth, &_2, "prepare", NULL, 0, &statement, &options); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_4, &sth, ZEND_STRL("queryString"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0, &_4); + zephir_check_call_status(); + RETURN_CCTOR(&sth); } -static PHP_METHOD(Phalcon_Forms_Form, render) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, query) { + zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval attributes; - zval *name_param = NULL, *attributes_param = NULL, element, _0, _1$$3; - zval name, _2$$3; + zval *statement_param = NULL, sth, _0, _1, _3, _4, _5; + zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&element); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(statement) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &attributes_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); - } else { - zephir_get_arrval(&attributes, attributes_param); - } + zephir_fetch_params(1, 1, 0, &statement_param); + zephir_get_strval(&statement, statement_param); - ZEPHIR_OBS_VAR(&element); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_forms_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 788); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_METHOD(&element, "render", NULL, 0, &attributes); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "query"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 2, 0); + ZEPHIR_OBS_VAR(&_3); + zephir_read_property(&_3, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); + zephir_array_fast_append(&_2, &_3); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "query"); + zephir_array_fast_append(&_2, &_1); + ZEPHIR_INIT_NVAR(&_1); + zephir_get_args(&_1); + ZEPHIR_INIT_VAR(&sth); + ZEPHIR_CALL_USER_FUNC_ARRAY(&sth, &_2, &_1); + zephir_check_call_status(); + zephir_read_property(&_4, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_5, &sth, ZEND_STRL("queryString"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_4, "finish", NULL, 0, &_5); + zephir_check_call_status(); + RETURN_CCTOR(&sth); } -static PHP_METHOD(Phalcon_Forms_Form, remove) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, quote) { + zval _0$$3, _7$$4, _11$$5; + zend_string *_6; + zend_ulong _5; + zval elements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, __$null, _0, _1$$3; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *value, value_sub, *type_param = NULL, element, key, quotes, *_3, _4, _1$$3, _2$$3, _8$$4, _9$$4, _10$$4, _12$$5, _13$$5, _14$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&key); + ZVAL_UNDEF("es); + ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_12$$5); + ZVAL_UNDEF(&_13$$5); + ZVAL_UNDEF(&_14$$5); + ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_11$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 1, &value, &type_param); + if (!type_param) { + type = 2; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_0, &name)) { - zephir_unset_property_array(this_ptr, ZEND_STRL("elements"), &name); - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_1$$3, &name, PH_SEPARATE); - RETURN_MM_BOOL(1); + ZEPHIR_INIT_VAR(&elements); + array_init(&elements); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&element, value); + ZEPHIR_CALL_METHOD("es, this_ptr, "getquotenames", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&element) != IS_ARRAY) { + zephir_cast_to_string(&_0$$3, &element); + ZEPHIR_CPY_WRT(&element, &_0$$3); + zephir_array_fetch_string(&_1$$3, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 664); + zephir_array_fetch_string(&_2$$3, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 664); + ZEPHIR_CONCAT_VVV(return_value, &_1$$3, &element, &_2$$3); + RETURN_MM(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("elementsIndexed"), &__$null); - RETURN_MM_BOOL(0); + zephir_is_iterable(value, 0, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 673); + if (Z_TYPE_P(value) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(value), _5, _6, _3) + { + ZEPHIR_INIT_NVAR(&key); + if (_6 != NULL) { + ZVAL_STR_COPY(&key, _6); + } else { + ZVAL_LONG(&key, _5); + } + ZEPHIR_INIT_NVAR(&element); + ZVAL_COPY(&element, _3); + zephir_cast_to_string(&_7$$4, &element); + ZEPHIR_CPY_WRT(&element, &_7$$4); + zephir_array_fetch_string(&_8$$4, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); + zephir_array_fetch_string(&_9$$4, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); + ZEPHIR_INIT_NVAR(&_10$$4); + ZEPHIR_CONCAT_VVV(&_10$$4, &_8$$4, &element, &_9$$4); + zephir_array_update_zval(&elements, &key, &_10$$4, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_4, value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4)) { + break; + } + ZEPHIR_CALL_METHOD(&key, value, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&element, value, "current", NULL, 0); + zephir_check_call_status(); + zephir_cast_to_string(&_11$$5, &element); + ZEPHIR_CPY_WRT(&element, &_11$$5); + zephir_array_fetch_string(&_12$$5, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); + zephir_array_fetch_string(&_13$$5, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); + ZEPHIR_INIT_NVAR(&_14$$5); + ZEPHIR_CONCAT_VVV(&_14$$5, &_12$$5, &element, &_13$$5); + zephir_array_update_zval(&elements, &key, &_14$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&element); + ZEPHIR_INIT_NVAR(&key); + zephir_fast_join_str(return_value, SL(", "), &elements); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, rewind) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, rollBack) { - zval _0, _1; + zval result, _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); ZEPHIR_MM_GROW(); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, 0); - zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_1, "array_values", NULL, 14, &_0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("elementsIndexed"), &_1); - ZEPHIR_MM_RESTORE(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "rollBack"); + ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&result, &_2, "rollback", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + zephir_check_call_status(); + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Forms_Form, setAction) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, setAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *action_param = NULL, _0, _1; - zval action; + zval *attribute_param = NULL, *value, value_sub, _0, _1; + zend_long attribute, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&action); + ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(action) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_LONG(attribute) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &action_param); - if (UNEXPECTED(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(action_param) == IS_STRING)) { - zephir_get_strval(&action, action_param); - } else { - ZEPHIR_INIT_VAR(&action); - } + zephir_fetch_params(1, 2, 0, &attribute_param, &value); + attribute = zephir_get_intval(attribute_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getattributes", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "action"); - ZEPHIR_CALL_METHOD(NULL, &_0, "set", NULL, 0, &_1, &action); + zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, attribute); + ZEPHIR_RETURN_CALL_METHOD(&_0, "setattribute", NULL, 0, &_1, value); zephir_check_call_status(); - RETURN_THIS(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Form, setAttributes) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, setProfiler) { - zval *attributes, attributes_sub; + zval *profiler, profiler_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes_sub); + ZVAL_UNDEF(&profiler_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(attributes, phalcon_html_attributes_ce) + Z_PARAM_OBJECT_OF_CLASS(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &attributes); + zephir_fetch_params_without_memory_grow(1, 0, &profiler); - zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), attributes); - RETURN_THISW(); + zephir_update_property_zval(this_ptr, ZEND_STRL("profiler"), profiler); } -static PHP_METHOD(Phalcon_Forms_Form, setEntity) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, performBind) { - zval *entity, entity_sub; + zend_bool _1$$4; + zval _8, _5$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, _0$$3; + zval *statement, statement_sub, *name, name_sub, *arguments, arguments_sub, key, parameters, type, _7, _9, _2$$4, _3$$7, _4$$7, _6$$8; zval *this_ptr = getThis(); - ZVAL_UNDEF(&entity_sub); + ZVAL_UNDEF(&statement_sub); + ZVAL_UNDEF(&name_sub); + ZVAL_UNDEF(&arguments_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(¶meters); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_6$$8); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_5$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(entity) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_OBJECT_OF_CLASS(statement, zephir_get_internal_ce(SL("pdostatement"))) + Z_PARAM_ZVAL(name) + Z_PARAM_ZVAL(arguments) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &entity); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &statement, &name, &arguments); + ZEPHIR_SEPARATE_PARAM(arguments); - zephir_update_property_zval(this_ptr, ZEND_STRL("entity"), entity); - RETURN_THISW(); + ZEPHIR_CPY_WRT(&key, name); + if (Z_TYPE_P(&key) == IS_LONG) { + _0$$3 = (zephir_get_numberval(&key) + 1); + ZEPHIR_INIT_NVAR(&key); + ZVAL_LONG(&key, _0$$3); + } + if (Z_TYPE_P(arguments) == IS_ARRAY) { + if (zephir_array_isset_long(arguments, 1)) { + ZEPHIR_OBS_VAR(&type); + zephir_array_fetch_long(&type, arguments, 1, PH_NOISY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 743); + } else { + ZEPHIR_INIT_NVAR(&type); + ZVAL_LONG(&type, 2); + } + _1$$4 = ZEPHIR_IS_LONG_IDENTICAL(&type, 5); + if (_1$$4) { + ZEPHIR_OBS_VAR(&_2$$4); + zephir_array_fetch_long(&_2$$4, arguments, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 748); + _1$$4 = ((Z_TYPE_P(&_2$$4) == IS_TRUE || Z_TYPE_P(&_2$$4) == IS_FALSE) == 1); + } + if (_1$$4) { + ZEPHIR_INIT_VAR(&_3$$7); + zephir_array_fetch_long(&_4$$7, arguments, 0, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 749); + if (zephir_is_true(&_4$$7)) { + ZEPHIR_INIT_NVAR(&_3$$7); + ZVAL_STRING(&_3$$7, "1"); + } else { + ZEPHIR_INIT_NVAR(&_3$$7); + ZVAL_STRING(&_3$$7, "0"); + } + zephir_array_update_long(arguments, 0, &_3$$7, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + } + ZEPHIR_INIT_VAR(&_5$$4); + zephir_create_array(&_5$$4, 1, 0); + zephir_array_fast_append(&_5$$4, &key); + ZEPHIR_INIT_VAR(¶meters); + zephir_fast_array_merge(¶meters, &_5$$4, arguments); + } else { + ZEPHIR_INIT_VAR(&_6$$8); + zephir_create_array(&_6$$8, 2, 0); + zephir_array_fast_append(&_6$$8, &key); + zephir_array_fast_append(&_6$$8, arguments); + ZEPHIR_CPY_WRT(¶meters, &_6$$8); + } + ZEPHIR_INIT_VAR(&_7); + ZEPHIR_INIT_VAR(&_8); + zephir_create_array(&_8, 2, 0); + zephir_array_fast_append(&_8, statement); + ZEPHIR_INIT_VAR(&_9); + ZVAL_STRING(&_9, "bindValue"); + zephir_array_fast_append(&_8, &_9); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_7, &_8, ¶meters); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Form, setTagFactory) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchData) { - zval *tagFactory, tagFactory_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval arguments, values, _0; + zval *method_param = NULL, *arguments_param = NULL, *statement_param = NULL, *values_param = NULL, result, sth; + zval method, statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tagFactory_sub); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&sth); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(tagFactory, phalcon_html_tagfactory_ce) + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_STR(method) + Z_PARAM_ARRAY(arguments) + Z_PARAM_STR(statement) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &tagFactory); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 1, &method_param, &arguments_param, &statement_param, &values_param); + zephir_get_strval(&method, method_param); + zephir_get_arrval(&arguments, arguments_param); + zephir_get_strval(&statement, statement_param); + if (!values_param) { + ZEPHIR_INIT_VAR(&values); + array_init(&values); + } else { + zephir_get_arrval(&values, values_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("tagFactory"), tagFactory); - RETURN_THISW(); + ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + zephir_array_fast_append(&_0, &sth); + zephir_array_fast_append(&_0, &method); + ZEPHIR_INIT_VAR(&result); + ZEPHIR_CALL_USER_FUNC_ARRAY(&result, &_0, &arguments); + zephir_check_call_status(); + if (Z_TYPE_P(&result) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(&result); + array_init(&result); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Forms_Form, setValidation) -{ - zval *validation, validation_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&validation_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(validation, phalcon_filter_validation_validationinterface_ce) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - zephir_fetch_params_without_memory_grow(1, 0, &validation); - zephir_update_property_zval(this_ptr, ZEND_STRL("validation"), validation); - RETURN_THISW(); -} -static PHP_METHOD(Phalcon_Forms_Form, setWhitelist) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *whitelist_param = NULL; - zval whitelist; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Connection, ConnectionInterface, phalcon, datamapper_pdo_connection_connectioninterface, phalcon_datamapper_pdo_connection_connectioninterface_method_entry); - ZVAL_UNDEF(&whitelist); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(whitelist) - ZEND_PARSE_PARAMETERS_END(); -#endif + zend_class_implements(phalcon_datamapper_pdo_connection_connectioninterface_ce, 1, phalcon_datamapper_pdo_connection_pdointerface_ce); + return SUCCESS; +} +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, connect); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, disconnect); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAffected); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAll); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAssoc); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchColumn); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchGroup); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchObject); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchObjects); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchOne); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchPairs); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchValue); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, getAdapter); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, getProfiler); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, isConnected); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, perform); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, setProfiler); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &whitelist_param); - zephir_get_arrval(&whitelist, whitelist_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("whitelist"), &whitelist); - RETURN_THIS(); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Forms_Form, setUserOption) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *option_param = NULL, *value, value_sub; - zval option; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(option) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &option_param, &value); - zephir_get_strval(&option, option_param); +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_Decorated) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Connection, Decorated, phalcon, datamapper_pdo_connection_decorated, phalcon_datamapper_pdo_connection_abstractconnection_ce, phalcon_datamapper_pdo_connection_decorated_method_entry, 0); - zephir_update_property_array(this_ptr, SL("options"), &option, value); - RETURN_THIS(); + return SUCCESS; } -static PHP_METHOD(Phalcon_Forms_Form, setUserOptions) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL; - zval options; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *pdo, pdo_sub, *profiler = NULL, profiler_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&pdo_sub); + ZVAL_UNDEF(&profiler_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_OBJECT_OF_CLASS(pdo, php_pdo_get_dbh_ce()) + Z_PARAM_OPTIONAL + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + zephir_fetch_params(1, 1, 1, &pdo, &profiler); + if (!profiler) { + profiler = &profiler_sub; + ZEPHIR_CPY_WRT(profiler, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(profiler); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), pdo); + if (Z_TYPE_P(profiler) == IS_NULL) { + ZEPHIR_INIT_NVAR(profiler); + object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); + ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 200); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Form, valid) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, connect) { - zval _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("elementsIndexed"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_array_isset(&_0, &_1)); } -zend_object *zephir_init_properties_Phalcon_Forms_Form(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, disconnect) { - zval _0, _2, _4, _6, _8, _10, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_11$$8); - + zval *this_ptr = getThis(); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("whitelist"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("whitelist"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_3$$4); - } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("elementsIndexed"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_4) == IS_NULL) { - ZEPHIR_INIT_VAR(&_5$$5); - array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("elementsIndexed"), &_5$$5); - } - zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("elements"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_6) == IS_NULL) { - ZEPHIR_INIT_VAR(&_7$$6); - array_init(&_7$$6); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("elements"), &_7$$6); - } - zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("filteredData"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_8) == IS_NULL) { - ZEPHIR_INIT_VAR(&_9$$7); - array_init(&_9$$7); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("filteredData"), &_9$$7); - } - zephir_read_property_ex(&_10, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_10) == IS_NULL) { - ZEPHIR_INIT_VAR(&_11$$8); - array_init(&_11$$8); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("data"), &_11$$8); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + + + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_datamapper_pdo_exception_cannotdisconnect_ce, "Cannot disconnect a Decorated connection instance", "phalcon/DataMapper/Pdo/Connection/Decorated.zep", 66); + return; } @@ -29210,1175 +28246,1362 @@ zend_object *zephir_init_properties_Phalcon_Forms_Form(zend_class_entry *class_t -ZEPHIR_INIT_CLASS(Phalcon_Forms_Manager) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_PdoInterface) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Forms, Manager, phalcon, forms_manager, phalcon_forms_manager_method_entry, 0); - - zend_declare_property_null(phalcon_forms_manager_ce, SL("forms"), ZEND_ACC_PROTECTED); - phalcon_forms_manager_ce->create_object = zephir_init_properties_Phalcon_Forms_Manager; + ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Connection, PdoInterface, phalcon, datamapper_pdo_connection_pdointerface, phalcon_datamapper_pdo_connection_pdointerface_method_entry); return SUCCESS; } -static PHP_METHOD(Phalcon_Forms_Manager, create) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *entity = NULL, entity_sub, __$null, form; - zval name; - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, beginTransaction); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, commit); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorCode); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorInfo); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, exec); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, getAttribute); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, getAvailableDrivers); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, inTransaction); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, lastInsertId); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, prepare); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, query); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, quote); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, rollBack); +ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, setAttribute); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&entity_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&form); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(entity) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &entity); - zephir_get_strval(&name, name_param); - if (!entity) { - entity = &entity_sub; - entity = &__$null; - } - ZEPHIR_INIT_VAR(&form); - object_init_ex(&form, phalcon_forms_form_ce); - ZEPHIR_CALL_METHOD(NULL, &form, "__construct", NULL, 323, entity); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("forms"), &name, &form); - RETURN_CCTOR(&form); + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_AbstractConditions) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, AbstractConditions, phalcon, datamapper_query_abstractconditions, phalcon_datamapper_query_abstractquery_ce, phalcon_datamapper_query_abstractconditions_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Forms_Manager, get) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, limit) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, form, _0, _1$$3; - zval name, _2$$3; + zval *limit_param = NULL, _0, _1; + zend_long limit; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&form); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_LONG(limit) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 0, &limit_param); + limit = zephir_get_intval(limit_param); - ZEPHIR_OBS_VAR(&form); - zephir_read_property(&_0, this_ptr, ZEND_STRL("forms"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&form, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_forms_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "There is no form with name='", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Manager.zep", 46); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_CCTOR(&form); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "LIMIT"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, limit); + zephir_update_property_array(this_ptr, SL("store"), &_0, &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Manager, has) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, offset) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _0; - zval name; + zval *offset_param = NULL, _0, _1; + zend_long offset; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 0, &offset_param); + offset = zephir_get_intval(offset_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("forms"), PH_NOISY_CC | PH_READONLY); - RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "OFFSET"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_LONG(&_1, offset); + zephir_update_property_array(this_ptr, SL("store"), &_0, &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Manager, set) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, andWhere) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *form, form_sub; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&form_sub); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_OBJECT_OF_CLASS(form, phalcon_forms_form_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &form); - zephir_get_strval(&name, name_param); - - - zephir_update_property_array(this_ptr, SL("forms"), &name, form); - RETURN_THIS(); -} - -zend_object *zephir_init_properties_Phalcon_Forms_Manager(zend_class_entry *class_type) -{ - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("forms"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("forms"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); } -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_AbstractElement) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Forms\\Element, AbstractElement, phalcon, forms_element_abstractelement, phalcon_forms_element_abstractelement_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("attributes"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("filters"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("form"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("label"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_forms_element_abstractelement_ce, SL("method"), "inputText", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("messages"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("name"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("options"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("tagFactory"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("validators"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("value"), ZEND_ACC_PROTECTED); - phalcon_forms_element_abstractelement_ce->create_object = zephir_init_properties_Phalcon_Forms_Element_AbstractElement; - zend_class_implements(phalcon_forms_element_abstractelement_ce, 1, phalcon_forms_element_elementinterface_ce); - return SUCCESS; + ZVAL_LONG(&_0, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", NULL, 0, &condition, value, &_0); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, __construct) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, appendWhere) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval attributes; - zval *name_param = NULL, *attributes_param = NULL, _0, _1; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&attributes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &attributes_param); - zephir_get_strval(&name, name_param); - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; } else { - zephir_get_arrval(&attributes, attributes_param); + type = zephir_get_intval(type_param); } ZEPHIR_INIT_VAR(&_0); - zephir_fast_trim(&_0, &name, NULL , ZEPHIR_TRIM_BOTH); - zephir_get_strval(&name, &_0); - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&name))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Form element name is required", "phalcon/Forms/Element/AbstractElement.zep", 97); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &attributes); - ZEPHIR_INIT_VAR(&_1); - object_init_ex(&_1, phalcon_messages_messages_ce); - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 8); + ZVAL_STRING(&_0, "WHERE"); + ZVAL_LONG(&_1, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendcondition", NULL, 0, &_0, &condition, value, &_1); zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("messages"), &_1); - ZEPHIR_MM_RESTORE(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, __toString) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, orderBy) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *orderBy, orderBy_sub, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&orderBy_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(orderBy) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &orderBy); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "render", NULL, 0); + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "ORDER"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processvalue", NULL, 0, &_0, orderBy); zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addFilter) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, orWhere) { - zval _1$$5, _2$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *filter_param = NULL, filters, _0; - zval filter; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filter); - ZVAL_UNDEF(&filters); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_2$$6); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filter) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filter_param); - zephir_get_strval(&filter, filter_param); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("filters"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&filters, &_0); - if (Z_TYPE_P(&filters) == IS_ARRAY) { - zephir_update_property_array_append(this_ptr, SL("filters"), &filter); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; } else { - if (Z_TYPE_P(&filters) == IS_STRING) { - ZEPHIR_INIT_VAR(&_1$$5); - zephir_create_array(&_1$$5, 2, 0); - zephir_array_fast_append(&_1$$5, &filters); - zephir_array_fast_append(&_1$$5, &filter); - zephir_update_property_zval(this_ptr, ZEND_STRL("filters"), &_1$$5); - } else { - ZEPHIR_INIT_VAR(&_2$$6); - zephir_create_array(&_2$$6, 1, 0); - zephir_array_fast_append(&_2$$6, &filter); - zephir_update_property_zval(this_ptr, ZEND_STRL("filters"), &_2$$6); - } + type = zephir_get_intval(type_param); } + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "WHERE"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "OR "); + ZVAL_LONG(&_2, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); + zephir_check_call_status(); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addValidator) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, where) { - zval *validator, validator_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&validator_sub); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(validator, phalcon_filter_validation_validatorinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &validator); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } - zephir_update_property_array_append(this_ptr, SL("validators"), validator); - RETURN_THISW(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "WHERE"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "AND "); + ZVAL_LONG(&_2, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addValidators) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, whereEquals) { + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; + zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool merge; - zval *validators_param = NULL, *merge_param = NULL, validator, *_1, _2, _0$$3; - zval validators; + zval *columnsValues_param = NULL, key, value, *_0, _1, _5$$5, _6$$6, _7$$7, _8$$10, _9$$11, _10$$12; + zval columnsValues; zval *this_ptr = getThis(); - ZVAL_UNDEF(&validators); - ZVAL_UNDEF(&validator); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&columnsValues); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$10); + ZVAL_UNDEF(&_9$$11); + ZVAL_UNDEF(&_10$$12); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ARRAY(validators) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(merge) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columnsValues) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &validators_param, &merge_param); - ZEPHIR_OBS_COPY_OR_DUP(&validators, validators_param); - if (!merge_param) { - merge = 1; - } else { - merge = zephir_get_boolval(merge_param); - } + zephir_fetch_params(1, 1, 0, &columnsValues_param); + zephir_get_arrval(&columnsValues, columnsValues_param); - if (UNEXPECTED(!merge)) { - ZEPHIR_INIT_VAR(&_0$$3); - array_init(&_0$$3); - zephir_update_property_zval(this_ptr, ZEND_STRL("validators"), &_0$$3); - } - zephir_is_iterable(&validators, 0, "phalcon/Forms/Element/AbstractElement.zep", 163); - if (Z_TYPE_P(&validators) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&validators), _1) + zephir_is_iterable(&columnsValues, 0, "phalcon/DataMapper/Query/AbstractConditions.zep", 162); + if (Z_TYPE_P(&columnsValues) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columnsValues), _2, _3, _0) { - ZEPHIR_INIT_NVAR(&validator); - ZVAL_COPY(&validator, _1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addvalidator", &_3, 0, &validator); - zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + if (zephir_is_numeric(&key)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &value); + zephir_check_call_status(); + } else if (Z_TYPE_P(&value) == IS_NULL) { + ZEPHIR_INIT_NVAR(&_5$$5); + ZEPHIR_CONCAT_VS(&_5$$5, &key, " IS NULL"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_5$$5); + zephir_check_call_status(); + } else if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_6$$6); + ZEPHIR_CONCAT_VS(&_6$$6, &key, " IN "); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_6$$6, &value); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&_7$$7); + ZEPHIR_CONCAT_VS(&_7$$7, &key, " = "); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_7$$7, &value); + zephir_check_call_status(); + } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &validators, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &columnsValues, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_2, &validators, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1, &columnsValues, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_2)) { + if (!zend_is_true(&_1)) { break; } - ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&key, &columnsValues, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addvalidator", &_3, 0, &validator); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); + ZEPHIR_CALL_METHOD(&value, &columnsValues, "current", NULL, 0); + zephir_check_call_status(); + if (zephir_is_numeric(&key)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &value); + zephir_check_call_status(); + } else if (Z_TYPE_P(&value) == IS_NULL) { + ZEPHIR_INIT_NVAR(&_8$$10); + ZEPHIR_CONCAT_VS(&_8$$10, &key, " IS NULL"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_8$$10); + zephir_check_call_status(); + } else if (Z_TYPE_P(&value) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_9$$11); + ZEPHIR_CONCAT_VS(&_9$$11, &key, " IN "); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_9$$11, &value); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&_10$$12); + ZEPHIR_CONCAT_VS(&_10$$12, &key, " = "); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_10$$12, &value); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &columnsValues, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&validator); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, appendMessage) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, addCondition) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message, message_sub, _0; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *store_param = NULL, *andor_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0$$3, _1$$3, _2, _3; + zval store, andor, condition, _4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&store); + ZVAL_UNDEF(&andor); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(message, phalcon_messages_messageinterface_ce) + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_STR(store) + Z_PARAM_STR(andor) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message); + zephir_fetch_params(1, 3, 2, &store_param, &andor_param, &condition_param, &value, &type_param); + zephir_get_strval(&store, store_param); + zephir_get_strval(&andor, andor_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_0, "appendmessage", NULL, 0, message); - zephir_check_call_status(); - RETURN_THIS(); + if (!(ZEPHIR_IS_EMPTY(value))) { + ZVAL_LONG(&_1$$3, type); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "bindinline", NULL, 0, value, &_1$$3); + zephir_check_call_status(); + zephir_concat_self(&condition, &_0$$3); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_3, &_2, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 185); + if (ZEPHIR_IS_EMPTY(&_3)) { + ZEPHIR_INIT_NVAR(&andor); + } + ZEPHIR_INIT_VAR(&_4); + ZEPHIR_CONCAT_VV(&_4, &andor, &condition); + zephir_update_property_array_multi(this_ptr, SL("store"), &_4, SL("za"), 2, &store); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, clear) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildBy) { - zval form, _0, name; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *type_param = NULL, _0, _1, _2, _3, _4, _5; + zval type; zval *this_ptr = getThis(); - ZVAL_UNDEF(&form); + ZVAL_UNDEF(&type); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(type) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &type_param); + zephir_get_strval(&type, type_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("form"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&form, &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&name, &_0); - if (Z_TYPE_P(&form) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(NULL, &form, "clear", NULL, 0, &name); - zephir_check_call_status(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1, &_0, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 201); + if (ZEPHIR_IS_EMPTY(&_1)) { + RETURN_MM_STRING(""); } - RETURN_THIS(); + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_4, &_3, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 206); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, ","); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4, &_5); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSV(return_value, " ", &type, " BY", &_2); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getAttribute) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildCondition) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *attribute_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, attributes, value, _0; - zval attribute; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *type_param = NULL, _0, _1, _2, _3, _4; + zval type; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attribute); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&attributes); - ZVAL_UNDEF(&value); + ZVAL_UNDEF(&type); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(attribute) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &attribute_param, &defaultValue); - zephir_get_strval(&attribute, attribute_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } + zephir_fetch_params(1, 1, 0, &type_param); + zephir_get_strval(&type, type_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&attributes, &_0); - if (!(zephir_array_isset_fetch(&value, &attributes, &attribute, 1))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_1, &_0, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 218); + if (ZEPHIR_IS_EMPTY(&_1)) { + RETURN_MM_STRING(""); } - RETURN_CTOR(&value); + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_4, &_3, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 223); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVV(return_value, " ", &type, &_2); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getAttributes) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitEarly) { - zval attributes, _0; + zend_bool _3, _6; + zval _0, _1, _2, _4, _5, _7, _8, _9$$3, _10$$3, _11$$3; + zval limit; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&limit); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9$$3); + ZVAL_UNDEF(&_10$$3); + ZVAL_UNDEF(&_11$$3); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&attributes, &_0); - RETURN_CCTOR(&attributes); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getDefault) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "value"); + ZEPHIR_INIT_VAR(&limit); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_1, &_0, "getdrivername", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "sqlsrv"); + _3 = ZEPHIR_IS_IDENTICAL(&_2, &_1); + if (_3) { + zephir_read_property(&_4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_5, &_4, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 237); + _3 = ZEPHIR_GT_LONG(&_5, 0); + } + _6 = _3; + if (_6) { + zephir_read_property(&_7, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_8, &_7, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 239); + _6 = ZEPHIR_IS_LONG_IDENTICAL(&_8, 0); + } + if (_6) { + zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_10$$3, &_9$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 240); + ZEPHIR_INIT_VAR(&_11$$3); + ZEPHIR_CONCAT_SV(&_11$$3, " TOP ", &_10$$3); + zephir_get_strval(&limit, &_11$$3); + } + RETURN_CTOR(&limit); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getFilters) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimit) { + zval method, suffix, _0, _1, _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&suffix); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); - RETURN_MEMBER(getThis(), "filters"); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getForm) -{ - zval *this_ptr = getThis(); - - + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "form"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&suffix, &_0, "getdrivername", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "sqlsrv"); + if (!ZEPHIR_IS_IDENTICAL(&_1, &suffix)) { + ZEPHIR_INIT_NVAR(&suffix); + ZVAL_STRING(&suffix, "common"); + } + ZEPHIR_INIT_VAR(&_2); + zephir_ucfirst(&_2, &suffix); + ZEPHIR_INIT_VAR(&method); + ZEPHIR_CONCAT_SV(&method, "buildLimit", &_2); + ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &method, NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getLabel) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitCommon) { + zval _0, _1, _5, _6, _10, _2$$3, _3$$3, _4$$3, _7$$4, _8$$4, _9$$4, _11$$5, _12$$5; + zval limit; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&limit); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_11$$5); + ZVAL_UNDEF(&_12$$5); - RETURN_MEMBER(getThis(), "label"); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getMessages) -{ - zval *this_ptr = getThis(); - - + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "messages"); + ZEPHIR_INIT_VAR(&limit); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 275); + if (!ZEPHIR_IS_LONG_IDENTICAL(&_1, 0)) { + zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_3$$3, &_2$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 276); + ZEPHIR_INIT_VAR(&_4$$3); + ZEPHIR_CONCAT_SV(&_4$$3, "LIMIT ", &_3$$3); + zephir_concat_self(&limit, &_4$$3); + } + zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_6, &_5, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 279); + if (!ZEPHIR_IS_LONG_IDENTICAL(&_6, 0)) { + zephir_read_property(&_7$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_8$$4, &_7$$4, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 280); + ZEPHIR_INIT_VAR(&_9$$4); + ZEPHIR_CONCAT_SV(&_9$$4, " OFFSET ", &_8$$4); + zephir_concat_self(&limit, &_9$$4); + } + ZEPHIR_INIT_VAR(&_10); + ZVAL_STRING(&_10, ""); + if (!ZEPHIR_IS_IDENTICAL(&_10, &limit)) { + ZEPHIR_INIT_VAR(&_11$$5); + zephir_fast_trim(&_11$$5, &limit, NULL , ZEPHIR_TRIM_LEFT); + ZEPHIR_INIT_VAR(&_12$$5); + ZEPHIR_CONCAT_SV(&_12$$5, " ", &_11$$5); + zephir_get_strval(&limit, &_12$$5); + } + RETURN_CTOR(&limit); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getName) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitSqlsrv) { + zend_bool _2; + zval _0, _1, _3, _4, _5$$3, _6$$3, _7$$3, _8$$3, _9$$3; + zval limit; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&limit); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$3); + ZVAL_UNDEF(&_9$$3); - RETURN_MEMBER(getThis(), "name"); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getTagFactory) -{ - zval *this_ptr = getThis(); - - + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "tagFactory"); + ZEPHIR_INIT_VAR(&limit); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 299); + _2 = ZEPHIR_GT_LONG(&_1, 0); + if (_2) { + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_4, &_3, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 299); + _2 = ZEPHIR_GT_LONG(&_4, 0); + } + if (_2) { + zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_6$$3, &_5$$3, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 300); + zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_8$$3, &_7$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 301); + ZEPHIR_INIT_VAR(&_9$$3); + ZEPHIR_CONCAT_SVSSVS(&_9$$3, " OFFSET ", &_6$$3, " ROWS", " FETCH NEXT ", &_8$$3, " ROWS ONLY"); + zephir_get_strval(&limit, &_9$$3); + } + RETURN_CTOR(&limit); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getUserOption) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, appendCondition) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *option_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, value, _0; - zval option; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *store_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, key, _2, _3, _5, _6, _7, _8, _9, _10, _0$$3, _1$$3, _4$$4; + zval store, condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&defaultValue_sub); + ZVAL_UNDEF(&store); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_4$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(option) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(store) + Z_PARAM_STR(condition) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &option_param, &defaultValue); - zephir_get_strval(&option, option_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; + zephir_fetch_params(1, 2, 2, &store_param, &condition_param, &value, &type_param); + zephir_get_strval(&store, store_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&value, &_0, &option, 1))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); + if (!(ZEPHIR_IS_EMPTY(value))) { + ZVAL_LONG(&_1$$3, type); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "bindinline", NULL, 0, value, &_1$$3); + zephir_check_call_status(); + zephir_concat_self(&condition, &_0$$3); } - RETURN_CTOR(&value); + zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_3, &_2, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 327); + if (ZEPHIR_IS_EMPTY(&_3)) { + ZEPHIR_INIT_VAR(&_4$$4); + ZVAL_STRING(&_4$$4, ""); + zephir_update_property_array_multi(this_ptr, SL("store"), &_4$$4, SL("za"), 2, &store); + } + zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_6, &_5, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 331); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_6); + zephir_check_call_status(); + zephir_read_property(&_7, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_8, &_7, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 333); + zephir_array_fetch(&_9, &_8, &key, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 333); + ZEPHIR_INIT_VAR(&_10); + ZEPHIR_CONCAT_VV(&_10, &_9, &condition); + zephir_update_property_array_multi(this_ptr, SL("store"), &_10, SL("zz"), 2, &store, &key); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getUserOptions) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, processValue) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *store_param = NULL, *data = NULL, data_sub, _0$$3, _1$$4, _2$$4, _3$$4; + zval store; zval *this_ptr = getThis(); + ZVAL_UNDEF(&store); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(store) + Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "options"); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getValidators) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &store_param, &data); + zephir_get_strval(&store, store_param); + ZEPHIR_SEPARATE_PARAM(data); - RETURN_MEMBER(getThis(), "validators"); + if (Z_TYPE_P(data) == IS_STRING) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_create_array(&_0$$3, 1, 0); + zephir_array_fast_append(&_0$$3, data); + ZEPHIR_CPY_WRT(data, &_0$$3); + } + if (Z_TYPE_P(data) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_1$$4); + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_3$$4, &_2$$4, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 350); + zephir_fast_array_merge(&_1$$4, &_3$$4, data); + zephir_update_property_array(this_ptr, SL("store"), &store, &_1$$4); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getValue) -{ - zval name, _0, form, value, _1$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&form); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1$$4); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&name, &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("form"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&form, &_0); - ZEPHIR_INIT_VAR(&value); - ZVAL_NULL(&value); - if (Z_TYPE_P(&form) == IS_OBJECT) { - ZEPHIR_RETURN_CALL_METHOD(&form, "getvalue", NULL, 0, &name); - zephir_check_call_status(); - RETURN_MM(); - } - if (Z_TYPE_P(&value) == IS_NULL) { - zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("value"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&value, &_1$$4); - } - RETURN_CCTOR(&value); -} -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, hasMessages) -{ - zval _0; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_AbstractQuery) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, AbstractQuery, phalcon, datamapper_query_abstractquery, phalcon_datamapper_query_abstractquery_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("bind"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("connection"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("store"), ZEND_ACC_PROTECTED); + phalcon_datamapper_query_abstractquery_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Query_AbstractQuery; - zephir_read_property(&_0, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_fast_count_int(&_0) > 0); + return SUCCESS; } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, label) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, __construct) { - zend_bool _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *attributes_param = NULL, code, internalAttributes, labelName, name, tagFactory, _0$$3; - zval attributes; + zval *connection, connection_sub, *bind, bind_sub, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&internalAttributes); - ZVAL_UNDEF(&labelName); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&tagFactory); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&bind_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &attributes_param); - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); - } else { - zephir_get_arrval(&attributes, attributes_param); - } + zephir_fetch_params(1, 2, 0, &connection, &bind); - ZEPHIR_CALL_METHOD(&tagFactory, this_ptr, "getlocaltagfactory", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_VAR(&internalAttributes); - zephir_read_property(&internalAttributes, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(&name); - if (!(zephir_array_isset_string_fetch(&name, &internalAttributes, SL("id"), 0))) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&name, &_0$$3); - } - if (!(zephir_array_isset_string(&attributes, SL("for")))) { - zephir_array_update_string(&attributes, SL("for"), &name, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&labelName); - zephir_read_property(&labelName, this_ptr, ZEND_STRL("label"), PH_NOISY_CC); - _1 = zephir_is_true(&labelName); - if (!(_1)) { - _1 = zephir_is_numeric(&labelName); - } - if (!(_1)) { - ZEPHIR_CPY_WRT(&labelName, &name); - } - ZEPHIR_CALL_METHOD(&code, &tagFactory, "label", NULL, 0, &labelName, &attributes); + zephir_update_property_zval(this_ptr, ZEND_STRL("bind"), bind); + zephir_update_property_zval(this_ptr, ZEND_STRL("connection"), connection); + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "UNION"); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); zephir_check_call_status(); - RETURN_CCTOR(&code); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, render) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindInline) { - zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *attributes_param = NULL, helper, merged, method, name, result, tagFactory, value, _0; - zval attributes; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *value, value_sub, *type_param = NULL, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); - ZVAL_UNDEF(&helper); - ZVAL_UNDEF(&merged); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&tagFactory); - ZVAL_UNDEF(&value); + ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(value) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &attributes_param); - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); + zephir_fetch_params(1, 1, 1, &value, &type_param); + if (!type_param) { + type = -1; } else { - zephir_get_arrval(&attributes, attributes_param); + type = zephir_get_intval(type_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&name, &_0); - ZEPHIR_CALL_METHOD(&value, this_ptr, "getvalue", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("method"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&method, &_0); - ZEPHIR_CALL_METHOD(&tagFactory, this_ptr, "getlocaltagfactory", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&helper, &tagFactory, "newinstance", NULL, 0, &method); - zephir_check_call_status(); - if (zephir_array_isset_string(&attributes, SL("value"))) { - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_string(&value, &attributes, SL("value"), PH_NOISY, "phalcon/Forms/Element/AbstractElement.zep", 391); - zephir_array_unset_string(&attributes, SL("value"), PH_SEPARATE); - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&merged); - zephir_fast_array_merge(&merged, &_0, &attributes); - ZEPHIR_CALL_METHOD(&result, &helper, "__invoke", NULL, 0, &name, &value, &merged); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, type); + ZEPHIR_RETURN_CALL_METHOD(&_0, "bindinline", NULL, 0, value, &_1); zephir_check_call_status(); - zephir_cast_to_string(&_1, &result); - RETURN_CTOR(&_1); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setAttribute) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindValue) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *attribute_param = NULL, *value, value_sub; - zval attribute; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *value, value_sub, *type_param = NULL, _0, _1; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(attribute) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(key) Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &attribute_param, &value); - zephir_get_strval(&attribute, attribute_param); + zephir_fetch_params(1, 2, 1, &key_param, &value, &type_param); + zephir_get_strval(&key, key_param); + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } - zephir_update_property_array(this_ptr, SL("attributes"), &attribute, value); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, type); + ZEPHIR_CALL_METHOD(NULL, &_0, "setvalue", NULL, 0, &key, value, &_1); + zephir_check_call_status(); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setAttributes) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindValues) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *attributes_param = NULL; - zval attributes; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *values_param = NULL, _0; + zval values; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(attributes) + Z_PARAM_ARRAY(values) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &attributes_param); - ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); + zephir_fetch_params(1, 1, 0, &values_param); + zephir_get_arrval(&values, values_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("attributes"), &attributes); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setvalues", NULL, 0, &values); + zephir_check_call_status(); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setDefault) -{ - zval *value, value_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("value"), value); - RETURN_THISW(); -} - -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setFilters) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, getBindValues) { - zend_bool _0; - zval *filters, filters_sub; + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filters_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(filters) - ZEND_PARSE_PARAMETERS_END(); -#endif - + ZVAL_UNDEF(&_0); - zephir_fetch_params_without_memory_grow(1, 0, &filters); + ZEPHIR_MM_GROW(); - _0 = Z_TYPE_P(filters) != IS_STRING; - if (_0) { - _0 = Z_TYPE_P(filters) != IS_ARRAY; - } - if (UNEXPECTED(_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_forms_exception_ce, "The filter needs to be an array or string", "phalcon/Forms/Element/AbstractElement.zep", 440); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("filters"), filters); - RETURN_THISW(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "toarray", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setForm) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, getStatement) { - zval *form, form_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&form_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(form, phalcon_forms_form_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &form); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("form"), form); - RETURN_THISW(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setLabel) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, perform) { + zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *label_param = NULL; - zval label; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&label); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(label) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &label_param); - zephir_get_strval(&label, label_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("label"), &label); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getstatement", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getbindvalues", NULL, 0); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&_0, "perform", NULL, 0, &_1, &_2); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setMessages) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, setFlag) { - zval *messages, messages_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_bool enable; + zval *flag_param = NULL, *enable_param = NULL, __$true, flags, _0$$4, _1$$4; + zval flag; zval *this_ptr = getThis(); - ZVAL_UNDEF(&messages_sub); + ZVAL_UNDEF(&flag); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&flags); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_1$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(messages, phalcon_messages_messages_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(flag) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(enable) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &messages); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &flag_param, &enable_param); + zephir_get_strval(&flag, flag_param); + if (!enable_param) { + enable = 1; + } else { + enable = zephir_get_boolval(enable_param); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("messages"), messages); - RETURN_THISW(); + if (enable) { + zephir_update_property_array_multi(this_ptr, SL("store"), &__$true, SL("sz"), 3, SL("FLAGS"), &flag); + } else { + zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&flags); + zephir_array_fetch_string(&flags, &_0$$4, SL("FLAGS"), PH_NOISY, "phalcon/DataMapper/Query/AbstractQuery.zep", 144); + zephir_array_unset(&flags, &flag, PH_SEPARATE); + ZEPHIR_INIT_VAR(&_1$$4); + ZVAL_STRING(&_1$$4, "FLAGS"); + zephir_update_property_array(this_ptr, SL("store"), &_1$$4, &flags); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setName) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, quoteIdentifier) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, *type_param = NULL, _0, _1; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(name) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 1, &name_param, &type_param); + zephir_get_strval(&name, name_param); + if (!type_param) { + type = 2; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, type); + ZEPHIR_RETURN_CALL_METHOD(&_0, "quote", NULL, 0, &name, &_1); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setTagFactory) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, reset) { - zval *tagFactory, tagFactory_sub; + zval _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tagFactory_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(tagFactory, phalcon_html_tagfactory_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_13); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_16); + ZVAL_UNDEF(&_17); - zephir_fetch_params_without_memory_grow(1, 0, &tagFactory); + ZEPHIR_MM_GROW(); - zephir_update_property_zval(this_ptr, ZEND_STRL("tagFactory"), tagFactory); - RETURN_THISW(); + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "COLUMNS"); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_0); + ZEPHIR_INIT_VAR(&_2); + array_init(&_2); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "FLAGS"); + zephir_update_property_array(this_ptr, SL("store"), &_3, &_2); + ZEPHIR_INIT_VAR(&_4); + array_init(&_4); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, "FROM"); + zephir_update_property_array(this_ptr, SL("store"), &_5, &_4); + ZEPHIR_INIT_VAR(&_6); + array_init(&_6); + ZEPHIR_INIT_VAR(&_7); + ZVAL_STRING(&_7, "GROUP"); + zephir_update_property_array(this_ptr, SL("store"), &_7, &_6); + ZEPHIR_INIT_VAR(&_8); + array_init(&_8); + ZEPHIR_INIT_VAR(&_9); + ZVAL_STRING(&_9, "HAVING"); + zephir_update_property_array(this_ptr, SL("store"), &_9, &_8); + ZEPHIR_INIT_VAR(&_10); + ZVAL_STRING(&_10, "LIMIT"); + ZEPHIR_INIT_VAR(&_11); + ZVAL_LONG(&_11, 0); + zephir_update_property_array(this_ptr, SL("store"), &_10, &_11); + ZEPHIR_INIT_VAR(&_12); + array_init(&_12); + ZEPHIR_INIT_VAR(&_13); + ZVAL_STRING(&_13, "ORDER"); + zephir_update_property_array(this_ptr, SL("store"), &_13, &_12); + ZEPHIR_INIT_VAR(&_14); + ZVAL_STRING(&_14, "OFFSET"); + ZEPHIR_INIT_VAR(&_15); + ZVAL_LONG(&_15, 0); + zephir_update_property_array(this_ptr, SL("store"), &_14, &_15); + ZEPHIR_INIT_VAR(&_16); + array_init(&_16); + ZEPHIR_INIT_VAR(&_17); + ZVAL_STRING(&_17, "WHERE"); + zephir_update_property_array(this_ptr, SL("store"), &_17, &_16); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setUserOption) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, buildFlags) { + zval _0, _1, _2, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *option_param = NULL, *value, value_sub; - zval option; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(option) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &option_param, &value); - zephir_get_strval(&option, option_param); - - zephir_update_property_array(this_ptr, SL("options"), &option, value); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("FLAGS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 190); + if (ZEPHIR_IS_EMPTY(&_1)) { + RETURN_MM_STRING(""); + } + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_INIT_VAR(&_3); + zephir_read_property(&_4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_5, &_4, SL("FLAGS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 194); + zephir_array_keys(&_3, &_5); + zephir_fast_join_str(&_2, SL(" "), &_3); + ZEPHIR_CONCAT_SV(return_value, " ", &_2); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setUserOptions) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, buildReturning) { + zval _0, _1, _2, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL; - zval options; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(options) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - zephir_get_arrval(&options, options_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 204); + if (ZEPHIR_IS_EMPTY(&_1)) { + RETURN_MM_STRING(""); + } + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_4, &_3, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 208); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, ","); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4, &_5); + zephir_check_call_status(); + ZEPHIR_CONCAT_SV(return_value, " RETURNING", &_2); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getLocalTagFactory) +static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, indent) { - zval container, escaper, tagFactory, _0, _1$$3, _2$$4, _4$$5, _5$$5, _6$$6, _7$$7, _8$$7, _9$$8; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval glue, _1; + zval *collection_param = NULL, *glue_param = NULL, _0; + zval collection; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container); - ZVAL_UNDEF(&escaper); - ZVAL_UNDEF(&tagFactory); + ZVAL_UNDEF(&collection); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_9$$8); + ZVAL_UNDEF(&glue); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(collection) + Z_PARAM_OPTIONAL + Z_PARAM_STR(glue) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &collection_param, &glue_param); + zephir_get_arrval(&collection, collection_param); + if (!glue_param) { + ZEPHIR_INIT_VAR(&glue); + ZVAL_STRING(&glue, ""); + } else { + zephir_get_strval(&glue, glue_param); + } - ZEPHIR_INIT_VAR(&tagFactory); - ZVAL_NULL(&tagFactory); - zephir_read_property(&_0, this_ptr, ZEND_STRL("tagFactory"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&_0))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("form"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_1$$3) != IS_NULL) { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("form"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&tagFactory, &_2$$4, "gettagfactory", NULL, 0); - zephir_check_call_status(); - } - if (Z_TYPE_P(&tagFactory) == IS_NULL) { - ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_3, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_5$$5); - ZVAL_STRING(&_5$$5, "tag"); - ZEPHIR_CALL_METHOD(&_4$$5, &container, "has", NULL, 0, &_5$$5); - zephir_check_call_status(); - if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&_4$$5))) { - ZEPHIR_INIT_VAR(&_6$$6); - ZVAL_STRING(&_6$$6, "tag"); - ZEPHIR_CALL_METHOD(&tagFactory, &container, "getshared", NULL, 0, &_6$$6); - zephir_check_call_status(); - } - } - if (Z_TYPE_P(&tagFactory) == IS_NULL) { - ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_3, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_8$$7); - ZVAL_STRING(&_8$$7, "escaper"); - ZEPHIR_CALL_METHOD(&_7$$7, &container, "has", NULL, 0, &_8$$7); - zephir_check_call_status(); - if (EXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&_7$$7))) { - ZEPHIR_INIT_VAR(&_9$$8); - ZVAL_STRING(&_9$$8, "escaper"); - ZEPHIR_CALL_METHOD(&escaper, &container, "getshared", NULL, 0, &_9$$8); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&escaper); - object_init_ex(&escaper, phalcon_html_escaper_ce); - if (zephir_has_constructor(&escaper)) { - ZEPHIR_CALL_METHOD(NULL, &escaper, "__construct", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&tagFactory); - object_init_ex(&tagFactory, phalcon_html_tagfactory_ce); - ZEPHIR_CALL_METHOD(NULL, &tagFactory, "__construct", NULL, 9, &escaper); - zephir_check_call_status(); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("tagFactory"), &tagFactory); + if (ZEPHIR_IS_EMPTY(&collection)) { + RETURN_MM_STRING(""); } - RETURN_MM_MEMBER(getThis(), "tagFactory"); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_CONCAT_VS(&_1, &glue, " "); + zephir_fast_join(&_0, &_1, &collection); + ZEPHIR_CONCAT_SV(return_value, " ", &_0); + RETURN_MM(); } -zend_object *zephir_init_properties_Phalcon_Forms_Element_AbstractElement(zend_class_entry *class_type) +zend_object *zephir_init_properties_Phalcon_DataMapper_Query_AbstractQuery(zend_class_entry *class_type) { - zval _0, _2, _4, _6, _1$$3, _3$$4, _5$$5, _7$$6; + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_7$$6); ZEPHIR_MM_GROW(); @@ -30386,29 +29609,11 @@ zend_object *zephir_init_properties_Phalcon_Forms_Element_AbstractElement(zend_c { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("validators"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("validators"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_3$$4); - } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("filters"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_4) == IS_NULL) { - ZEPHIR_INIT_VAR(&_5$$5); - array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("filters"), &_5$$5); - } - zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_6) == IS_NULL) { - ZEPHIR_INIT_VAR(&_7$$6); - array_init(&_7$$6); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("attributes"), &_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -30425,113 +29630,392 @@ zend_object *zephir_init_properties_Phalcon_Forms_Element_AbstractElement(zend_c -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Check) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Bind) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Check, phalcon, forms_element_check, phalcon_forms_element_abstractelement_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, Bind, phalcon, datamapper_query_bind, phalcon_datamapper_query_bind_method_entry, 0); + + zend_declare_property_long(phalcon_datamapper_query_bind_ce, SL("inlineCount"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_datamapper_query_bind_ce, SL("store"), ZEND_ACC_PROTECTED); + phalcon_datamapper_query_bind_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Query_Bind; - zend_declare_property_string(phalcon_forms_element_check_ce, SL("method"), "inputCheckbox", ZEND_ACC_PROTECTED); return SUCCESS; } +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, bindInline) +{ + zend_bool _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *value, value_sub, *type_param = NULL, key, _3, _4, _5, _1$$3, _2$$4; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &value, &type_param); + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } + _0 = Z_TYPE_P(value) == IS_OBJECT; + if (_0) { + _0 = zephir_instance_of_ev(value, phalcon_datamapper_query_select_ce); + } + if (_0) { + ZEPHIR_CALL_METHOD(&_1$$3, value, "getstatement", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVS(return_value, "(", &_1$$3, ")"); + RETURN_MM(); + } + if (Z_TYPE_P(value) == IS_ARRAY) { + ZVAL_LONG(&_2$$4, type); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "inlinearray", NULL, 0, value, &_2$$4); + zephir_check_call_status(); + RETURN_MM(); + } + zephir_read_property(&_3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_ZVAL_NREF(_4); + ZVAL_LONG(&_4, (zephir_get_numberval(&_3) + 1)); + zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_4); + zephir_read_property(&_4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&key); + ZEPHIR_CONCAT_SVS(&key, "__", &_4, "__"); + ZVAL_LONG(&_5, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", NULL, 0, &key, value, &_5); + zephir_check_call_status(); + ZEPHIR_CONCAT_SV(return_value, ":", &key); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Date) +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, remove) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Date, phalcon, forms_element_date, phalcon_forms_element_abstractelement_ce, NULL, 0); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *key_param = NULL, store, _0; + zval key; + zval *this_ptr = getThis(); - zend_declare_property_string(phalcon_forms_element_date_ce, SL("method"), "inputDate", ZEND_ACC_PROTECTED); - return SUCCESS; -} + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&store); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); -#ifdef HAVE_CONFIG_H + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&store, &_0); + zephir_array_unset(&store, &key, PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("store"), &store); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, setValue) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *value, value_sub, *type_param = NULL, localType; + zval key; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&localType); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &key_param, &value, &type_param); + zephir_get_strval(&key, key_param); + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } + ZEPHIR_INIT_VAR(&localType); + ZVAL_LONG(&localType, type); + if (ZEPHIR_IS_LONG_IDENTICAL(&localType, -1)) { + ZEPHIR_CALL_METHOD(&localType, this_ptr, "gettype", NULL, 0, value); + zephir_check_call_status(); + } + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + zephir_array_fast_append(&_0, value); + zephir_array_fast_append(&_0, &localType); + zephir_update_property_array(this_ptr, SL("store"), &key, &_0); + ZEPHIR_MM_RESTORE(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_ElementInterface) +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, setValues) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Forms\\Element, ElementInterface, phalcon, forms_element_elementinterface, phalcon_forms_element_elementinterface_method_entry); + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *values_param = NULL, *type_param = NULL, key, value, *_0, _1, _4$$3, _6$$4; + zval values; + zval *this_ptr = getThis(); - return SUCCESS; -} + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_6$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(values) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_END(); +#endif -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, addFilter); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, addValidator); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, addValidators); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, appendMessage); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, clear); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getAttribute); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getAttributes); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getDefault); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getFilters); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getForm); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getLabel); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getMessages); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getUserOption); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getUserOptions); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getValidators); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, getValue); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, hasMessages); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, label); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, render); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setAttribute); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setAttributes); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setDefault); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setFilters); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setForm); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setLabel); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setMessages); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setName); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setUserOption); -ZEPHIR_DOC_METHOD(Phalcon_Forms_Element_ElementInterface, setUserOptions); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &values_param, &type_param); + zephir_get_arrval(&values, values_param); + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } -#ifdef HAVE_CONFIG_H -#endif + zephir_is_iterable(&values, 0, "phalcon/DataMapper/Query/Bind.zep", 108); + if (Z_TYPE_P(&values) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&values), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + ZVAL_LONG(&_4$$3, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_4$$3); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &values, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &values, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); + zephir_check_call_status(); + ZVAL_LONG(&_6$$4, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_6$$4); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_MM_RESTORE(); +} +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, toArray) +{ + zval *this_ptr = getThis(); + RETURN_MEMBER(getThis(), "store"); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Email) +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, getType) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Email, phalcon, forms_element_email, phalcon_forms_element_abstractelement_ce, NULL, 0); + zval *value, value_sub; + zval *this_ptr = getThis(); - zend_declare_property_string(phalcon_forms_element_email_ce, SL("method"), "inputEmail", ZEND_ACC_PROTECTED); - return SUCCESS; -} + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + zephir_fetch_params_without_memory_grow(1, 0, &value); -#ifdef HAVE_CONFIG_H + if (Z_TYPE_P(value) == IS_NULL) { + RETURN_LONG(0); + } + if (((Z_TYPE_P(value) == IS_TRUE || Z_TYPE_P(value) == IS_FALSE) == 1)) { + RETURN_LONG(5); + } + if (Z_TYPE_P(value) == IS_LONG) { + RETURN_LONG(1); + } + RETURN_LONG(2); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Bind, inlineArray) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *type_param = NULL, key, value, *_0, _1, _11, _2$$3, _3$$3, _4$$3, _6$$3, _7$$4, _8$$4, _9$$4, _10$$4; + zval data, keys; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&keys); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ARRAY(data) + Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &data_param, &type_param); + zephir_get_arrval(&data, data_param); + type = zephir_get_intval(type_param); + ZEPHIR_INIT_VAR(&keys); + array_init(&keys); + zephir_is_iterable(&data, 0, "phalcon/DataMapper/Query/Bind.zep", 167); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&data), _0) + { + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_ZVAL_NREF(_3$$3); + ZVAL_LONG(&_3$$3, (zephir_get_numberval(&_2$$3) + 1)); + zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_3$$3); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_CONCAT_SVS(&key, "__", &_3$$3, "__"); + ZVAL_LONG(&_4$$3, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_4$$3); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_6$$3); + ZEPHIR_CONCAT_SV(&_6$$3, ":", &key); + zephir_array_append(&keys, &_6$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Bind.zep", 164); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_7$$4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_ZVAL_NREF(_8$$4); + ZVAL_LONG(&_8$$4, (zephir_get_numberval(&_7$$4) + 1)); + zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_8$$4); + zephir_read_property(&_8$$4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_CONCAT_SVS(&key, "__", &_8$$4, "__"); + ZVAL_LONG(&_9$$4, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_9$$4); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_10$$4); + ZEPHIR_CONCAT_SV(&_10$$4, ":", &key); + zephir_array_append(&keys, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Bind.zep", 164); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_VAR(&_11); + zephir_fast_join_str(&_11, SL(", "), &keys); + ZEPHIR_CONCAT_SVS(return_value, "(", &_11, ")"); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_File) +zend_object *zephir_init_properties_Phalcon_DataMapper_Query_Bind(zend_class_entry *class_type) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, File, phalcon, forms_element_file, phalcon_forms_element_abstractelement_ce, NULL, 0); + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + - zend_declare_property_string(phalcon_forms_element_file_ce, SL("method"), "inputFile", ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } } @@ -30544,66 +30028,178 @@ ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_File) -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Hidden) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Delete) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Hidden, phalcon, forms_element_hidden, phalcon_forms_element_abstractelement_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Delete, phalcon, datamapper_query_delete, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_delete_method_entry, 0); - zend_declare_property_string(phalcon_forms_element_hidden_ce, SL("method"), "inputHidden", ZEND_ACC_PROTECTED); return SUCCESS; } +static PHP_METHOD(Phalcon_DataMapper_Query_Delete, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&bind_sub); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &connection, &bind); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_delete_ce, getThis(), "__construct", &_0, 0, connection, bind); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + ZEPHIR_MM_RESTORE(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Numeric) +static PHP_METHOD(Phalcon_DataMapper_Query_Delete, from) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Numeric, phalcon, forms_element_numeric, phalcon_forms_element_abstractelement_ce, NULL, 0); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *table_param = NULL, _0; + zval table; + zval *this_ptr = getThis(); - zend_declare_property_string(phalcon_forms_element_numeric_ce, SL("method"), "inputNumeric", ZEND_ACC_PROTECTED); - return SUCCESS; -} + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &table_param); + zephir_get_strval(&table, table_param); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "FROM"); + zephir_update_property_array(this_ptr, SL("store"), &_0, &table); + RETURN_THIS(); +} +static PHP_METHOD(Phalcon_DataMapper_Query_Delete, returning) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *columns_param = NULL, _0, _1, _2, _3; + zval columns; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columns) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &columns_param); + zephir_get_arrval(&columns, columns_param); -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Password) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Password, phalcon, forms_element_password, phalcon_forms_element_abstractelement_ce, NULL, 0); - zend_declare_property_string(phalcon_forms_element_password_ce, SL("method"), "inputPassword", ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Delete.zep", 63); + zephir_fast_array_merge(&_0, &_2, &columns); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); + RETURN_THIS(); } +static PHP_METHOD(Phalcon_DataMapper_Query_Delete, getStatement) +{ + zval _0, _1, _2, _3, _4, _5; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Delete.zep", 78); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "WHERE"); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcondition", NULL, 0, &_4); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "buildreturning", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVVV(return_value, "DELETE", &_0, " FROM ", &_2, &_3, &_5); + RETURN_MM(); +} +static PHP_METHOD(Phalcon_DataMapper_Query_Delete, reset) +{ + zval _1, _2, _3, _4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Radio) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Radio, phalcon, forms_element_radio, phalcon_forms_element_abstractelement_ce, NULL, 0); + ZEPHIR_MM_GROW(); - zend_declare_property_string(phalcon_forms_element_radio_ce, SL("method"), "inputRadio", ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_delete_ce, getThis(), "reset", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + ZEPHIR_MM_RESTORE(); } @@ -30616,276 +30212,475 @@ ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Radio) -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Select) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Insert) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Select, phalcon, forms_element_select, phalcon_forms_element_abstractelement_ce, phalcon_forms_element_select_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Insert, phalcon, datamapper_query_insert, phalcon_datamapper_query_abstractquery_ce, phalcon_datamapper_query_insert_method_entry, 0); - zend_declare_property_null(phalcon_forms_element_select_ce, SL("optionsValues"), ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Forms_Element_Select, __construct) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; - zval attributes; - zval *name_param = NULL, *options = NULL, options_sub, *attributes_param = NULL, __$null; - zval name; + zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&options_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&bind_sub); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(options) - Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &name_param, &options, &attributes_param); - zephir_get_strval(&name, name_param); - if (!options) { - options = &options_sub; - options = &__$null; - } - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); - } else { - zephir_get_arrval(&attributes, attributes_param); - } + zephir_fetch_params(1, 2, 0, &connection, &bind); - zephir_update_property_zval(this_ptr, ZEND_STRL("optionsValues"), options); - ZEPHIR_CALL_PARENT(NULL, phalcon_forms_element_select_ce, getThis(), "__construct", &_0, 0, &name, &attributes); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_insert_ce, getThis(), "__construct", &_0, 0, connection, bind); zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Forms_Element_Select, addOption) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, column) { - zend_string *_3$$3; - zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *option, option_sub, key, value, *_0$$3, _1$$3; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *column_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _1$$3, _2$$3; + zval column, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&option_sub); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(option) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(column) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &option); - - - if (Z_TYPE_P(option) == IS_ARRAY) { - zephir_is_iterable(option, 0, "phalcon/Forms/Element/Select.zep", 51); - if (Z_TYPE_P(option) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(option), _2$$3, _3$$3, _0$$3) - { - ZEPHIR_INIT_NVAR(&key); - if (_3$$3 != NULL) { - ZVAL_STR_COPY(&key, _3$$3); - } else { - ZVAL_LONG(&key, _2$$3); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0$$3); - zephir_update_property_array(this_ptr, SL("optionsValues"), &key, &value); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, option, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, option, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&key, option, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, option, "current", NULL, 0); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("optionsValues"), &key, &value); - ZEPHIR_CALL_METHOD(NULL, option, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); + zephir_fetch_params(1, 1, 2, &column_param, &value, &type_param); + zephir_get_strval(&column, column_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; } else { - zephir_update_property_array_append(this_ptr, SL("optionsValues"), option); + type = zephir_get_intval(type_param); } - RETURN_THIS(); -} - -static PHP_METHOD(Phalcon_Forms_Element_Select, getOptions) -{ - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "optionsValues"); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_SV(&_0, ":", &column); + zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sz"), 3, SL("COLUMNS"), &column); + if (Z_TYPE_P(value) != IS_NULL) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_2$$3, type); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "setvalue", NULL, 0, &column, value, &_2$$3); + zephir_check_call_status(); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_Select, render) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, columns) { + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *attributes_param = NULL, _1, _2; - zval attributes; + zval *columns_param = NULL, column, value, *_0, _1; + zval columns; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columns) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &attributes_param); - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); - } else { - zephir_get_arrval(&attributes, attributes_param); - } + zephir_fetch_params(1, 1, 0, &columns_param); + zephir_get_arrval(&columns, columns_param); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "prepareattributes", NULL, 0, &attributes); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("optionsValues"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_CE_STATIC(phalcon_tag_select_ce, "selectfield", &_0, 0, &_1, &_2); - zephir_check_call_status(); - RETURN_MM(); + zephir_is_iterable(&columns, 0, "phalcon/DataMapper/Query/Insert.zep", 76); + if (Z_TYPE_P(&columns) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columns), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&column); + if (_3 != NULL) { + ZVAL_STR_COPY(&column, _3); + } else { + ZVAL_LONG(&column, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + if (Z_TYPE_P(&column) == IS_LONG) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); + zephir_check_call_status(); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &columns, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&column, &columns, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &columns, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&column) == IS_LONG) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&column); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_Select, setOptions) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, into) { - zval *options, options_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *table_param = NULL, _0; + zval table; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options_sub); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(options) + Z_PARAM_STR(table) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &options); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &table_param); + zephir_get_strval(&table, table_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("optionsValues"), options); - RETURN_THISW(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "FROM"); + zephir_update_property_array(this_ptr, SL("store"), &_0, &table); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Forms_Element_Select, prepareAttributes) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, getLastInsertId) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *attributes_param = NULL, value, name, mergedAttributes, defaultAttributes, _0; - zval attributes; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&attributes); - ZVAL_UNDEF(&value); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&mergedAttributes); - ZVAL_UNDEF(&defaultAttributes); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(attributes) + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &attributes_param); - if (!attributes_param) { - ZEPHIR_INIT_VAR(&attributes); - array_init(&attributes); + zephir_fetch_params(1, 0, 1, &name_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - zephir_get_arrval(&attributes, attributes_param); + zephir_get_strval(&name, name_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&name, &_0); - zephir_array_update_long(&attributes, 0, &name, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - ZEPHIR_OBS_VAR(&defaultAttributes); - zephir_read_property(&defaultAttributes, this_ptr, ZEND_STRL("attributes"), PH_NOISY_CC); - ZEPHIR_INIT_VAR(&mergedAttributes); - zephir_fast_array_merge(&mergedAttributes, &defaultAttributes, &attributes); - ZEPHIR_CALL_METHOD(&value, this_ptr, "getvalue", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "lastinsertid", NULL, 0, &name); zephir_check_call_status(); - if (Z_TYPE_P(&value) != IS_NULL) { - zephir_array_update_string(&mergedAttributes, SL("value"), &value, PH_COPY | PH_SEPARATE); - } - RETURN_CCTOR(&mergedAttributes); + RETURN_MM(); } +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, getStatement) +{ + zval _0, _1, _2, _3, _4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZEPHIR_MM_GROW(); -#ifdef HAVE_CONFIG_H + ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 113); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 204); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildreturning", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CONCAT_SVSVVV(return_value, "INSERT", &_0, " INTO ", &_2, &_3, &_4); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, returning) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *columns_param = NULL, _0, _1, _2, _3; + zval columns; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columns) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &columns_param); + zephir_get_arrval(&columns, columns_param); + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 127); + zephir_fast_array_merge(&_0, &_2, &columns); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); + RETURN_THIS(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Submit) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, reset) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Submit, phalcon, forms_element_submit, phalcon_forms_element_abstractelement_ce, NULL, 0); + zval _1, _2, _3, _4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *this_ptr = getThis(); - zend_declare_property_string(phalcon_forms_element_submit_ce, SL("method"), "inputSubmit", ZEND_ACC_PROTECTED); - return SUCCESS; -} + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZEPHIR_MM_GROW(); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_insert_ce, getThis(), "reset", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + ZEPHIR_MM_RESTORE(); +} -#ifdef HAVE_CONFIG_H +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, set) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *column_param = NULL, *value = NULL, value_sub, __$null, _0; + zval column; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(column) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &column_param, &value); + zephir_get_strval(&column, column_param); + if (!value) { + value = &value_sub; + ZEPHIR_CPY_WRT(value, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(value); + } + if (Z_TYPE_P(value) == IS_NULL) { + ZEPHIR_INIT_NVAR(value); + ZVAL_STRING(value, "NULL"); + } + zephir_update_property_array_multi(this_ptr, SL("store"), value, SL("sz"), 3, SL("COLUMNS"), &column); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &column); + zephir_check_call_status(); + RETURN_THIS(); +} -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Text) +static PHP_METHOD(Phalcon_DataMapper_Query_Insert, buildColumns) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Text, phalcon, forms_element_text, phalcon_forms_element_abstractelement_ce, NULL, 0); + zend_string *_6; + zend_ulong _5; + zval columns; + zval column, _0, _1, _2, *_3, _4, _10, _11, _12, _13, _14, _15, _16, _17, _7$$3, _9$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_8 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); - return SUCCESS; + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_13); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_16); + ZVAL_UNDEF(&_17); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&columns); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&columns); + array_init(&columns); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 176); + ZEPHIR_INIT_VAR(&_2); + zephir_is_iterable(&_1, 0, "phalcon/DataMapper/Query/Insert.zep", 180); + if (Z_TYPE_P(&_1) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_1), _5, _6, _3) + { + ZEPHIR_INIT_NVAR(&column); + if (_6 != NULL) { + ZVAL_STR_COPY(&column, _6); + } else { + ZVAL_LONG(&column, _5); + } + ZEPHIR_INIT_NVAR(&_2); + ZVAL_COPY(&_2, _3); + ZEPHIR_CALL_METHOD(&_7$$3, this_ptr, "quoteidentifier", &_8, 0, &column); + zephir_check_call_status(); + zephir_array_append(&columns, &_7$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Insert.zep", 177); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_4, &_1, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4)) { + break; + } + ZEPHIR_CALL_METHOD(&column, &_1, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_2, &_1, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "quoteidentifier", &_8, 0, &column); + zephir_check_call_status(); + zephir_array_append(&columns, &_9$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Insert.zep", 177); + ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&_2); + ZEPHIR_INIT_NVAR(&column); + ZEPHIR_INIT_VAR(&_10); + ZEPHIR_INIT_VAR(&_12); + ZVAL_STRING(&_12, ","); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "indent", NULL, 0, &columns, &_12); + zephir_check_call_status(); + zephir_fast_trim(&_10, &_11, NULL , ZEPHIR_TRIM_LEFT); + ZEPHIR_INIT_NVAR(&_12); + zephir_read_property(&_14, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_15, &_14, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 183); + ZEPHIR_CALL_FUNCTION(&_16, "array_values", NULL, 14, &_15); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_17); + ZVAL_STRING(&_17, ","); + ZEPHIR_CALL_METHOD(&_13, this_ptr, "indent", NULL, 0, &_16, &_17); + zephir_check_call_status(); + zephir_fast_trim(&_12, &_13, NULL , ZEPHIR_TRIM_LEFT); + ZEPHIR_CONCAT_SVSVS(return_value, " (", &_10, ") VALUES (", &_12, ")"); + RETURN_MM(); } @@ -30898,60 +30693,197 @@ ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_Text) -ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_TextArea) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_QueryFactory) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, TextArea, phalcon, forms_element_textarea, phalcon_forms_element_abstractelement_ce, NULL, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, QueryFactory, phalcon, datamapper_query_queryfactory, phalcon_datamapper_query_queryfactory_method_entry, 0); - zend_declare_property_string(phalcon_forms_element_textarea_ce, SL("method"), "inputTextarea", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_datamapper_query_queryfactory_ce, SL("selectClass"), "", ZEND_ACC_PROTECTED); return SUCCESS; } +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *selectClass_param = NULL; + zval selectClass; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&selectClass); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(selectClass) + ZEND_PARSE_PARAMETERS_END(); +#endif + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &selectClass_param); + if (!selectClass_param) { + ZEPHIR_INIT_VAR(&selectClass); + ZVAL_STRING(&selectClass, ""); + } else { + zephir_get_strval(&selectClass, selectClass_param); + } -#ifdef HAVE_CONFIG_H + if (ZEPHIR_IS_EMPTY(&selectClass)) { + ZEPHIR_INIT_NVAR(&selectClass); + ZVAL_STRING(&selectClass, "Phalcon\\DataMapper\\Query\\Select"); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("selectClass"), &selectClass); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newBind) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + + + ZEPHIR_MM_GROW(); + + object_init_ex(return_value, phalcon_datamapper_query_bind_ce); + if (zephir_has_constructor(return_value)) { + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); + zephir_check_call_status(); + } + + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newDelete) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connection, connection_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &connection); + object_init_ex(return_value, phalcon_datamapper_query_delete_ce); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 205, connection, &_0); + zephir_check_call_status(); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Di_AbstractInjectionAware) +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newInsert) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Di, AbstractInjectionAware, phalcon, di_abstractinjectionaware, phalcon_di_abstractinjectionaware_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connection, connection_sub, _0; + zval *this_ptr = getThis(); - zend_declare_property_null(phalcon_di_abstractinjectionaware_ce, SL("container"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_di_abstractinjectionaware_ce, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &connection); + + + object_init_ex(return_value, phalcon_datamapper_query_insert_ce); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 206, connection, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_AbstractInjectionAware, getDI) +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newSelect) { + zend_class_entry *_2; + zval selectClass; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connection, connection_sub, _0, _1, _3; zval *this_ptr = getThis(); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&selectClass); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &connection); - RETURN_MEMBER(getThis(), "container"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("selectClass"), PH_NOISY_CC | PH_READONLY); + zephir_get_strval(&selectClass, &_0); + zephir_fetch_safe_class(&_1, &selectClass); + _2 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_1), Z_STRLEN_P(&_1), ZEND_FETCH_CLASS_AUTO); + if(!_2) { + RETURN_MM_NULL(); + } + object_init_ex(return_value, _2); + if (zephir_has_constructor(return_value)) { + ZEPHIR_CALL_METHOD(&_3, this_ptr, "newbind", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, connection, &_3); + zephir_check_call_status(); + } + + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_AbstractInjectionAware, setDI) +static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newUpdate) { - zval *container, container_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connection, connection_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container_sub); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &container); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &connection); - zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); + object_init_ex(return_value, phalcon_datamapper_query_update_ce); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 207, connection, &_0); + zephir_check_call_status(); + RETURN_MM(); } @@ -30964,1625 +30896,1473 @@ static PHP_METHOD(Phalcon_Di_AbstractInjectionAware, setDI) -ZEPHIR_INIT_CLASS(Phalcon_Di_Di) +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Select) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Di, Di, phalcon, di_di, phalcon_di_di_method_entry, 0); - - zend_declare_property_null(phalcon_di_di_ce, SL("services"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_di_di_ce, SL("sharedInstances"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_di_di_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_di_di_ce, SL("defaultDi"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC); - phalcon_di_di_ce->create_object = zephir_init_properties_Phalcon_Di_Di; - - zend_class_implements(phalcon_di_di_ce, 1, phalcon_di_diinterface_ce); - return SUCCESS; -} + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Select, phalcon, datamapper_query_select, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_select_method_entry, 0); -static PHP_METHOD(Phalcon_Di_Di, __construct) -{ - zval _0; - zval *this_ptr = getThis(); + zend_declare_property_string(phalcon_datamapper_query_select_ce, SL("asAlias"), "", ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_datamapper_query_select_ce, SL("forUpdate"), 0, ZEND_ACC_PROTECTED); + zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_INNER"), "INNER"); - ZVAL_UNDEF(&_0); + zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_LEFT"), "LEFT"); + zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_NATURAL"), "NATURAL"); + zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_RIGHT"), "RIGHT"); - zephir_read_static_property_ce(&_0, phalcon_di_di_ce, SL("defaultDi"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_is_true(&_0))) { - zephir_update_static_property_ce(phalcon_di_di_ce, ZEND_STRL("defaultDi"), this_ptr); - } + return SUCCESS; } -static PHP_METHOD(Phalcon_Di_Di, __call) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, __call) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval arguments; - zval *method_param = NULL, *arguments_param = NULL, instance, possibleService, definition, _6, _0$$3, _1$$3, _2$$3, _3$$6, _4$$6, _5$$6; - zval method, _7; + zval params, proxied, _0$$3, _3$$3; + zval *method_param = NULL, *params_param = NULL, __$true, _5, _1$$3, _2$$3, _4$$3; + zval method, _6; zval *this_ptr = getThis(); ZVAL_UNDEF(&method); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&instance); - ZVAL_UNDEF(&possibleService); - ZVAL_UNDEF(&definition); ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_0$$3); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&proxied); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_3$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(method) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(arguments) + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &method_param, &arguments_param); - if (UNEXPECTED(Z_TYPE_P(method_param) != IS_STRING && Z_TYPE_P(method_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'method' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(method_param) == IS_STRING)) { - zephir_get_strval(&method, method_param); - } else { - ZEPHIR_INIT_VAR(&method); - } - if (!arguments_param) { - ZEPHIR_INIT_VAR(&arguments); - array_init(&arguments); - } else { - zephir_get_arrval(&arguments, arguments_param); - } + zephir_fetch_params(1, 2, 0, &method_param, ¶ms_param); + zephir_get_strval(&method, method_param); + zephir_get_arrval(¶ms, params_param); - if (zephir_start_with_str(&method, SL("get"))) { - ZVAL_LONG(&_0$$3, 3); - ZEPHIR_INIT_VAR(&_1$$3); - zephir_substr(&_1$$3, &method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_FUNCTION(&possibleService, "lcfirst", NULL, 73, &_1$$3); + ZEPHIR_INIT_VAR(&proxied); + zephir_create_array(&proxied, 10, 0); + zephir_array_update_string(&proxied, SL("fetchAffected"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchAll"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchAssoc"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchCol"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchGroup"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchObject"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchObjects"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchOne"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchPairs"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&proxied, SL("fetchValue"), &__$true, PH_COPY | PH_SEPARATE); + if (EXPECTED(zephir_array_isset(&proxied, &method))) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_create_array(&_0$$3, 2, 0); + ZEPHIR_OBS_VAR(&_1$$3); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC); + zephir_array_fast_append(&_0$$3, &_1$$3); + zephir_array_fast_append(&_0$$3, &method); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_INIT_VAR(&_3$$3); + zephir_create_array(&_3$$3, 2, 0); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "getstatement", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_2$$3, &possibleService)) { - ZEPHIR_CALL_METHOD(&instance, this_ptr, "get", NULL, 0, &possibleService, &arguments); - zephir_check_call_status(); - RETURN_CCTOR(&instance); - } - } - if (zephir_start_with_str(&method, SL("set"))) { - ZEPHIR_OBS_VAR(&definition); - if (zephir_array_isset_long_fetch(&definition, &arguments, 0, 0)) { - ZVAL_LONG(&_3$$6, 3); - ZEPHIR_INIT_VAR(&_4$$6); - zephir_substr(&_4$$6, &method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - ZEPHIR_CALL_FUNCTION(&_5$$6, "lcfirst", NULL, 73, &_4$$6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", NULL, 0, &_5$$6, &definition); - zephir_check_call_status(); - RETURN_MM_NULL(); - } + zephir_array_fast_append(&_3$$3, &_4$$3); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "getbindvalues", NULL, 0); + zephir_check_call_status(); + zephir_array_fast_append(&_3$$3, &_4$$3); + zephir_fast_array_merge(&_2$$3, &_3$$3, ¶ms); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_0$$3, &_2$$3); + zephir_check_call_status(); + RETURN_MM(); } + ZEPHIR_INIT_VAR(&_5); + object_init_ex(&_5, spl_ce_BadMethodCallException); ZEPHIR_INIT_VAR(&_6); - object_init_ex(&_6, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_7); - ZEPHIR_CONCAT_SVS(&_7, "Call to undefined method or service '", &method, "'"); - ZEPHIR_CALL_METHOD(NULL, &_6, "__construct", NULL, 29, &_7); + ZEPHIR_CONCAT_SVS(&_6, "Unknown method: [", &method, "]"); + ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 75, &_6); zephir_check_call_status(); - zephir_throw_exception_debug(&_6, "phalcon/Di/Di.zep", 147); + zephir_throw_exception_debug(&_5, "phalcon/DataMapper/Query/Select.zep", 83); ZEPHIR_MM_RESTORE(); return; } -static PHP_METHOD(Phalcon_Di_Di, attempt) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, andHaving) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool shared; - zval *name_param = NULL, *definition, definition_sub, *shared_param = NULL, _0, _1, _2, _3, _4; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition_sub); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(definition) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) Z_PARAM_OPTIONAL - Z_PARAM_BOOL(shared) + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &name_param, &definition, &shared_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (!shared_param) { - shared = 0; + if (!type_param) { + type = -1; } else { - shared = zephir_get_boolval(shared_param); + type = zephir_get_intval(type_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_0, &name)) { - RETURN_MM_BOOL(0); - } - ZEPHIR_INIT_VAR(&_1); - object_init_ex(&_1, phalcon_di_service_ce); - if (shared) { - ZVAL_BOOL(&_2, 1); - } else { - ZVAL_BOOL(&_2, 0); - } - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 74, definition, &_2); + ZVAL_LONG(&_0, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "having", NULL, 0, &condition, value, &_0); zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("services"), &name, &_1); - zephir_read_property(&_3, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4, &_3, &name, PH_NOISY | PH_READONLY, "phalcon/Di/Di.zep", 163); - RETURN_CTOR(&_4); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, get) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, asAlias) { - zval _6$$5, _15$$18; - zend_bool _1$$3, _14$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *parameters = NULL, parameters_sub, __$null, service, eventsManager, isShared, instance, _0, _5, _2$$3, _3$$4, _4$$4, _7$$5, _8$$7, _9$$7, _10$$9, _12$$12, _16$$18; - zval name, _11$$9, _13$$12; + zval *asAlias_param = NULL; + zval asAlias; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_11$$9); - ZVAL_UNDEF(&_13$$12); - ZVAL_UNDEF(¶meters_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&service); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&isShared); - ZVAL_UNDEF(&instance); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_10$$9); - ZVAL_UNDEF(&_12$$12); - ZVAL_UNDEF(&_16$$18); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&asAlias); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(parameters) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(asAlias) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, ¶meters); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!parameters) { - parameters = ¶meters_sub; - parameters = &__$null; - } - - - ZEPHIR_INIT_VAR(&instance); - ZVAL_NULL(&instance); - ZEPHIR_OBS_VAR(&service); - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&service, &_0, &name, 0)) { - ZEPHIR_CALL_METHOD(&isShared, &service, "isshared", NULL, 0); - zephir_check_call_status(); - _1$$3 = zephir_is_true(&isShared); - if (_1$$3) { - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("sharedInstances"), PH_NOISY_CC | PH_READONLY); - _1$$3 = zephir_array_isset(&_2$$3, &name); - } - if (_1$$3) { - zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("sharedInstances"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4$$4, &_3$$4, &name, PH_NOISY | PH_READONLY, "phalcon/Di/Di.zep", 181); - RETURN_CTOR(&_4$$4); - } - } - zephir_read_property(&_5, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_5); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_6$$5); - zephir_create_array(&_6$$5, 2, 0); - zephir_array_update_string(&_6$$5, SL("name"), &name, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_6$$5, SL("parameters"), parameters, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(&_7$$5); - ZVAL_STRING(&_7$$5, "di:beforeServiceResolve"); - ZEPHIR_CALL_METHOD(&instance, &eventsManager, "fire", NULL, 0, &_7$$5, this_ptr, &_6$$5); - zephir_check_call_status(); - } - if (Z_TYPE_P(&instance) != IS_OBJECT) { - if (Z_TYPE_P(&service) != IS_NULL) { - - /* try_start_1: */ - - ZEPHIR_CALL_METHOD(&instance, &service, "resolve", NULL, 0, parameters, this_ptr); - zephir_check_call_status_or_jump(try_end_1); - - try_end_1: - - if (EG(exception)) { - ZEPHIR_INIT_VAR(&_8$$7); - ZVAL_OBJ(&_8$$7, EG(exception)); - Z_ADDREF_P(&_8$$7); - ZEPHIR_INIT_VAR(&_9$$7); - if (zephir_instance_of_ev(&_8$$7, phalcon_di_exception_serviceresolutionexception_ce)) { - zend_clear_exception(); - ZEPHIR_CPY_WRT(&_9$$7, &_8$$7); - ZEPHIR_INIT_VAR(&_10$$9); - object_init_ex(&_10$$9, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_11$$9); - ZEPHIR_CONCAT_SVS(&_11$$9, "Service '", &name, "' cannot be resolved"); - ZEPHIR_CALL_METHOD(NULL, &_10$$9, "__construct", NULL, 29, &_11$$9); - zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$9, "phalcon/Di/Di.zep", 210); - ZEPHIR_MM_RESTORE(); - return; - } - } - if (zephir_is_true(&isShared)) { - zephir_update_property_array(this_ptr, SL("sharedInstances"), &name, &instance); - } - } else { - if (UNEXPECTED(!(zephir_class_exists(&name, 1)))) { - ZEPHIR_INIT_VAR(&_12$$12); - object_init_ex(&_12$$12, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_13$$12); - ZEPHIR_CONCAT_SVS(&_13$$12, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_12$$12, "__construct", NULL, 29, &_13$$12); - zephir_check_call_status(); - zephir_throw_exception_debug(&_12$$12, "phalcon/Di/Di.zep", 225); - ZEPHIR_MM_RESTORE(); - return; - } - _14$$11 = Z_TYPE_P(parameters) == IS_ARRAY; - if (_14$$11) { - _14$$11 = ((zephir_fast_count_int(parameters)) ? 1 : 0); - } - if (_14$$11) { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &name, parameters); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &name); - zephir_check_call_status(); - } - } - } - if (Z_TYPE_P(&instance) == IS_OBJECT) { - if (zephir_instance_of_ev(&instance, phalcon_di_injectionawareinterface_ce)) { - ZEPHIR_CALL_METHOD(NULL, &instance, "setdi", NULL, 0, this_ptr); - zephir_check_call_status(); - } - if (zephir_instance_of_ev(&instance, phalcon_di_initializationawareinterface_ce)) { - ZEPHIR_CALL_METHOD(NULL, &instance, "initialize", NULL, 0); - zephir_check_call_status(); - } - } - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_15$$18); - zephir_create_array(&_15$$18, 3, 0); - zephir_array_update_string(&_15$$18, SL("name"), &name, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_15$$18, SL("parameters"), parameters, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_15$$18, SL("instance"), &instance, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_VAR(&_16$$18); - ZVAL_STRING(&_16$$18, "di:afterServiceResolve"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_16$$18, this_ptr, &_15$$18); - zephir_check_call_status(); - } - RETURN_CCTOR(&instance); -} - -static PHP_METHOD(Phalcon_Di_Di, getDefault) -{ - zval _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - - zephir_read_static_property_ce(&_0, phalcon_di_di_ce, SL("defaultDi"), PH_NOISY_CC | PH_READONLY); - RETURN_CTORW(&_0); -} - -static PHP_METHOD(Phalcon_Di_Di, getInternalEventsManager) -{ - zval *this_ptr = getThis(); - + zephir_fetch_params(1, 1, 0, &asAlias_param); + zephir_get_strval(&asAlias, asAlias_param); - RETURN_MEMBER(getThis(), "eventsManager"); + zephir_update_property_zval(this_ptr, ZEND_STRL("asAlias"), &asAlias); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, getRaw) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, appendHaving) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, service, _0, _1$$3; - zval name, _2$$3; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&service); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!type_param) { + type = -1; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - ZEPHIR_OBS_VAR(&service); - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&service, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Di/Di.zep", 295); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_METHOD(&service, "getdefinition", NULL, 0); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HAVING"); + ZVAL_LONG(&_1, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendcondition", NULL, 0, &_0, &condition, value, &_1); zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, getService) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, appendJoin) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, service, _0, _1$$3; - zval name, _2$$3; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, end, key, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _0$$3, _1$$3, _2$$3; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&service); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&end); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!type_param) { + type = -1; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - ZEPHIR_OBS_VAR(&service); - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(!(zephir_array_isset_fetch(&service, &_0, &name, 0)))) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Service '", &name, "' was not found in the dependency injection container"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 29, &_2$$3); + if (!(ZEPHIR_IS_EMPTY(value))) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_2$$3, type); + ZEPHIR_CALL_METHOD(&_1$$3, &_0$$3, "bindinline", NULL, 0, value, &_2$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/Di/Di.zep", 311); - ZEPHIR_MM_RESTORE(); - return; + zephir_concat_self(&condition, &_1$$3); } - RETURN_CCTOR(&service); + zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_4, &_3, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 158); + ZEPHIR_CALL_FUNCTION(&end, "array_key_last", NULL, 39, &_4); + zephir_check_call_status(); + zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_6, &_5, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); + zephir_array_fetch(&_7, &_6, &end, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_7); + zephir_check_call_status(); + zephir_read_property(&_8, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_9, &_8, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); + zephir_array_fetch(&_10, &_9, &end, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); + zephir_array_fetch(&_11, &_10, &key, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); + ZEPHIR_INIT_VAR(&_12); + ZEPHIR_CONCAT_VV(&_12, &_11, &condition); + zephir_update_property_array_multi(this_ptr, SL("store"), &_12, SL("szz"), 4, SL("FROM"), &end, &key); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, getServices) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, columns) { + zval _0, _1, _2, _3, _4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); - RETURN_MEMBER(getThis(), "services"); + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 177); + ZEPHIR_INIT_VAR(&_3); + zephir_get_args(&_3); + zephir_fast_array_merge(&_0, &_2, &_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "COLUMNS"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, getShared) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, distinct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *parameters = NULL, parameters_sub, __$null, instance, _0; - zval name; + zval *enable_param = NULL, _0, _1; + zend_bool enable; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(¶meters_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&instance); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(parameters) + Z_PARAM_BOOL(enable) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, ¶meters); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 0, 1, &enable_param); + if (!enable_param) { + enable = 1; } else { - ZEPHIR_INIT_VAR(&name); - } - if (!parameters) { - parameters = ¶meters_sub; - parameters = &__$null; + enable = zephir_get_boolval(enable_param); } - ZEPHIR_OBS_VAR(&instance); - zephir_read_property(&_0, this_ptr, ZEND_STRL("sharedInstances"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&instance, &_0, &name, 0))) { - ZEPHIR_CALL_METHOD(&instance, this_ptr, "get", NULL, 0, &name, parameters); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("sharedInstances"), &name, &instance); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "DISTINCT"); + if (enable) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); } - RETURN_CCTOR(&instance); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setflag", NULL, 0, &_0, &_1); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, loadFromConfig) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, from) { - zend_bool _4$$3, _8$$4; - zend_string *_3; - zend_ulong _2; + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *config, config_sub, services, name, service, *_0, _1, _5$$3, _6$$3, _9$$4, _10$$4; + zval *table_param = NULL; + zval table; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config_sub); - ZVAL_UNDEF(&services); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&service); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(config, phalcon_config_configinterface_ce) + Z_PARAM_STR(table) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &config); + zephir_fetch_params(1, 1, 0, &table_param); + zephir_get_strval(&table, table_param); - ZEPHIR_CALL_METHOD(&services, config, "toarray", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&services, 0, "phalcon/Di/Di.zep", 361); - if (Z_TYPE_P(&services) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&services), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&name); - if (_3 != NULL) { - ZVAL_STR_COPY(&name, _3); - } else { - ZVAL_LONG(&name, _2); - } - ZEPHIR_INIT_NVAR(&service); - ZVAL_COPY(&service, _0); - _4$$3 = zephir_array_isset_string(&service, SL("shared")); - if (_4$$3) { - ZEPHIR_OBS_NVAR(&_5$$3); - zephir_array_fetch_string(&_5$$3, &service, SL("shared"), PH_NOISY, "phalcon/Di/Di.zep", 359); - _4$$3 = zephir_is_true(&_5$$3); - } - ZVAL_BOOL(&_6$$3, _4$$3); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", &_7, 0, &name, &service, &_6$$3); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + zephir_array_fast_append(&_0, &table); + zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("FROM")); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Select, forUpdate) +{ + zval *enable_param = NULL, __$true, __$false; + zend_bool enable; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(enable) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(0, 1, &enable_param); + if (!enable_param) { + enable = 1; } else { - ZEPHIR_CALL_METHOD(NULL, &services, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &services, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &services, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&service, &services, "current", NULL, 0); - zephir_check_call_status(); - _8$$4 = zephir_array_isset_string(&service, SL("shared")); - if (_8$$4) { - ZEPHIR_OBS_NVAR(&_9$$4); - zephir_array_fetch_string(&_9$$4, &service, SL("shared"), PH_NOISY, "phalcon/Di/Di.zep", 359); - _8$$4 = zephir_is_true(&_9$$4); - } - ZVAL_BOOL(&_10$$4, _8$$4); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "set", &_7, 0, &name, &service, &_10$$4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &services, "next", NULL, 0); - zephir_check_call_status(); - } + enable = zephir_get_boolval(enable_param); } - ZEPHIR_INIT_NVAR(&service); - ZEPHIR_INIT_NVAR(&name); - ZEPHIR_MM_RESTORE(); + + + if (enable) { + zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$false); + } + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Di_Di, loadFromPhp) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, getStatement) { + zval _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *filePath_param = NULL, services; - zval filePath; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filePath); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("UNION"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 231); + zephir_fast_join_str(&_0, SL(""), &_2); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "getcurrentstatement", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CONCAT_VV(return_value, &_0, &_3); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Select, groupBy) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *groupBy, groupBy_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&groupBy_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(filePath) + Z_PARAM_ZVAL(groupBy) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &filePath_param); - if (UNEXPECTED(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(filePath_param) == IS_STRING)) { - zephir_get_strval(&filePath, filePath_param); - } else { - ZEPHIR_INIT_VAR(&filePath); - } + zephir_fetch_params(1, 1, 0, &groupBy); - ZEPHIR_INIT_VAR(&services); - object_init_ex(&services, phalcon_config_adapter_php_ce); - ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 75, &filePath); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "loadfromconfig", NULL, 0, &services); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "GROUP"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processvalue", NULL, 0, &_0, groupBy); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, loadFromYaml) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, hasColumns) +{ + zval _0, _1; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 255); + RETURN_BOOL(zephir_fast_count_int(&_1) > 0); +} + +static PHP_METHOD(Phalcon_DataMapper_Query_Select, having) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval callbacks; - zval *filePath_param = NULL, *callbacks_param = NULL, services; - zval filePath; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filePath); - ZVAL_UNDEF(&services); - ZVAL_UNDEF(&callbacks); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(filePath) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY_OR_NULL(callbacks) + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &filePath_param, &callbacks_param); - if (UNEXPECTED(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(filePath_param) == IS_STRING)) { - zephir_get_strval(&filePath, filePath_param); - } else { - ZEPHIR_INIT_VAR(&filePath); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (!callbacks_param) { - ZEPHIR_INIT_VAR(&callbacks); + if (!type_param) { + type = -1; } else { - ZEPHIR_OBS_COPY_OR_DUP(&callbacks, callbacks_param); + type = zephir_get_intval(type_param); } - ZEPHIR_INIT_VAR(&services); - object_init_ex(&services, phalcon_config_adapter_yaml_ce); - ZEPHIR_CALL_METHOD(NULL, &services, "__construct", NULL, 76, &filePath, &callbacks); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "loadfromconfig", NULL, 0, &services); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HAVING"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "AND "); + ZVAL_LONG(&_2, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, has) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, join) { + zend_bool _5, _10; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _0; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *join_param = NULL, *table_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, key, _0, _1, _2, _3, _4, _6, _7, _8, _9, _11, _12, _13, _14, _19, _20, _16$$5, _17$$5, _18$$5; + zval join, table, condition, _21, _15$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&join); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&_21); + ZVAL_UNDEF(&_15$$4); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_13); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_19); + ZVAL_UNDEF(&_20); + ZVAL_UNDEF(&_16$$5); + ZVAL_UNDEF(&_17$$5); + ZVAL_UNDEF(&_18$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_STR(join) + Z_PARAM_STR(table) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 3, 2, &join_param, &table_param, &condition_param, &value, &type_param); + zephir_get_strval(&join, join_param); + zephir_get_strval(&table, table_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!type_param) { + type = -1; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); + ZEPHIR_INIT_VAR(&_0); + zephir_fast_trim(&_0, &join, NULL , ZEPHIR_TRIM_BOTH); + ZEPHIR_INIT_NVAR(&join); + zephir_fast_strtoupper(&join, &_0); + ZVAL_LONG(&_1, -4); + ZEPHIR_INIT_VAR(&_2); + zephir_substr(&_2, &join, -4 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + if (!ZEPHIR_IS_STRING_IDENTICAL(&_2, "JOIN")) { + zephir_concat_self_str(&join, " JOIN", sizeof(" JOIN") - 1); + } + ZEPHIR_INIT_VAR(&_3); + zephir_fast_trim(&_3, &condition, NULL , ZEPHIR_TRIM_LEFT); + zephir_get_strval(&condition, &_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, ""); + _5 = !ZEPHIR_IS_IDENTICAL(&_4, &condition); + if (_5) { + ZEPHIR_INIT_VAR(&_6); + ZVAL_LONG(&_7, 0); + ZVAL_LONG(&_8, 3); + ZEPHIR_INIT_VAR(&_9); + zephir_substr(&_9, &condition, 0 , 3 , 0); + zephir_fast_strtoupper(&_6, &_9); + _5 = !ZEPHIR_IS_STRING_IDENTICAL(&_6, "ON "); + } + _10 = _5; + if (_10) { + ZEPHIR_INIT_VAR(&_11); + ZVAL_LONG(&_12, 0); + ZVAL_LONG(&_13, 6); + ZEPHIR_INIT_VAR(&_14); + zephir_substr(&_14, &condition, 0 , 6 , 0); + zephir_fast_strtoupper(&_11, &_14); + _10 = !ZEPHIR_IS_STRING_IDENTICAL(&_11, "USING "); + } + if (_10) { + ZEPHIR_INIT_VAR(&_15$$4); + ZEPHIR_CONCAT_SV(&_15$$4, "ON ", &condition); + ZEPHIR_CPY_WRT(&condition, &_15$$4); + } + if (!(ZEPHIR_IS_EMPTY(value))) { + zephir_read_property(&_16$$5, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_18$$5, type); + ZEPHIR_CALL_METHOD(&_17$$5, &_16$$5, "bindinline", NULL, 0, value, &_18$$5); + zephir_check_call_status(); + zephir_concat_self(&condition, &_17$$5); + } + zephir_read_property(&_19, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_20, &_19, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 316); + ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 39, &_20); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_21); + ZEPHIR_CONCAT_VSVSV(&_21, &join, " ", &table, " ", &condition); + zephir_update_property_array_multi(this_ptr, SL("store"), &_21, SL("sza"), 4, SL("FROM"), &key); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, offsetGet) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, orHaving) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval name_sub; - zval *name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; + zval condition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name_sub); + ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(name) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(condition) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name); + zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); + zephir_get_strval(&condition, condition_param); + if (!value) { + value = &value_sub; + value = &__$null; + } + if (!type_param) { + type = -1; + } else { + type = zephir_get_intval(type_param); + } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getshared", NULL, 0, name); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HAVING"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "OR "); + ZVAL_LONG(&_2, type); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, offsetExists) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, reset) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval __$true, __$false, _1; zend_long ZEPHIR_LAST_CALL_STATUS; - zval name_sub; - zval *name; + zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(name) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "has", NULL, 0, name); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_select_ce, getThis(), "reset", &_0, 0); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, ""); + zephir_update_property_zval(this_ptr, ZEND_STRL("asAlias"), &_1); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$false); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, offsetSet) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, subSelect) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval name_sub, definition_sub; - zval *name, *definition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name_sub); - ZVAL_UNDEF(&definition_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ZVAL(name) - Z_PARAM_ZVAL(definition) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name, &definition); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setshared", NULL, 0, name, definition); + object_init_ex(return_value, phalcon_datamapper_query_select_ce); + zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 208, &_0, &_1); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Di, offsetUnset) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, union) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval name_sub; - zval *name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(name) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "remove", NULL, 0, name); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, " UNION "); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcurrentstatement", NULL, 0, &_1); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("UNION")); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, register) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, unionAll) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *provider, provider_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&provider_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(provider, phalcon_di_serviceproviderinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &provider); - - ZEPHIR_CALL_METHOD(NULL, provider, "register", NULL, 0, this_ptr); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, " UNION ALL "); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcurrentstatement", NULL, 0, &_1); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("UNION")); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, remove) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, getCurrentStatement) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, services, _0, sharedInstances; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *suffix_param = NULL, statement, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13$$4, _14$$4; + zval suffix, forUpdate; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&suffix); + ZVAL_UNDEF(&forUpdate); + ZVAL_UNDEF(&statement); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&sharedInstances); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_13$$4); + ZVAL_UNDEF(&_14$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(suffix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 0, 1, &suffix_param); + if (!suffix_param) { + ZEPHIR_INIT_VAR(&suffix); + ZVAL_STRING(&suffix, ""); } else { - ZEPHIR_INIT_VAR(&name); + zephir_get_strval(&suffix, suffix_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&services, &_0); - zephir_array_unset(&services, &name, PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("services"), &services); - zephir_read_property(&_0, this_ptr, ZEND_STRL("sharedInstances"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&sharedInstances, &_0); - zephir_array_unset(&sharedInstances, &name, PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("sharedInstances"), &sharedInstances); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&forUpdate); + zephir_read_property(&_0, this_ptr, ZEND_STRL("forUpdate"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_0)) { + ZEPHIR_INIT_NVAR(&forUpdate); + ZVAL_STRING(&forUpdate, " FOR UPDATE"); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "buildflags", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "buildlimitearly", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 209); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildfrom", NULL, 210); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_6); + ZVAL_STRING(&_6, "WHERE"); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "buildcondition", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_6); + ZVAL_STRING(&_6, "GROUP"); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "buildby", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_6); + ZVAL_STRING(&_6, "HAVING"); + ZEPHIR_CALL_METHOD(&_8, this_ptr, "buildcondition", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_6); + ZVAL_STRING(&_6, "ORDER"); + ZEPHIR_CALL_METHOD(&_9, this_ptr, "buildby", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_10, this_ptr, "buildlimit", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&statement); + ZEPHIR_CONCAT_SVVVVVVVVVV(&statement, "SELECT", &_1, &_2, &_3, &_4, &_5, &_7, &_8, &_9, &_10, &forUpdate); + zephir_read_property(&_11, this_ptr, ZEND_STRL("asAlias"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_12); + ZVAL_STRING(&_12, ""); + if (UNEXPECTED(!ZEPHIR_IS_IDENTICAL(&_12, &_11))) { + zephir_read_property(&_13$$4, this_ptr, ZEND_STRL("asAlias"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_14$$4); + ZEPHIR_CONCAT_SVSV(&_14$$4, "(", &statement, ") AS ", &_13$$4); + ZEPHIR_CPY_WRT(&statement, &_14$$4); + } + ZEPHIR_CONCAT_VV(return_value, &statement, &suffix); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Di, reset) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, buildColumns) { - zval __$null; + zval columns, _0, _3, _1$$3, _2$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZEPHIR_MM_GROW(); - zephir_update_static_property_ce(phalcon_di_di_ce, ZEND_STRL("defaultDi"), &__$null); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "hascolumns", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_0))) { + ZEPHIR_INIT_VAR(&columns); + zephir_create_array(&columns, 1, 0); + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "*"); + zephir_array_fast_append(&columns, &_1$$3); + } else { + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_NVAR(&columns); + zephir_array_fetch_string(&columns, &_2$$4, SL("COLUMNS"), PH_NOISY, "phalcon/DataMapper/Query/Select.zep", 442); + } + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, ","); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "indent", NULL, 0, &columns, &_3); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Di, set) +static PHP_METHOD(Phalcon_DataMapper_Query_Select, buildFrom) { + zval from; + zval table, _0, _1, _2, _3, *_4, _5, _14, _15, _6$$4, _8$$4, _10$$4, _11$$5, _12$$5, _13$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool shared; - zval *name_param = NULL, *definition, definition_sub, *shared_param = NULL, _0, _1, _2, _3; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition_sub); + ZVAL_UNDEF(&table); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(definition) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(shared) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_11$$5); + ZVAL_UNDEF(&_12$$5); + ZVAL_UNDEF(&_13$$5); + ZVAL_UNDEF(&from); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &name_param, &definition, &shared_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!shared_param) { - shared = 0; - } else { - shared = zephir_get_boolval(shared_param); - } - - ZEPHIR_INIT_VAR(&_0); - object_init_ex(&_0, phalcon_di_service_ce); - if (shared) { - ZVAL_BOOL(&_1, 1); + ZEPHIR_INIT_VAR(&from); + array_init(&from); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 458); + if (ZEPHIR_IS_EMPTY(&_1)) { + RETURN_MM_STRING(""); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_3, &_2, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 462); + zephir_is_iterable(&_3, 0, "phalcon/DataMapper/Query/Select.zep", 466); + if (Z_TYPE_P(&_3) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_3), _4) + { + ZEPHIR_INIT_NVAR(&table); + ZVAL_COPY(&table, _4); + ZEPHIR_MAKE_REF(&table); + ZEPHIR_CALL_FUNCTION(&_6$$4, "array_shift", &_7, 21, &table); + ZEPHIR_UNREF(&table); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_8$$4, this_ptr, "indent", &_9, 0, &table); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_10$$4); + ZEPHIR_CONCAT_VV(&_10$$4, &_6$$4, &_8$$4); + zephir_array_append(&from, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Select.zep", 463); + } ZEND_HASH_FOREACH_END(); } else { - ZVAL_BOOL(&_1, 0); + ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_5)) { + break; + } + ZEPHIR_CALL_METHOD(&table, &_3, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MAKE_REF(&table); + ZEPHIR_CALL_FUNCTION(&_11$$5, "array_shift", &_7, 21, &table); + ZEPHIR_UNREF(&table); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "indent", &_9, 0, &table); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_13$$5); + ZEPHIR_CONCAT_VV(&_13$$5, &_11$$5, &_12$$5); + zephir_array_append(&from, &_13$$5, PH_SEPARATE, "phalcon/DataMapper/Query/Select.zep", 463); + ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); + zephir_check_call_status(); + } } - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 74, definition, &_1); + ZEPHIR_INIT_NVAR(&table); + ZEPHIR_INIT_VAR(&_15); + ZVAL_STRING(&_15, ","); + ZEPHIR_CALL_METHOD(&_14, this_ptr, "indent", &_9, 0, &from, &_15); zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("services"), &name, &_0); - zephir_read_property(&_2, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_3, &_2, &name, PH_NOISY | PH_READONLY, "phalcon/Di/Di.zep", 552); - RETURN_CTOR(&_3); + ZEPHIR_CONCAT_SV(return_value, " FROM", &_14); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Di, setDefault) -{ - zval *container, container_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&container_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - zephir_fetch_params_without_memory_grow(1, 0, &container); - zephir_update_static_property_ce(phalcon_di_di_ce, ZEND_STRL("defaultDi"), container); + +ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Update) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Update, phalcon, datamapper_query_update, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_update_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Di_Di, setInternalEventsManager) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, __construct) { - zval *eventsManager, eventsManager_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&eventsManager_sub); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&bind_sub); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &connection, &bind); - zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_update_ce, getThis(), "__construct", &_0, 0, connection, bind); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Di_Di, setService) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, column) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *rawDefinition, rawDefinition_sub; - zval name; + zend_long type, ZEPHIR_LAST_CALL_STATUS; + zval *column_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _1$$3, _2$$3; + zval column, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&rawDefinition_sub); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_OBJECT_OF_CLASS(rawDefinition, phalcon_di_serviceinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(column) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) + Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &rawDefinition); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 1, 2, &column_param, &value, &type_param); + zephir_get_strval(&column, column_param); + if (!value) { + value = &value_sub; + value = &__$null; } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (!type_param) { + type = -1; } else { - ZEPHIR_INIT_VAR(&name); + type = zephir_get_intval(type_param); } - zephir_update_property_array(this_ptr, SL("services"), &name, rawDefinition); - RETVAL_ZVAL(rawDefinition, 1, 0); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_SV(&_0, ":", &column); + zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sz"), 3, SL("COLUMNS"), &column); + if (Z_TYPE_P(value) != IS_NULL) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_2$$3, type); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "setvalue", NULL, 0, &column, value, &_2$$3); + zephir_check_call_status(); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Di, setShared) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, columns) { + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *definition, definition_sub, _0; - zval name; + zval *columns_param = NULL, column, value, *_0, _1; + zval columns; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(definition) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columns) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - - - ZVAL_BOOL(&_0, 1); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "set", NULL, 0, &name, definition, &_0); - zephir_check_call_status(); - RETURN_MM(); -} + zephir_fetch_params(1, 1, 0, &columns_param); + zephir_get_arrval(&columns, columns_param); -zend_object *zephir_init_properties_Phalcon_Di_Di(zend_class_entry *class_type) -{ - zval _0, _2, _1$$3, _3$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("sharedInstances"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("sharedInstances"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("services"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("services"), &_3$$4); + zephir_is_iterable(&columns, 0, "phalcon/DataMapper/Query/Update.zep", 76); + if (Z_TYPE_P(&columns) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columns), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&column); + if (_3 != NULL) { + ZVAL_STR_COPY(&column, _3); + } else { + ZVAL_LONG(&column, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + if (Z_TYPE_P(&column) == IS_LONG) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); + zephir_check_call_status(); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &columns, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&column, &columns, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &columns, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&column) == IS_LONG) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&column); + RETURN_THIS(); } - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Di_DiInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, DiInterface, phalcon, di_diinterface, phalcon_di_diinterface_method_entry); - - zend_class_implements(phalcon_di_diinterface_ce, 1, zend_ce_arrayaccess); - return SUCCESS; -} - -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, attempt); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, get); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getDefault); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getRaw); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getService); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getServices); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getShared); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, has); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, remove); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, reset); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, set); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setDefault); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setService); -ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setShared); - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Di_Exception) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, from) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di, Exception, phalcon, di_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; -} - - - + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *table_param = NULL, _0; + zval table; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &table_param); + zephir_get_strval(&table, table_param); - -ZEPHIR_INIT_CLASS(Phalcon_Di_FactoryDefault) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di, FactoryDefault, phalcon, di_factorydefault, phalcon_di_di_ce, phalcon_di_factorydefault_method_entry, 0); - - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "FROM"); + zephir_update_property_array(this_ptr, SL("store"), &_0, &table); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, getStatement) { - zval _1, _5, _6, _7, _9; - zval filter, _2, _3, _4, _8; + zval _0, _1, _2, _3, _4, _5, _6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_9); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_PARENT(NULL, phalcon_di_factorydefault_ce, getThis(), "__construct", &_0, 0); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&filter); - object_init_ex(&filter, phalcon_filter_filterfactory_ce); - if (zephir_has_constructor(&filter)) { - ZEPHIR_CALL_METHOD(NULL, &filter, "__construct", NULL, 0); - zephir_check_call_status(); - } - - ZEPHIR_INIT_VAR(&_1); - zephir_create_array(&_1, 20, 0); - ZEPHIR_INIT_VAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 101); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 211); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); ZEPHIR_INIT_VAR(&_5); - zephir_create_array(&_5, 2, 0); - add_assoc_stringl_ex(&_5, SL("className"), SL("Phalcon\\Assets\\Manager")); - ZEPHIR_INIT_VAR(&_6); - zephir_create_array(&_6, 1, 0); - ZEPHIR_INIT_VAR(&_7); - zephir_create_array(&_7, 2, 0); - add_assoc_stringl_ex(&_7, SL("type"), SL("service")); - add_assoc_stringl_ex(&_7, SL("name"), SL("tag")); - zephir_array_fast_append(&_6, &_7); - zephir_array_update_string(&_5, SL("arguments"), &_6, PH_COPY | PH_SEPARATE); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_5, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("assets"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Encryption\\Crypt"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("crypt"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Http\\Response\\Cookies"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("cookies"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Dispatcher"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Html\\Escaper"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Flash\\Direct"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("flash"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Flash\\Session"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("flashSession"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_CALL_METHOD(&_8, &filter, "newinstance", NULL, 90); - zephir_check_call_status(); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_8, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Support\\HelperFactory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("helper"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Http\\Request"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("request"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Http\\Response"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("response"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Router"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Encryption\\Security"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_6); - zephir_create_array(&_6, 2, 0); - add_assoc_stringl_ex(&_6, SL("className"), SL("Phalcon\\Html\\TagFactory")); - ZEPHIR_INIT_NVAR(&_7); - zephir_create_array(&_7, 1, 0); - ZEPHIR_INIT_VAR(&_9); - zephir_create_array(&_9, 2, 0); - add_assoc_stringl_ex(&_9, SL("type"), SL("service")); - add_assoc_stringl_ex(&_9, SL("name"), SL("escaper")); - zephir_array_fast_append(&_7, &_9); - zephir_array_update_string(&_6, SL("arguments"), &_7, PH_COPY | PH_SEPARATE); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_6, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("tag"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZVAL_STRING(&_5, "WHERE"); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildcondition", NULL, 0, &_5); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Url"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_CALL_METHOD(&_6, this_ptr, "buildreturning", NULL, 0); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("url"), &_2, PH_COPY | PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("services"), &_1); - ZEPHIR_MM_RESTORE(); + ZEPHIR_CONCAT_SVSVVVV(return_value, "UPDATE", &_0, " ", &_2, &_3, &_4, &_6); + RETURN_MM(); } +static PHP_METHOD(Phalcon_DataMapper_Query_Update, hasColumns) +{ + zval _0, _1; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Di_InitializationAwareInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, InitializationAwareInterface, phalcon, di_initializationawareinterface, phalcon_di_initializationawareinterface_method_entry); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 113); + RETURN_BOOL(zephir_fast_count_int(&_1) > 0); } -ZEPHIR_DOC_METHOD(Phalcon_Di_InitializationAwareInterface, initialize); - - +static PHP_METHOD(Phalcon_DataMapper_Query_Update, returning) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *columns_param = NULL, _0, _1, _2, _3; + zval columns; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(columns) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &columns_param); + zephir_get_arrval(&columns, columns_param); - -ZEPHIR_INIT_CLASS(Phalcon_Di_Injectable) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Di, Injectable, phalcon, di_injectable, phalcon_di_injectable_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_di_injectable_ce, SL("container"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_di_injectable_ce, 1, phalcon_di_injectionawareinterface_ce); - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 126); + zephir_fast_array_merge(&_0, &_2, &columns); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Injectable, __get) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, reset) { - zval _2$$4; + zval _1, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *propertyName_param = NULL, container, service, _0, _1$$4, _3$$4, _4$$4; - zval propertyName, _5; + zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&propertyName); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&container); - ZVAL_UNDEF(&service); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_2$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(propertyName) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &propertyName_param); - if (UNEXPECTED(Z_TYPE_P(propertyName_param) != IS_STRING && Z_TYPE_P(propertyName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'propertyName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(propertyName_param) == IS_STRING)) { - zephir_get_strval(&propertyName, propertyName_param); - } else { - ZEPHIR_INIT_VAR(&propertyName); - } - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&container, &_0); - if (ZEPHIR_IS_STRING_IDENTICAL(&propertyName, "di")) { - zephir_update_property_zval(this_ptr, ZEND_STRL("di"), &container); - RETURN_CCTOR(&container); - } - if (ZEPHIR_IS_STRING_IDENTICAL(&propertyName, "persistent")) { - ZEPHIR_INIT_VAR(&_2$$4); - zephir_create_array(&_2$$4, 2, 0); - ZEPHIR_INIT_VAR(&_3$$4); - zephir_get_class(&_3$$4, this_ptr, 0); - zephir_array_fast_append(&_2$$4, &_3$$4); - zephir_array_fast_append(&_2$$4, &container); - ZEPHIR_INIT_NVAR(&_3$$4); - ZVAL_STRING(&_3$$4, "sessionBag"); - ZEPHIR_CALL_METHOD(&_1$$4, &container, "get", NULL, 0, &_3$$4, &_2$$4); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("persistent"), &_1$$4); - ZEPHIR_OBS_VAR(&_4$$4); - zephir_read_property(&_4$$4, this_ptr, ZEND_STRL("persistent"), PH_NOISY_CC); - RETURN_CCTOR(&_4$$4); - } - ZEPHIR_CALL_METHOD(&_0, &container, "has", NULL, 0, &propertyName); - zephir_check_call_status(); - if (zephir_is_true(&_0)) { - ZEPHIR_CALL_METHOD(&service, &container, "getshared", NULL, 0, &propertyName); - zephir_check_call_status(); - zephir_update_property_zval_zval(this_ptr, &propertyName, &service); - RETURN_CCTOR(&service); - } - ZEPHIR_INIT_VAR(&_5); - ZEPHIR_CONCAT_SV(&_5, "Access to undefined property ", &propertyName); - ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 7, &_5); + ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_update_ce, getThis(), "reset", &_0, 0); zephir_check_call_status(); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "FROM"); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, ""); + zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); + ZEPHIR_INIT_VAR(&_3); + array_init(&_3); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "RETURNING"); + zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Di_Injectable, __isset) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, set) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0; - zval name; + zval *column_param = NULL, *value = NULL, value_sub, __$null, _0; + zval column; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&value_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(column) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 1, &column_param, &value); + zephir_get_strval(&column, column_param); + if (!value) { + value = &value_sub; + ZEPHIR_CPY_WRT(value, &__$null); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_SEPARATE_PARAM(value); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdi", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_0, "has", NULL, 0, &name); + if (Z_TYPE_P(value) == IS_NULL) { + ZEPHIR_INIT_NVAR(value); + ZVAL_STRING(value, "NULL"); + } + zephir_update_property_array_multi(this_ptr, SL("store"), value, SL("sz"), 3, SL("COLUMNS"), &column); + zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &column); zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Di_Injectable, getDI) +static PHP_METHOD(Phalcon_DataMapper_Query_Update, buildColumns) { - zval container, _0; + zend_string *_5; + zend_ulong _4; + zval assignments; + zval column, value, _0, _1, *_2, _3, _11, _12, _6$$3, _8$$3, _9$$4, _10$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container); + ZVAL_UNDEF(&column); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_8$$3); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&assignments); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&container, &_0); - if (Z_TYPE_P(&container) == IS_NULL) { - ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_1, 0); + ZEPHIR_INIT_VAR(&assignments); + array_init(&assignments); + zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 175); + zephir_is_iterable(&_1, 0, "phalcon/DataMapper/Query/Update.zep", 179); + if (Z_TYPE_P(&_1) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_1), _4, _5, _2) + { + ZEPHIR_INIT_NVAR(&column); + if (_5 != NULL) { + ZVAL_STR_COPY(&column, _5); + } else { + ZVAL_LONG(&column, _4); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _2); + ZEPHIR_CALL_METHOD(&_6$$3, this_ptr, "quoteidentifier", &_7, 0, &column); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$3); + ZEPHIR_CONCAT_VSV(&_8$$3, &_6$$3, " = ", &value); + zephir_array_append(&assignments, &_8$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Update.zep", 176); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "A dependency injection container is required to access internal services", "phalcon/Di/Injectable.zep", 125); - return; + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_1, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&column, &_1, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &_1, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "quoteidentifier", &_7, 0, &column); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_10$$4); + ZEPHIR_CONCAT_VSV(&_10$$4, &_9$$4, " = ", &value); + zephir_array_append(&assignments, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Update.zep", 176); + ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setdi", NULL, 0, &container); - zephir_check_call_status(); } - RETURN_CCTOR(&container); -} - -static PHP_METHOD(Phalcon_Di_Injectable, setDI) -{ - zval *container, container_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&container_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &container); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&column); + ZEPHIR_INIT_VAR(&_12); + ZVAL_STRING(&_12, ","); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "indent", NULL, 0, &assignments, &_12); + zephir_check_call_status(); + ZEPHIR_CONCAT_SV(return_value, " SET", &_11); + RETURN_MM(); } @@ -32595,411 +32375,424 @@ static PHP_METHOD(Phalcon_Di_Injectable, setDI) -ZEPHIR_INIT_CLASS(Phalcon_Di_InjectionAwareInterface) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Annotation) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, InjectionAwareInterface, phalcon, di_injectionawareinterface, phalcon_di_injectionawareinterface_method_entry); - - return SUCCESS; -} - -ZEPHIR_DOC_METHOD(Phalcon_Di_InjectionAwareInterface, setDI); -ZEPHIR_DOC_METHOD(Phalcon_Di_InjectionAwareInterface, getDI); - - - -#ifdef HAVE_CONFIG_H -#endif - - - - + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Annotation, phalcon, annotations_annotation, phalcon_annotations_annotation_method_entry, 0); -ZEPHIR_INIT_CLASS(Phalcon_Di_Service) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Di, Service, phalcon, di_service, phalcon_di_service_method_entry, 0); + zend_declare_property_null(phalcon_annotations_annotation_ce, SL("arguments"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_annotation_ce, SL("exprArguments"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_annotation_ce, SL("name"), ZEND_ACC_PROTECTED); + phalcon_annotations_annotation_ce->create_object = zephir_init_properties_Phalcon_Annotations_Annotation; - zend_declare_property_null(phalcon_di_service_ce, SL("definition"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_di_service_ce, SL("resolved"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_di_service_ce, SL("shared"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_di_service_ce, SL("sharedInstance"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_di_service_ce, 1, phalcon_di_serviceinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Di_Service, __construct) +static PHP_METHOD(Phalcon_Annotations_Annotation, __construct) { - zend_bool shared; - zval *definition, definition_sub, *shared_param = NULL, __$true, __$false; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *reflectionData_param = NULL, name, exprArguments, argument, resolvedArgument, _0$$3, *_1$$4, _2$$4, _3$$5, _5$$8; + zval reflectionData, arguments; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&reflectionData); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&exprArguments); + ZVAL_UNDEF(&argument); + ZVAL_UNDEF(&resolvedArgument); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_5$$8); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(definition) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(shared) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(reflectionData) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 1, &definition, &shared_param); - if (!shared_param) { - shared = 0; - } else { - shared = zephir_get_boolval(shared_param); - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &reflectionData_param); + ZEPHIR_OBS_COPY_OR_DUP(&reflectionData, reflectionData_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("definition"), definition); - if (shared) { - zephir_update_property_zval(this_ptr, ZEND_STRL("shared"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("shared"), &__$false); + ZEPHIR_OBS_VAR(&name); + if (zephir_array_isset_string_fetch(&name, &reflectionData, SL("name"), 0)) { + zephir_array_fetch_string(&_0$$3, &reflectionData, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 48); + zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &_0$$3); } + ZEPHIR_OBS_VAR(&exprArguments); + if (zephir_array_isset_string_fetch(&exprArguments, &reflectionData, SL("arguments"), 0)) { + ZEPHIR_INIT_VAR(&arguments); + array_init(&arguments); + zephir_is_iterable(&exprArguments, 0, "phalcon/Annotations/Annotation.zep", 69); + if (Z_TYPE_P(&exprArguments) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&exprArguments), _1$$4) + { + ZEPHIR_INIT_NVAR(&argument); + ZVAL_COPY(&argument, _1$$4); + zephir_array_fetch_string(&_3$$5, &argument, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 60); + ZEPHIR_CALL_METHOD(&resolvedArgument, this_ptr, "getexpression", &_4, 0, &_3$$5); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&name); + if (zephir_array_isset_string_fetch(&name, &argument, SL("name"), 0)) { + zephir_array_update_zval(&arguments, &name, &resolvedArgument, PH_COPY | PH_SEPARATE); + } else { + zephir_array_append(&arguments, &resolvedArgument, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 65); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &exprArguments, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$4, &exprArguments, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&argument, &exprArguments, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_fetch_string(&_5$$8, &argument, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 60); + ZEPHIR_CALL_METHOD(&resolvedArgument, this_ptr, "getexpression", &_4, 0, &_5$$8); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&name); + if (zephir_array_isset_string_fetch(&name, &argument, SL("name"), 0)) { + zephir_array_update_zval(&arguments, &name, &resolvedArgument, PH_COPY | PH_SEPARATE); + } else { + zephir_array_append(&arguments, &resolvedArgument, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 65); + } + ZEPHIR_CALL_METHOD(NULL, &exprArguments, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&argument); + zephir_update_property_zval(this_ptr, ZEND_STRL("arguments"), &arguments); + zephir_update_property_zval(this_ptr, ZEND_STRL("exprArguments"), &exprArguments); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Di_Service, getDefinition) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "definition"); -} - -static PHP_METHOD(Phalcon_Di_Service, getParameter) +static PHP_METHOD(Phalcon_Annotations_Annotation, getArgument) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *position_param = NULL, definition, arguments, parameter, _0; - zend_long position; + zval *position, position_sub, argument, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(¶meter); + ZVAL_UNDEF(&position_sub); + ZVAL_UNDEF(&argument); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(position) + Z_PARAM_ZVAL(position) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &position_param); - position = zephir_get_intval(position_param); + zephir_fetch_params_without_memory_grow(1, 0, &position); - zephir_read_property(&_0, this_ptr, ZEND_STRL("definition"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&definition, &_0); - if (UNEXPECTED(Z_TYPE_P(&definition) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Definition must be an array to obtain its parameters", "phalcon/Di/Service.zep", 82); - return; - } - if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 1)) { - if (zephir_array_isset_long_fetch(¶meter, &arguments, position, 1)) { - RETURN_CTOR(¶meter); - } + zephir_read_property(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&argument, &_0, position, 1)) { + RETURN_CTORW(&argument); } - RETURN_MM_NULL(); + RETURN_NULL(); } -static PHP_METHOD(Phalcon_Di_Service, isResolved) +static PHP_METHOD(Phalcon_Annotations_Annotation, getArguments) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "resolved"); + RETURN_MEMBER(getThis(), "arguments"); } -static PHP_METHOD(Phalcon_Di_Service, isShared) +static PHP_METHOD(Phalcon_Annotations_Annotation, getExprArguments) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "shared"); + RETURN_MEMBER(getThis(), "exprArguments"); } -static PHP_METHOD(Phalcon_Di_Service, resolve) +static PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) { - zend_class_entry *_4$$13; - zend_bool found = 0, _2$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *parameters = NULL, parameters_sub, *container = NULL, container_sub, __$true, __$false, __$null, shared, definition, sharedInstance, instance, builder, _0, _1$$3, _3$$13, _5$$20; + zval *expr_param = NULL, value, item, resolvedItem, arrayValue, name, type, _0$$7, *_1$$7, _2$$7, _3$$8, _5$$11, _6$$15, _7$$15; + zval expr; zval *this_ptr = getThis(); - ZVAL_UNDEF(¶meters_sub); - ZVAL_UNDEF(&container_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&shared); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&sharedInstance); - ZVAL_UNDEF(&instance); - ZVAL_UNDEF(&builder); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$13); - ZVAL_UNDEF(&_5$$20); + ZVAL_UNDEF(&expr); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&item); + ZVAL_UNDEF(&resolvedItem); + ZVAL_UNDEF(&arrayValue); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&_0$$7); + ZVAL_UNDEF(&_2$$7); + ZVAL_UNDEF(&_3$$8); + ZVAL_UNDEF(&_5$$11); + ZVAL_UNDEF(&_6$$15); + ZVAL_UNDEF(&_7$$15); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 2) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(parameters) - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(container, phalcon_di_diinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(expr) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, ¶meters, &container); - if (!parameters) { - parameters = ¶meters_sub; - parameters = &__$null; - } - if (!container) { - container = &container_sub; - container = &__$null; - } + zephir_fetch_params(1, 1, 0, &expr_param); + ZEPHIR_OBS_COPY_OR_DUP(&expr, expr_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("shared"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&shared, &_0); - if (zephir_is_true(&shared)) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("sharedInstance"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&sharedInstance, &_1$$3); - if (Z_TYPE_P(&sharedInstance) != IS_NULL) { - RETURN_CCTOR(&sharedInstance); + ZEPHIR_OBS_VAR(&type); + zephir_array_fetch_string(&type, &expr, SL("type"), PH_NOISY, "phalcon/Annotations/Annotation.zep", 111); + do { + if (ZEPHIR_IS_LONG(&type, 301) || ZEPHIR_IS_LONG(&type, 302) || ZEPHIR_IS_LONG(&type, 303) || ZEPHIR_IS_LONG(&type, 307)) { + ZEPHIR_OBS_VAR(&value); + zephir_array_fetch_string(&value, &expr, SL("value"), PH_NOISY, "phalcon/Annotations/Annotation.zep", 118); + break; } - } - found = 1; - ZEPHIR_INIT_VAR(&instance); - ZVAL_NULL(&instance); - zephir_read_property(&_0, this_ptr, ZEND_STRL("definition"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&definition, &_0); - if (Z_TYPE_P(&definition) == IS_STRING) { - if (zephir_class_exists(&definition, 1)) { - _2$$6 = Z_TYPE_P(parameters) == IS_ARRAY; - if (_2$$6) { - _2$$6 = ((zephir_fast_count_int(parameters)) ? 1 : 0); - } - if (_2$$6) { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &definition, parameters); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &definition); - zephir_check_call_status(); - } - } else { - found = 0; + if (ZEPHIR_IS_LONG(&type, 304)) { + ZEPHIR_INIT_NVAR(&value); + ZVAL_NULL(&value); + break; } - } else { - if (Z_TYPE_P(&definition) == IS_OBJECT) { - if (zephir_is_instance_of(&definition, SL("Closure"))) { - if (Z_TYPE_P(container) == IS_OBJECT) { - _4$$13 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); - ZEPHIR_CALL_CE_STATIC(&_3$$13, _4$$13, "bind", NULL, 0, &definition, container); + if (ZEPHIR_IS_LONG(&type, 305)) { + ZEPHIR_INIT_NVAR(&value); + ZVAL_BOOL(&value, 0); + break; + } + if (ZEPHIR_IS_LONG(&type, 306)) { + ZEPHIR_INIT_NVAR(&value); + ZVAL_BOOL(&value, 1); + break; + } + if (ZEPHIR_IS_LONG(&type, 308)) { + ZEPHIR_INIT_VAR(&arrayValue); + array_init(&arrayValue); + zephir_array_fetch_string(&_0$$7, &expr, SL("items"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 136); + zephir_is_iterable(&_0$$7, 0, "phalcon/Annotations/Annotation.zep", 148); + if (Z_TYPE_P(&_0$$7) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0$$7), _1$$7) + { + ZEPHIR_INIT_NVAR(&item); + ZVAL_COPY(&item, _1$$7); + zephir_array_fetch_string(&_3$$8, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 139); + ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 156, &_3$$8); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&definition, &_3$$13); - } - if (Z_TYPE_P(parameters) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_CALL_USER_FUNC_ARRAY(&instance, &definition, parameters); + ZEPHIR_OBS_NVAR(&name); + if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { + zephir_array_update_zval(&arrayValue, &name, &resolvedItem, PH_COPY | PH_SEPARATE); + } else { + zephir_array_append(&arrayValue, &resolvedItem, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 144); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0$$7, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$7, &_0$$7, "valid", NULL, 0); zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_CALL_USER_FUNC(&instance, &definition); + if (!zend_is_true(&_2$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&item, &_0$$7, "current", NULL, 0); zephir_check_call_status(); - } - } else { - ZEPHIR_CPY_WRT(&instance, &definition); - } - } else { - if (Z_TYPE_P(&definition) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&builder); - object_init_ex(&builder, phalcon_di_service_builder_ce); - if (zephir_has_constructor(&builder)) { - ZEPHIR_CALL_METHOD(NULL, &builder, "__construct", NULL, 0); + zephir_array_fetch_string(&_5$$11, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 139); + ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 156, &_5$$11); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&name); + if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { + zephir_array_update_zval(&arrayValue, &name, &resolvedItem, PH_COPY | PH_SEPARATE); + } else { + zephir_array_append(&arrayValue, &resolvedItem, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 144); + } + ZEPHIR_CALL_METHOD(NULL, &_0$$7, "next", NULL, 0); zephir_check_call_status(); } - - ZEPHIR_CALL_METHOD(&instance, &builder, "build", NULL, 221, container, &definition, parameters); - zephir_check_call_status(); - } else { - found = 0; } + ZEPHIR_INIT_NVAR(&item); + RETURN_CCTOR(&arrayValue); } - } - if (UNEXPECTED(found == 0)) { - ZEPHIR_INIT_VAR(&_5$$20); - object_init_ex(&_5$$20, phalcon_di_exception_serviceresolutionexception_ce); - ZEPHIR_CALL_METHOD(NULL, &_5$$20, "__construct", NULL, 29); + if (ZEPHIR_IS_LONG(&type, 300)) { + object_init_ex(return_value, phalcon_annotations_annotation_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 157, &expr); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&_6$$15); + object_init_ex(&_6$$15, phalcon_annotations_exception_ce); + ZEPHIR_INIT_VAR(&_7$$15); + ZEPHIR_CONCAT_SVS(&_7$$15, "The expression ", &type, " is unknown"); + ZEPHIR_CALL_METHOD(NULL, &_6$$15, "__construct", NULL, 32, &_7$$15); zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$20, "phalcon/Di/Service.zep", 202); + zephir_throw_exception_debug(&_6$$15, "phalcon/Annotations/Annotation.zep", 154); ZEPHIR_MM_RESTORE(); return; - } - if (zephir_is_true(&shared)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("sharedInstance"), &instance); - } - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("resolved"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("resolved"), &__$false); - } - RETURN_CCTOR(&instance); + } while(0); + + RETURN_CCTOR(&value); } -static PHP_METHOD(Phalcon_Di_Service, setDefinition) +static PHP_METHOD(Phalcon_Annotations_Annotation, getName) { - zval *definition, definition_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(definition) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &definition); - zephir_update_property_zval(this_ptr, ZEND_STRL("definition"), definition); + RETURN_MEMBER(getThis(), "name"); } -static PHP_METHOD(Phalcon_Di_Service, setParameter) +static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedArgument) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval parameter; - zval *position_param = NULL, *parameter_param = NULL, definition, arguments, _0, _1$$5; - zend_long position; + zval *name_param = NULL, argument, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&argument); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(¶meter); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_LONG(position) - Z_PARAM_ARRAY(parameter) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &position_param, ¶meter_param); - position = zephir_get_intval(position_param); - ZEPHIR_OBS_COPY_OR_DUP(¶meter, parameter_param); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("definition"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&definition, &_0); - if (UNEXPECTED(Z_TYPE_P(&definition) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Definition must be an array to update its parameters", "phalcon/Di/Service.zep", 237); - return; + zephir_fetch_params(1, 1, 0, &name_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); } - ZEPHIR_OBS_VAR(&arguments); - if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 0)) { - zephir_array_update_long(&arguments, position, ¶meter, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_INIT_VAR(&_1$$5); - zephir_create_array(&_1$$5, 1, 0); - zephir_array_update_long(&_1$$5, position, ¶meter, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); - ZEPHIR_CPY_WRT(&arguments, &_1$$5); + ZEPHIR_INIT_VAR(&name); } - zephir_array_update_string(&definition, SL("arguments"), &arguments, PH_COPY | PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("definition"), &definition); - RETURN_THIS(); + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&argument, &_0, &name, 1)) { + RETURN_CTOR(&argument); + } + RETURN_MM_NULL(); } -static PHP_METHOD(Phalcon_Di_Service, setShared) +static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedParameter) { - zval *shared_param = NULL, __$true, __$false; - zend_bool shared; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL; + zval name; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&name); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_BOOL(shared) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &shared_param); - shared = zephir_get_boolval(shared_param); - - - if (shared) { - zephir_update_property_zval(this_ptr, ZEND_STRL("shared"), &__$true); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("shared"), &__$false); + ZEPHIR_INIT_VAR(&name); } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getnamedargument", NULL, 0, &name); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Service, setSharedInstance) +static PHP_METHOD(Phalcon_Annotations_Annotation, hasArgument) { - zval *sharedInstance, sharedInstance_sub; + zval *position, position_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sharedInstance_sub); + ZVAL_UNDEF(&position_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(sharedInstance) + Z_PARAM_ZVAL(position) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &sharedInstance); + zephir_fetch_params_without_memory_grow(1, 0, &position); - zephir_update_property_zval(this_ptr, ZEND_STRL("sharedInstance"), sharedInstance); + zephir_read_property(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, position)); } +static PHP_METHOD(Phalcon_Annotations_Annotation, numberArguments) +{ + zval _0; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H -#endif - + ZVAL_UNDEF(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + RETURN_LONG(zephir_fast_count_int(&_0)); +} -ZEPHIR_INIT_CLASS(Phalcon_Di_ServiceInterface) +zend_object *zephir_init_properties_Phalcon_Annotations_Annotation(zend_class_entry *class_type) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, ServiceInterface, phalcon, di_serviceinterface, phalcon_di_serviceinterface_method_entry); + zval _0, _2, _1$$3, _3$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + - return SUCCESS; + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("exprArguments"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("exprArguments"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("arguments"), &_3$$4); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } } -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, getDefinition); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, getParameter); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, isResolved); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, isShared); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, resolve); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setDefinition); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setParameter); -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setShared); @@ -33010,2370 +32803,2286 @@ ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setShared); -ZEPHIR_INIT_CLASS(Phalcon_Di_ServiceProviderInterface) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_AnnotationsFactory) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, ServiceProviderInterface, phalcon, di_serviceproviderinterface, phalcon_di_serviceproviderinterface_method_entry); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations, AnnotationsFactory, phalcon, annotations_annotationsfactory, phalcon_factory_abstractfactory_ce, phalcon_annotations_annotationsfactory_method_entry, 0); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceProviderInterface, register); - - +static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *services_param = NULL; + zval services; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&services); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(services) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &services_param); + if (!services_param) { + ZEPHIR_INIT_VAR(&services); + array_init(&services); + } else { + ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); + } - -ZEPHIR_INIT_CLASS(Phalcon_Di_Exception_ServiceResolutionException) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di\\Exception, ServiceResolutionException, phalcon, di_exception_serviceresolutionexception, phalcon_di_exception_ce, NULL, 0); - - return SUCCESS; -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Di_FactoryDefault_Cli) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di\\FactoryDefault, Cli, phalcon, di_factorydefault_cli, phalcon_di_factorydefault_ce, phalcon_di_factorydefault_cli_method_entry, 0); - - return SUCCESS; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) +static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, load) { - zval _1, _6, _7, _8; - zval filter, _2, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; + zval *config = NULL, config_sub, name, options, _0, _1, _2, _3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&config_sub); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(config) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &config); + ZEPHIR_SEPARATE_PARAM(config); - ZEPHIR_CALL_PARENT(NULL, phalcon_di_factorydefault_cli_ce, getThis(), "__construct", &_0, 0); + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfig", NULL, 0, config); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&filter); - object_init_ex(&filter, phalcon_filter_filterfactory_ce); - if (zephir_has_constructor(&filter)) { - ZEPHIR_CALL_METHOD(NULL, &filter, "__construct", NULL, 0); + ZEPHIR_CPY_WRT(config, &_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "adapter"); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfigelement", NULL, 0, config, &_1); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(config, &_0); + ZEPHIR_OBS_VAR(&name); + zephir_array_fetch_string(&name, config, SL("adapter"), PH_NOISY, "phalcon/Annotations/AnnotationsFactory.zep", 48); + zephir_array_unset_string(config, SL("adapter"), PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_1); + object_init_ex(&_1, phalcon_support_helper_arr_get_ce); + if (zephir_has_constructor(&_1)) { + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_INIT_VAR(&_1); - zephir_create_array(&_1, 12, 0); ZEPHIR_INIT_VAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); + array_init(&_2); ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Cli\\Dispatcher"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Html\\Escaper"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_CALL_METHOD(&_5, &filter, "newinstance", NULL, 90); - zephir_check_call_status(); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_5, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Support\\HelperFactory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("helper"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Cli\\Router"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Encryption\\Security"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_VAR(&_6); - zephir_create_array(&_6, 2, 0); - add_assoc_stringl_ex(&_6, SL("className"), SL("Phalcon\\Html\\TagFactory")); - ZEPHIR_INIT_VAR(&_7); - zephir_create_array(&_7, 1, 0); - ZEPHIR_INIT_VAR(&_8); - zephir_create_array(&_8, 2, 0); - add_assoc_stringl_ex(&_8, SL("type"), SL("service")); - add_assoc_stringl_ex(&_8, SL("name"), SL("escaper")); - zephir_array_fast_append(&_7, &_8); - zephir_array_update_string(&_6, SL("arguments"), &_7, PH_COPY | PH_SEPARATE); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_6, &_4); + ZVAL_STRING(&_3, "options"); + ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 158, config, &_3, &_2); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("tag"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_2); - object_init_ex(&_2, phalcon_di_service_ce); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); - ZVAL_BOOL(&_4, 1); - ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 74, &_3, &_4); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("services"), &_1); - ZEPHIR_MM_RESTORE(); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Di_Service_Builder) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Di\\Service, Builder, phalcon, di_service_builder, phalcon_di_service_builder_method_entry, 0); - - return SUCCESS; + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Service_Builder, build) +static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, newInstance) { - zval _11$$17, _12$$17, _22$$23, _23$$23; - zend_string *_4$$10, *_30$$25; - zend_ulong _3$$10, _29$$25; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL, *_38 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *container, container_sub, *definition_param = NULL, *parameters = NULL, parameters_sub, __$null, className, arguments, paramCalls, methodPosition, method, methodName, methodCall, instance, propertyPosition, property, propertyName, propertyValue, _0$$8, *_1$$10, _2$$10, _5$$14, _6$$14, _8$$15, _9$$15, _10$$17, _13$$18, _14$$18, _15$$13, _16$$20, _17$$20, _18$$21, _19$$21, _20$$19, _26$$19, _21$$23, _24$$24, _25$$24, *_27$$25, _28$$25, _31$$29, _32$$29, _33$$30, _34$$30, _35$$31, _36$$31, _37$$28, _39$$33, _40$$33, _41$$34, _42$$34, _43$$35, _44$$35, _45$$32; + zval options, _0; + zval *name_param = NULL, *options_param = NULL, definition; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container_sub); - ZVAL_UNDEF(¶meters_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(¶mCalls); - ZVAL_UNDEF(&methodPosition); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&methodName); - ZVAL_UNDEF(&methodCall); - ZVAL_UNDEF(&instance); - ZVAL_UNDEF(&propertyPosition); - ZVAL_UNDEF(&property); - ZVAL_UNDEF(&propertyName); - ZVAL_UNDEF(&propertyValue); - ZVAL_UNDEF(&_0$$8); - ZVAL_UNDEF(&_2$$10); - ZVAL_UNDEF(&_5$$14); - ZVAL_UNDEF(&_6$$14); - ZVAL_UNDEF(&_8$$15); - ZVAL_UNDEF(&_9$$15); - ZVAL_UNDEF(&_10$$17); - ZVAL_UNDEF(&_13$$18); - ZVAL_UNDEF(&_14$$18); - ZVAL_UNDEF(&_15$$13); - ZVAL_UNDEF(&_16$$20); - ZVAL_UNDEF(&_17$$20); - ZVAL_UNDEF(&_18$$21); - ZVAL_UNDEF(&_19$$21); - ZVAL_UNDEF(&_20$$19); - ZVAL_UNDEF(&_26$$19); - ZVAL_UNDEF(&_21$$23); - ZVAL_UNDEF(&_24$$24); - ZVAL_UNDEF(&_25$$24); - ZVAL_UNDEF(&_28$$25); - ZVAL_UNDEF(&_31$$29); - ZVAL_UNDEF(&_32$$29); - ZVAL_UNDEF(&_33$$30); - ZVAL_UNDEF(&_34$$30); - ZVAL_UNDEF(&_35$$31); - ZVAL_UNDEF(&_36$$31); - ZVAL_UNDEF(&_37$$28); - ZVAL_UNDEF(&_39$$33); - ZVAL_UNDEF(&_40$$33); - ZVAL_UNDEF(&_41$$34); - ZVAL_UNDEF(&_42$$34); - ZVAL_UNDEF(&_43$$35); - ZVAL_UNDEF(&_44$$35); - ZVAL_UNDEF(&_45$$32); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&_11$$17); - ZVAL_UNDEF(&_12$$17); - ZVAL_UNDEF(&_22$$23); - ZVAL_UNDEF(&_23$$23); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(name) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(parameters) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &container, &definition_param, ¶meters); - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - if (!parameters) { - parameters = ¶meters_sub; - parameters = &__$null; - } - - - ZEPHIR_OBS_VAR(&className); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&className, &definition, SL("className"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Invalid service definition. Missing 'className' parameter", "phalcon/Di/Service/Builder.zep", 41); - return; + zephir_fetch_params(1, 1, 1, &name_param, &options_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); } - if (Z_TYPE_P(parameters) == IS_ARRAY) { - if (zephir_fast_count_int(parameters)) { - ZEPHIR_INIT_VAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &className, parameters); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &className); - zephir_check_call_status(); - } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_OBS_VAR(&arguments); - if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 0)) { - ZEPHIR_CALL_METHOD(&_0$$8, this_ptr, "buildparameters", NULL, 222, container, &arguments); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &className, &_0$$8); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&instance); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &className); - zephir_check_call_status(); - } - } - ZEPHIR_OBS_VAR(¶mCalls); - if (zephir_array_isset_string_fetch(¶mCalls, &definition, SL("calls"), 0)) { - if (UNEXPECTED(Z_TYPE_P(&instance) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The definition has setter injection parameters but the constructor didn't return an instance", "phalcon/Di/Service/Builder.zep", 78); - return; - } - if (UNEXPECTED(Z_TYPE_P(¶mCalls) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Setter injection parameters must be an array", "phalcon/Di/Service/Builder.zep", 84); - return; - } - zephir_is_iterable(¶mCalls, 0, "phalcon/Di/Service/Builder.zep", 143); - if (Z_TYPE_P(¶mCalls) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶mCalls), _3$$10, _4$$10, _1$$10) - { - ZEPHIR_INIT_NVAR(&methodPosition); - if (_4$$10 != NULL) { - ZVAL_STR_COPY(&methodPosition, _4$$10); - } else { - ZVAL_LONG(&methodPosition, _3$$10); - } - ZEPHIR_INIT_NVAR(&method); - ZVAL_COPY(&method, _1$$10); - if (UNEXPECTED(Z_TYPE_P(&method) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_5$$14); - object_init_ex(&_5$$14, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_6$$14); - ZEPHIR_CONCAT_SV(&_6$$14, "Method call must be an array on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_5$$14, "__construct", &_7, 29, &_6$$14); - zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$14, "phalcon/Di/Service/Builder.zep", 97); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&methodName); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&methodName, &method, SL("method"), 0)))) { - ZEPHIR_INIT_NVAR(&_8$$15); - object_init_ex(&_8$$15, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_9$$15); - ZEPHIR_CONCAT_SV(&_9$$15, "The method name is required on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_8$$15, "__construct", &_7, 29, &_9$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(&_8$$15, "phalcon/Di/Service/Builder.zep", 106); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_NVAR(&methodCall); - zephir_create_array(&methodCall, 2, 0); - zephir_array_fast_append(&methodCall, &instance); - zephir_array_fast_append(&methodCall, &methodName); - ZEPHIR_OBS_NVAR(&arguments); - if (zephir_array_isset_string_fetch(&arguments, &method, SL("arguments"), 0)) { - if (UNEXPECTED(Z_TYPE_P(&arguments) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_10$$17); - object_init_ex(&_10$$17, phalcon_di_exception_ce); - zephir_cast_to_string(&_11$$17, &methodPosition); - ZEPHIR_INIT_NVAR(&_12$$17); - ZEPHIR_CONCAT_SV(&_12$$17, "Call arguments must be an array on position ", &_11$$17); - ZEPHIR_CALL_METHOD(NULL, &_10$$17, "__construct", &_7, 29, &_12$$17); - zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$17, "phalcon/Di/Service/Builder.zep", 119); - ZEPHIR_MM_RESTORE(); - return; - } - if (zephir_fast_count_int(&arguments)) { - ZEPHIR_INIT_NVAR(&_13$$18); - ZEPHIR_CALL_METHOD(&_14$$18, this_ptr, "buildparameters", NULL, 222, container, &arguments); - zephir_check_call_status(); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_13$$18, &methodCall, &_14$$18); - zephir_check_call_status(); - continue; - } - } - ZEPHIR_INIT_NVAR(&_15$$13); - ZEPHIR_CALL_USER_FUNC(&_15$$13, &methodCall); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$10, ¶mCalls, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$10)) { - break; - } - ZEPHIR_CALL_METHOD(&methodPosition, ¶mCalls, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&method, ¶mCalls, "current", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&method) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_16$$20); - object_init_ex(&_16$$20, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_17$$20); - ZEPHIR_CONCAT_SV(&_17$$20, "Method call must be an array on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_16$$20, "__construct", &_7, 29, &_17$$20); - zephir_check_call_status(); - zephir_throw_exception_debug(&_16$$20, "phalcon/Di/Service/Builder.zep", 97); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&methodName); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&methodName, &method, SL("method"), 0)))) { - ZEPHIR_INIT_NVAR(&_18$$21); - object_init_ex(&_18$$21, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_19$$21); - ZEPHIR_CONCAT_SV(&_19$$21, "The method name is required on position ", &methodPosition); - ZEPHIR_CALL_METHOD(NULL, &_18$$21, "__construct", &_7, 29, &_19$$21); - zephir_check_call_status(); - zephir_throw_exception_debug(&_18$$21, "phalcon/Di/Service/Builder.zep", 106); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_NVAR(&_20$$19); - zephir_create_array(&_20$$19, 2, 0); - zephir_array_fast_append(&_20$$19, &instance); - zephir_array_fast_append(&_20$$19, &methodName); - ZEPHIR_CPY_WRT(&methodCall, &_20$$19); - ZEPHIR_OBS_NVAR(&arguments); - if (zephir_array_isset_string_fetch(&arguments, &method, SL("arguments"), 0)) { - if (UNEXPECTED(Z_TYPE_P(&arguments) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_21$$23); - object_init_ex(&_21$$23, phalcon_di_exception_ce); - zephir_cast_to_string(&_22$$23, &methodPosition); - ZEPHIR_INIT_NVAR(&_23$$23); - ZEPHIR_CONCAT_SV(&_23$$23, "Call arguments must be an array on position ", &_22$$23); - ZEPHIR_CALL_METHOD(NULL, &_21$$23, "__construct", &_7, 29, &_23$$23); - zephir_check_call_status(); - zephir_throw_exception_debug(&_21$$23, "phalcon/Di/Service/Builder.zep", 119); - ZEPHIR_MM_RESTORE(); - return; - } - if (zephir_fast_count_int(&arguments)) { - ZEPHIR_INIT_NVAR(&_24$$24); - ZEPHIR_CALL_METHOD(&_25$$24, this_ptr, "buildparameters", NULL, 222, container, &arguments); - zephir_check_call_status(); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_24$$24, &methodCall, &_25$$24); - zephir_check_call_status(); - continue; - } - } - ZEPHIR_INIT_NVAR(&_26$$19); - ZEPHIR_CALL_USER_FUNC(&_26$$19, &methodCall); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&method); - ZEPHIR_INIT_NVAR(&methodPosition); + ZEPHIR_INIT_VAR(&name); } - ZEPHIR_OBS_NVAR(¶mCalls); - if (zephir_array_isset_string_fetch(¶mCalls, &definition, SL("properties"), 0)) { - if (UNEXPECTED(Z_TYPE_P(&instance) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The definition has properties injection parameters but the constructor didn't return an instance", "phalcon/Di/Service/Builder.zep", 152); - return; - } - if (UNEXPECTED(Z_TYPE_P(¶mCalls) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Setter injection parameters must be an array", "phalcon/Di/Service/Builder.zep", 158); - return; - } - zephir_is_iterable(¶mCalls, 0, "phalcon/Di/Service/Builder.zep", 201); - if (Z_TYPE_P(¶mCalls) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶mCalls), _29$$25, _30$$25, _27$$25) - { - ZEPHIR_INIT_NVAR(&propertyPosition); - if (_30$$25 != NULL) { - ZVAL_STR_COPY(&propertyPosition, _30$$25); - } else { - ZVAL_LONG(&propertyPosition, _29$$25); - } - ZEPHIR_INIT_NVAR(&property); - ZVAL_COPY(&property, _27$$25); - if (UNEXPECTED(Z_TYPE_P(&property) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_31$$29); - object_init_ex(&_31$$29, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_32$$29); - ZEPHIR_CONCAT_SV(&_32$$29, "Property must be an array on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_31$$29, "__construct", &_7, 29, &_32$$29); - zephir_check_call_status(); - zephir_throw_exception_debug(&_31$$29, "phalcon/Di/Service/Builder.zep", 171); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&propertyName); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyName, &property, SL("name"), 0)))) { - ZEPHIR_INIT_NVAR(&_33$$30); - object_init_ex(&_33$$30, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_34$$30); - ZEPHIR_CONCAT_SV(&_34$$30, "The property name is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_33$$30, "__construct", &_7, 29, &_34$$30); - zephir_check_call_status(); - zephir_throw_exception_debug(&_33$$30, "phalcon/Di/Service/Builder.zep", 180); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&propertyValue); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyValue, &property, SL("value"), 0)))) { - ZEPHIR_INIT_NVAR(&_35$$31); - object_init_ex(&_35$$31, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_36$$31); - ZEPHIR_CONCAT_SV(&_36$$31, "The property value is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_35$$31, "__construct", &_7, 29, &_36$$31); - zephir_check_call_status(); - zephir_throw_exception_debug(&_35$$31, "phalcon/Di/Service/Builder.zep", 189); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&_37$$28, this_ptr, "buildparameter", &_38, 223, container, &propertyPosition, &propertyValue); - zephir_check_call_status(); - zephir_update_property_zval_zval(&instance, &propertyName, &_37$$28); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_28$$25, ¶mCalls, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_28$$25)) { - break; - } - ZEPHIR_CALL_METHOD(&propertyPosition, ¶mCalls, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&property, ¶mCalls, "current", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&property) != IS_ARRAY)) { - ZEPHIR_INIT_NVAR(&_39$$33); - object_init_ex(&_39$$33, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_40$$33); - ZEPHIR_CONCAT_SV(&_40$$33, "Property must be an array on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_39$$33, "__construct", &_7, 29, &_40$$33); - zephir_check_call_status(); - zephir_throw_exception_debug(&_39$$33, "phalcon/Di/Service/Builder.zep", 171); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&propertyName); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyName, &property, SL("name"), 0)))) { - ZEPHIR_INIT_NVAR(&_41$$34); - object_init_ex(&_41$$34, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_42$$34); - ZEPHIR_CONCAT_SV(&_42$$34, "The property name is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_41$$34, "__construct", &_7, 29, &_42$$34); - zephir_check_call_status(); - zephir_throw_exception_debug(&_41$$34, "phalcon/Di/Service/Builder.zep", 180); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_NVAR(&propertyValue); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyValue, &property, SL("value"), 0)))) { - ZEPHIR_INIT_NVAR(&_43$$35); - object_init_ex(&_43$$35, phalcon_di_exception_ce); - ZEPHIR_INIT_NVAR(&_44$$35); - ZEPHIR_CONCAT_SV(&_44$$35, "The property value is required on position ", &propertyPosition); - ZEPHIR_CALL_METHOD(NULL, &_43$$35, "__construct", &_7, 29, &_44$$35); - zephir_check_call_status(); - zephir_throw_exception_debug(&_43$$35, "phalcon/Di/Service/Builder.zep", 189); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&_45$$32, this_ptr, "buildparameter", &_38, 223, container, &propertyPosition, &propertyValue); - zephir_check_call_status(); - zephir_update_property_zval_zval(&instance, &propertyName, &_45$$32); - ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&property); - ZEPHIR_INIT_NVAR(&propertyPosition); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); } - RETURN_CCTOR(&instance); + + + ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0); + zephir_array_fast_append(&_0, &options); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) +static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, getExceptionClass) { - zval _2$$3, _5$$5, _8$$7, _11$$9, _14$$11; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval argument; - zend_long position, ZEPHIR_LAST_CALL_STATUS; - zval *container, container_sub, *position_param = NULL, *argument_param = NULL, type, name, value, instanceArguments, _0$$3, _1$$3, _3$$5, _4$$5, _6$$7, _7$$7, _9$$9, _10$$9, _12$$11, _13$$11; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container_sub); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&instanceArguments); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_9$$9); - ZVAL_UNDEF(&_10$$9); - ZVAL_UNDEF(&_12$$11); - ZVAL_UNDEF(&_13$$11); - ZVAL_UNDEF(&argument); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_11$$9); - ZVAL_UNDEF(&_14$$11); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) - Z_PARAM_LONG(position) - Z_PARAM_ARRAY(argument) - ZEND_PARSE_PARAMETERS_END(); + + + RETURN_STRING("Phalcon\\Annotations\\Exception"); +} + +static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, getServices) +{ + zval *this_ptr = getThis(); + + + + zephir_create_array(return_value, 3, 0); + add_assoc_stringl_ex(return_value, SL("apcu"), SL("Phalcon\\Annotations\\Adapter\\Apcu")); + add_assoc_stringl_ex(return_value, SL("memory"), SL("Phalcon\\Annotations\\Adapter\\Memory")); + add_assoc_stringl_ex(return_value, SL("stream"), SL("Phalcon\\Annotations\\Adapter\\Stream")); + return; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &container, &position_param, &argument_param); - position = zephir_get_intval(position_param); - ZEPHIR_OBS_COPY_OR_DUP(&argument, argument_param); - ZEPHIR_OBS_VAR(&type); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&type, &argument, SL("type"), 0)))) { - ZEPHIR_INIT_VAR(&_0$$3); - object_init_ex(&_0$$3, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_1$$3); - ZVAL_LONG(&_1$$3, position); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, "Argument at position ", &_1$$3, " must have a type"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_2$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "phalcon/Di/Service/Builder.zep", 221); - ZEPHIR_MM_RESTORE(); - return; - } - do { - if (ZEPHIR_IS_STRING(&type, "service")) { - ZEPHIR_OBS_VAR(&name); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&name, &argument, SL("name"), 0)))) { - ZEPHIR_INIT_VAR(&_3$$5); - object_init_ex(&_3$$5, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_4$$5); - ZVAL_LONG(&_4$$5, position); - ZEPHIR_INIT_VAR(&_5$$5); - ZEPHIR_CONCAT_SV(&_5$$5, "Service 'name' is required in parameter on position ", &_4$$5); - ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 29, &_5$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$5, "phalcon/Di/Service/Builder.zep", 233); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "parameter")) { - ZEPHIR_OBS_VAR(&value); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&value, &argument, SL("value"), 0)))) { - ZEPHIR_INIT_VAR(&_6$$7); - object_init_ex(&_6$$7, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_7$$7); - ZVAL_LONG(&_7$$7, position); - ZEPHIR_INIT_VAR(&_8$$7); - ZEPHIR_CONCAT_SV(&_8$$7, "Service 'value' is required in parameter on position ", &_7$$7); - ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", NULL, 29, &_8$$7); - zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$7, "phalcon/Di/Service/Builder.zep", 245); - ZEPHIR_MM_RESTORE(); - return; - } - RETURN_CCTOR(&value); - } - if (ZEPHIR_IS_STRING(&type, "instance")) { - ZEPHIR_OBS_NVAR(&name); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&name, &argument, SL("className"), 0)))) { - ZEPHIR_INIT_VAR(&_9$$9); - object_init_ex(&_9$$9, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_10$$9); - ZVAL_LONG(&_10$$9, position); - ZEPHIR_INIT_VAR(&_11$$9); - ZEPHIR_CONCAT_SV(&_11$$9, "Service 'className' is required in parameter on position ", &_10$$9); - ZEPHIR_CALL_METHOD(NULL, &_9$$9, "__construct", NULL, 29, &_11$$9); - zephir_check_call_status(); - zephir_throw_exception_debug(&_9$$9, "phalcon/Di/Service/Builder.zep", 257); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_OBS_VAR(&instanceArguments); - if (zephir_array_isset_string_fetch(&instanceArguments, &argument, SL("arguments"), 0)) { - ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name, &instanceArguments); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&_12$$11); - object_init_ex(&_12$$11, phalcon_di_exception_ce); - ZEPHIR_INIT_VAR(&_13$$11); - ZVAL_LONG(&_13$$11, position); - ZEPHIR_INIT_VAR(&_14$$11); - ZEPHIR_CONCAT_SV(&_14$$11, "Unknown service type in parameter on position ", &_13$$11); - ZEPHIR_CALL_METHOD(NULL, &_12$$11, "__construct", NULL, 29, &_14$$11); - zephir_check_call_status(); - zephir_throw_exception_debug(&_12$$11, "phalcon/Di/Service/Builder.zep", 279); - ZEPHIR_MM_RESTORE(); - return; - } while(0); - ZEPHIR_MM_RESTORE(); +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Collection) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Collection, phalcon, annotations_collection, phalcon_annotations_collection_method_entry, 0); + + zend_declare_property_null(phalcon_annotations_collection_ce, SL("annotations"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_annotations_collection_ce, SL("position"), 0, ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_annotations_collection_ce, 1, zend_ce_iterator); + zend_class_implements(phalcon_annotations_collection_ce, 1, zend_ce_countable); + return SUCCESS; } -static PHP_METHOD(Phalcon_Di_Service_Builder, buildParameters) +static PHP_METHOD(Phalcon_Annotations_Collection, __construct) { - zend_string *_3; - zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL; + zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval arguments, buildArguments; - zval *container, container_sub, *arguments_param = NULL, position, argument, *_0, _1, _4$$3, _6$$4; + zval *reflectionData_param = NULL, annotations, annotationData, *_0, _1, _2$$3, _4$$4; + zval reflectionData; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container_sub); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&argument); + ZVAL_UNDEF(&reflectionData); + ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&annotationData); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(&buildArguments); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) - Z_PARAM_ARRAY(arguments) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(reflectionData) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &container, &arguments_param); - ZEPHIR_OBS_COPY_OR_DUP(&arguments, arguments_param); + zephir_fetch_params(1, 0, 1, &reflectionData_param); + if (!reflectionData_param) { + ZEPHIR_INIT_VAR(&reflectionData); + array_init(&reflectionData); + } else { + zephir_get_arrval(&reflectionData, reflectionData_param); + } - ZEPHIR_INIT_VAR(&buildArguments); - array_init(&buildArguments); - zephir_is_iterable(&arguments, 0, "phalcon/Di/Service/Builder.zep", 301); - if (Z_TYPE_P(&arguments) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&arguments), _2, _3, _0) + ZEPHIR_INIT_VAR(&annotations); + array_init(&annotations); + zephir_is_iterable(&reflectionData, 0, "phalcon/Annotations/Collection.zep", 58); + if (Z_TYPE_P(&reflectionData) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&reflectionData), _0) { - ZEPHIR_INIT_NVAR(&position); - if (_3 != NULL) { - ZVAL_STR_COPY(&position, _3); - } else { - ZVAL_LONG(&position, _2); - } - ZEPHIR_INIT_NVAR(&argument); - ZVAL_COPY(&argument, _0); - ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "buildparameter", &_5, 223, container, &position, &argument); + ZEPHIR_INIT_NVAR(&annotationData); + ZVAL_COPY(&annotationData, _0); + ZEPHIR_INIT_NVAR(&_2$$3); + object_init_ex(&_2$$3, phalcon_annotations_annotation_ce); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 157, &annotationData); zephir_check_call_status(); - zephir_array_append(&buildArguments, &_4$$3, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 298); + zephir_array_append(&annotations, &_2$$3, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &arguments, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &reflectionData, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &arguments, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1, &reflectionData, "valid", NULL, 0); zephir_check_call_status(); if (!zend_is_true(&_1)) { break; } - ZEPHIR_CALL_METHOD(&position, &arguments, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&argument, &arguments, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&annotationData, &reflectionData, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "buildparameter", &_5, 223, container, &position, &argument); + ZEPHIR_INIT_NVAR(&_4$$4); + object_init_ex(&_4$$4, phalcon_annotations_annotation_ce); + ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", &_3, 157, &annotationData); zephir_check_call_status(); - zephir_array_append(&buildArguments, &_6$$4, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 298); - ZEPHIR_CALL_METHOD(NULL, &arguments, "next", NULL, 0); + zephir_array_append(&annotations, &_4$$4, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); + ZEPHIR_CALL_METHOD(NULL, &reflectionData, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&argument); - ZEPHIR_INIT_NVAR(&position); - RETURN_CTOR(&buildArguments); + ZEPHIR_INIT_NVAR(&annotationData); + zephir_update_property_zval(this_ptr, ZEND_STRL("annotations"), &annotations); + ZEPHIR_MM_RESTORE(); } - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_AbstractLogger) +static PHP_METHOD(Phalcon_Annotations_Collection, count) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Logger, AbstractLogger, phalcon, logger_abstractlogger, phalcon_logger_abstractlogger_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_logger_abstractlogger_ce, SL("adapters"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_abstractlogger_ce, SL("excluded"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_logger_abstractlogger_ce, SL("logLevel"), 8, ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_logger_abstractlogger_ce, SL("name"), "", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_abstractlogger_ce, SL("timezone"), ZEND_ACC_PROTECTED); - phalcon_logger_abstractlogger_ce->create_object = zephir_init_properties_Phalcon_Logger_AbstractLogger; - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("ALERT"), 2); + zval _0; + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("CRITICAL"), 1); + ZVAL_UNDEF(&_0); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("CUSTOM"), 8); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("DEBUG"), 7); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("EMERGENCY"), 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + RETURN_LONG(zephir_fast_count_int(&_0)); +} - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("ERROR"), 3); +static PHP_METHOD(Phalcon_Annotations_Collection, current) +{ + zval annotation, _0, _1; + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("INFO"), 6); + ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("NOTICE"), 5); - zephir_declare_class_constant_long(phalcon_logger_abstractlogger_ce, SL("WARNING"), 4); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&annotation, &_0, &_1, 1))) { + RETURN_BOOL(0); + } + RETURN_CTORW(&annotation); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, __construct) +static PHP_METHOD(Phalcon_Annotations_Collection, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval adapters; - zval *name_param = NULL, *adapters_param = NULL, *timezone = NULL, timezone_sub, __$null, defaultTimezone; - zval name; + zval *name_param = NULL, annotation, annotations, _0, *_1, _2, _5, _3$$3, _4$$5; + zval name, _6; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&timezone_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&defaultTimezone); - ZVAL_UNDEF(&adapters); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(adapters) - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(timezone, php_date_get_timezone_ce()) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &name_param, &adapters_param, &timezone); + zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - if (!adapters_param) { - ZEPHIR_INIT_VAR(&adapters); - array_init(&adapters); - } else { - zephir_get_arrval(&adapters, adapters_param); - } - if (!timezone) { - timezone = &timezone_sub; - ZEPHIR_CPY_WRT(timezone, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(timezone); - } - if (Z_TYPE_P(timezone) == IS_NULL) { - ZEPHIR_CALL_FUNCTION(&defaultTimezone, "date_default_timezone_get", NULL, 93); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&annotations, &_0); + zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 98); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _1); + ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { + RETURN_CCTOR(&annotation); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); zephir_check_call_status(); - if (UNEXPECTED(1 == ZEPHIR_IS_EMPTY(&defaultTimezone))) { - ZEPHIR_INIT_NVAR(&defaultTimezone); - ZVAL_STRING(&defaultTimezone, "UTC"); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { + RETURN_CCTOR(&annotation); + } + ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(timezone); - object_init_ex(timezone, php_date_get_timezone_ce()); - ZEPHIR_CALL_METHOD(NULL, timezone, "__construct", NULL, 0, &defaultTimezone); - zephir_check_call_status(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - zephir_update_property_zval(this_ptr, ZEND_STRL("timezone"), timezone); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setadapters", NULL, 0, &adapters); + ZEPHIR_INIT_NVAR(&annotation); + ZEPHIR_INIT_VAR(&_5); + object_init_ex(&_5, phalcon_annotations_exception_ce); + ZEPHIR_INIT_VAR(&_6); + ZEPHIR_CONCAT_SVS(&_6, "Collection doesn't have an annotation called '", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 32, &_6); zephir_check_call_status(); + zephir_throw_exception_debug(&_5, "phalcon/Annotations/Collection.zep", 100); ZEPHIR_MM_RESTORE(); + return; } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, addAdapter) +static PHP_METHOD(Phalcon_Annotations_Collection, getAll) { + zval found; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *adapter, adapter_sub; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, annotations, annotation, _0, *_1, _2, _3$$3, _4$$5; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&adapter_sub); + ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&found); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) - Z_PARAM_OBJECT_OF_CLASS(adapter, phalcon_logger_adapter_adapterinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &adapter); + zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - zephir_update_property_array(this_ptr, SL("adapters"), &name, adapter); - RETURN_THIS(); + ZEPHIR_INIT_VAR(&found); + array_init(&found); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&annotations, &_0); + zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 120); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _1); + ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { + zephir_array_append(&found, &annotation, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 116); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { + zephir_array_append(&found, &annotation, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 116); + } + ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + RETURN_CTOR(&found); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, excludeAdapters) +static PHP_METHOD(Phalcon_Annotations_Collection, getAnnotations) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "annotations"); +} + +static PHP_METHOD(Phalcon_Annotations_Collection, has) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *adapters_param = NULL, __$true, adapter, registered, *_0, _1; - zval adapters; + zval *name_param = NULL, annotations, annotation, _0, *_1, _2, _3$$3, _4$$5; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&adapters); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&adapter); - ZVAL_UNDEF(®istered); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(adapters) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &adapters_param); - if (!adapters_param) { - ZEPHIR_INIT_VAR(&adapters); - array_init(&adapters); - } else { - zephir_get_arrval(&adapters, adapters_param); - } + zephir_fetch_params(1, 1, 0, &name_param); + zephir_get_strval(&name, name_param); - zephir_read_property(®istered, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&adapters, 0, "phalcon/Logger/AbstractLogger.zep", 153); - if (Z_TYPE_P(&adapters) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&adapters), _0) + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&annotations, &_0); + zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 146); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) { - ZEPHIR_INIT_NVAR(&adapter); - ZVAL_COPY(&adapter, _0); - if (1 == zephir_array_isset(®istered, &adapter)) { - zephir_update_property_array(this_ptr, SL("excluded"), &adapter, &__$true); + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _1); + ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { + RETURN_MM_BOOL(1); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &adapters, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &adapters, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&adapter, &adapters, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); zephir_check_call_status(); - if (1 == zephir_array_isset(®istered, &adapter)) { - zephir_update_property_array(this_ptr, SL("excluded"), &adapter, &__$true); + ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { + RETURN_MM_BOOL(1); } - ZEPHIR_CALL_METHOD(NULL, &adapters, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&adapter); - RETURN_THIS(); + ZEPHIR_INIT_NVAR(&annotation); + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getAdapter) +static PHP_METHOD(Phalcon_Annotations_Collection, key) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _0, _1, _2; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - if (1 != zephir_array_isset(&_0, &name)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Adapter does not exist for this logger", "phalcon/Logger/AbstractLogger.zep", 169); - return; - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_2, &_1, &name, PH_NOISY | PH_READONLY, "phalcon/Logger/AbstractLogger.zep", 172); - RETURN_CTOR(&_2); + RETURN_MEMBER(getThis(), "position"); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getAdapters) +static PHP_METHOD(Phalcon_Annotations_Collection, next) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "adapters"); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getLogLevel) +static PHP_METHOD(Phalcon_Annotations_Collection, rewind) { + zval _0; zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "logLevel"); -} - -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getName) -{ - zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "name"); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_0); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, removeAdapter) +static PHP_METHOD(Phalcon_Annotations_Collection, valid) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _0, _1; - zval name; + zval _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - if (1 != zephir_array_isset(&_0, &name)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Adapter does not exist for this logger", "phalcon/Logger/AbstractLogger.zep", 214); - return; - } - zephir_unset_property_array(this_ptr, ZEND_STRL("adapters"), &name); - zephir_read_property(&_1, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_1, &name, PH_SEPARATE); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, &_1)); } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, setAdapters) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *adapters_param = NULL; - zval adapters; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&adapters); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(adapters) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &adapters_param); - zephir_get_arrval(&adapters, adapters_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("adapters"), &adapters); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Logger_AbstractLogger, setLogLevel) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *level_param = NULL, levels, _0; - zend_long level, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&levels); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(level) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &level_param); - level = zephir_get_intval(level_param); - ZEPHIR_CALL_METHOD(&levels, this_ptr, "getlevels", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - if (1 == zephir_array_isset_long(&levels, level)) { - ZEPHIR_INIT_NVAR(&_0); - ZVAL_LONG(&_0, level); - } else { - ZEPHIR_INIT_NVAR(&_0); - ZVAL_LONG(&_0, 8); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("logLevel"), &_0); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Logger_AbstractLogger, addMessage) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Exception) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval context; - zval message; - zval *level_param = NULL, *message_param = NULL, *context_param = NULL, adapter, collection, item, levelName, levels, method, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, *_7$$3, _8$$3, _9$$5, _10$$7; - zend_long level, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&adapter); - ZVAL_UNDEF(&collection); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&levelName); - ZVAL_UNDEF(&levels); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_LONG(level) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &level_param, &message_param, &context_param); - level = zephir_get_intval(level_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations, Exception, phalcon, annotations_exception, zend_ce_exception, NULL, 0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("logLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_GE_LONG(&_0, level)) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - if (zephir_fast_count_int(&_1$$3) == 0) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "No adapters specified", "phalcon/Logger/AbstractLogger.zep", 273); - return; - } - ZEPHIR_CALL_METHOD(&levels, this_ptr, "getlevels", NULL, 0); - zephir_check_call_status(); - if (1 == zephir_array_isset_long(&levels, level)) { - ZEPHIR_OBS_VAR(&levelName); - zephir_array_fetch_long(&levelName, &levels, level, PH_NOISY, "phalcon/Logger/AbstractLogger.zep", 277); - } else { - ZEPHIR_OBS_NVAR(&levelName); - zephir_array_fetch_long(&levelName, &levels, 8, PH_NOISY, "phalcon/Logger/AbstractLogger.zep", 277); - } - ZEPHIR_INIT_VAR(&item); - object_init_ex(&item, phalcon_logger_item_ce); - ZEPHIR_INIT_VAR(&_2$$3); - object_init_ex(&_2$$3, php_date_get_immutable_ce()); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("timezone"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_4$$3); - ZVAL_STRING(&_4$$3, "now"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 0, &_4$$3, &_3$$3); - zephir_check_call_status(); - ZVAL_LONG(&_5$$3, level); - ZEPHIR_CALL_METHOD(NULL, &item, "__construct", NULL, 94, &message, &levelName, &_5$$3, &_2$$3, &context); - zephir_check_call_status(); - zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("excluded"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&collection, "array_diff_key", NULL, 95, &_5$$3, &_6$$3); - zephir_check_call_status(); - zephir_is_iterable(&collection, 0, "phalcon/Logger/AbstractLogger.zep", 303); - if (Z_TYPE_P(&collection) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&collection), _7$$3) - { - ZEPHIR_INIT_NVAR(&adapter); - ZVAL_COPY(&adapter, _7$$3); - ZEPHIR_INIT_NVAR(&method); - ZVAL_STRING(&method, "process"); - ZEPHIR_CALL_METHOD(&_9$$5, &adapter, "intransaction", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_9$$5)) { - ZEPHIR_INIT_NVAR(&method); - ZVAL_STRING(&method, "add"); - } - ZEPHIR_CALL_METHOD_ZVAL(NULL, &adapter, &method, NULL, 0, &item); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &collection, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_8$$3, &collection, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_8$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&adapter, &collection, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&method); - ZVAL_STRING(&method, "process"); - ZEPHIR_CALL_METHOD(&_10$$7, &adapter, "intransaction", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_TRUE_IDENTICAL(&_10$$7)) { - ZEPHIR_INIT_NVAR(&method); - ZVAL_STRING(&method, "add"); - } - ZEPHIR_CALL_METHOD_ZVAL(NULL, &adapter, &method, NULL, 0, &item); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &collection, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&adapter); - ZEPHIR_INIT_NVAR(&_4$$3); - array_init(&_4$$3); - zephir_update_property_zval(this_ptr, ZEND_STRL("excluded"), &_4$$3); - } - RETURN_MM_BOOL(1); + return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getLevelNumber) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *level, level_sub, levelName, levels, _0$$3, _1$$4; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&level_sub); - ZVAL_UNDEF(&levelName); - ZVAL_UNDEF(&levels); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(level) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &level); +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +// 18 "parser.php.lemon" - if (Z_TYPE_P(level) == IS_STRING) { - ZEPHIR_INIT_VAR(&levelName); - zephir_fast_strtoupper(&levelName, level); - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getlevels", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&levels, "array_flip", NULL, 96, &_0$$3); - zephir_check_call_status(); - if (zephir_array_isset(&levels, &levelName)) { - zephir_array_fetch(&_1$$4, &levels, &levelName, PH_NOISY | PH_READONLY, "phalcon/Logger/AbstractLogger.zep", 328); - RETURN_CTOR(&_1$$4); - } - } else if (1 == zephir_is_numeric(level)) { - ZEPHIR_CALL_METHOD(&levels, this_ptr, "getlevels", NULL, 0); - zephir_check_call_status(); - if (zephir_array_isset(&levels, level)) { - RETURN_MM_LONG(zephir_get_intval(level)); - } - } - RETURN_MM_LONG(8); -} +// 12 "parser.php.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** AACODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** AANOCODE is a number of type AACODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** AAFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** AAACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** phannot_TOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** AAMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is phannot_TOKENTYPE. The entry in the union +** for base tokens is called "aa0". +** AASTACKDEPTH is the maximum depth of the parser's stack. +** phannot_ARG_SDECL A static variable declaration for the %extra_argument +** phannot_ARG_PDECL A parameter declaration for the %extra_argument +** phannot_ARG_STORE Code to store %extra_argument into aapParser +** phannot_ARG_FETCH Code to extract %extra_argument from aapParser +** AANSTATE the combined number of states. +** AANRULE the number of rules in the grammar +** AAERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define AACODETYPE unsigned char +#define AANOCODE 28 +#define AAACTIONTYPE unsigned char +#define phannot_TOKENTYPE phannot_parser_token* +typedef union { + phannot_TOKENTYPE aa0; + zval aa8; + int aa55; +} AAMINORTYPE; +#define AASTACKDEPTH 100 +#define phannot_ARG_SDECL phannot_parser_status *status; +#define phannot_ARG_PDECL ,phannot_parser_status *status +#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status +#define phannot_ARG_STORE aapParser->status = status +#define AANSTATE 40 +#define AANRULE 25 +#define AAERRORSYMBOL 18 +#define AAERRSYMDT aa55 +#define AA_NO_ACTION (AANSTATE+AANRULE+2) +#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) +#define AA_ERROR_ACTION (AANSTATE+AANRULE) -static PHP_METHOD(Phalcon_Logger_AbstractLogger, getLevels) -{ - zval *this_ptr = getThis(); +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < AANSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. +** +** N == AANSTATE+AANRULE A syntax error has occurred. +** +** N == AANSTATE+AANRULE+1 The parser accepts its input. +** +** N == AANSTATE+AANRULE+2 No such action. Denotes unused +** slots in the aa_action[] table. +** +** The action table is constructed as a single large table named aa_action[]. +** Given state S and lookahead X, the action is computed as +** +** aa_action[ aa_shift_ofst[S] + X ] +** +** If the index value aa_shift_ofst[S]+X is out of range or if the value +** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] +** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table +** and that aa_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the aa_reduce_ofst[] array is used in place of +** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of +** AA_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** aa_action[] A single table containing all actions. +** aa_lookahead[] A table containing the lookahead for each entry in +** aa_action. Used to detect hash collisions. +** aa_shift_ofst[] For each state, the offset into aa_action for +** shifting terminals. +** aa_reduce_ofst[] For each state, the offset into aa_action for +** shifting non-terminals after a reduce. +** aa_default[] Default action for each state. +*/ +static AAACTIONTYPE aa_action[] = { + /* 0 */ 4, 28, 15, 38, 12, 14, 16, 18, 20, 21, + /* 10 */ 22, 23, 24, 4, 31, 4, 28, 15, 40, 12, + /* 20 */ 30, 16, 18, 20, 21, 22, 23, 24, 3, 31, + /* 30 */ 4, 17, 15, 6, 19, 35, 16, 18, 20, 21, + /* 40 */ 22, 23, 24, 5, 31, 15, 7, 27, 11, 16, + /* 50 */ 54, 54, 15, 25, 27, 11, 16, 15, 32, 27, + /* 60 */ 11, 16, 66, 1, 2, 39, 41, 15, 4, 10, + /* 70 */ 11, 16, 15, 9, 9, 37, 16, 8, 13, 36, + /* 80 */ 9, 29, 34, 54, 54, 54, 54, 54, 26, 54, + /* 90 */ 54, 54, 54, 54, 54, 54, 33, +}; +static AACODETYPE aa_lookahead[] = { + /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, + /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, + /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, + /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, + /* 40 */ 12, 13, 14, 3, 16, 22, 23, 24, 25, 26, + /* 50 */ 27, 27, 22, 23, 24, 25, 26, 22, 23, 24, + /* 60 */ 25, 26, 19, 20, 21, 22, 0, 22, 2, 24, + /* 70 */ 25, 26, 22, 1, 1, 25, 26, 5, 7, 8, + /* 80 */ 1, 7, 8, 27, 27, 27, 27, 27, 15, 27, + /* 90 */ 27, 27, 27, 27, 27, 27, 17, +}; +#define AA_SHIFT_USE_DFLT (-3) +static signed char aa_shift_ofst[] = { + /* 0 */ 11, 18, 66, -3, 40, 29, -2, 72, -3, 13, + /* 10 */ -3, -3, 71, 28, -3, -3, -3, -3, -3, -3, + /* 20 */ -3, -3, -3, -3, 13, 73, -3, -3, 74, 28, + /* 30 */ -3, 13, 79, -3, 28, -3, 28, -3, -3, -3, +}; +#define AA_REDUCE_USE_DFLT (-21) +static signed char aa_reduce_ofst[] = { + /* 0 */ 43, -21, 6, -21, -21, -21, 23, -21, -21, 45, + /* 10 */ -21, -21, -21, -20, -21, -21, -21, -21, -21, -21, + /* 20 */ -21, -21, -21, -21, 30, -21, -21, -21, -21, -5, + /* 30 */ -21, 35, -21, -21, 10, -21, 50, -21, -21, -21, +}; +static AAACTIONTYPE aa_default[] = { + /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, + /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, + /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, + /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, +}; +#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef AAFALLBACK +static const AACODETYPE aaFallback[] = { +}; +#endif /* AAFALLBACK */ +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct aaStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + AAMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct aaStackEntry aaStackEntry; - zephir_create_array(return_value, 9, 0); - add_index_stringl(return_value, 2, SL("ALERT")); - add_index_stringl(return_value, 1, SL("CRITICAL")); - add_index_stringl(return_value, 7, SL("DEBUG")); - add_index_stringl(return_value, 0, SL("EMERGENCY")); - add_index_stringl(return_value, 3, SL("ERROR")); - add_index_stringl(return_value, 6, SL("INFO")); - add_index_stringl(return_value, 5, SL("NOTICE")); - add_index_stringl(return_value, 4, SL("WARNING")); - add_index_stringl(return_value, 8, SL("CUSTOM")); - return; -} +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct aaParser { + int aaidx; /* Index of top element in stack */ + int aaerrcnt; /* Shifts left before out of the error */ + phannot_ARG_SDECL /* A place to hold %extra_argument */ + aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ +}; +typedef struct aaParser aaParser; -zend_object *zephir_init_properties_Phalcon_Logger_AbstractLogger(zend_class_entry *class_type) -{ - zval _0, _2, _1$$3, _3$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - +#ifndef NDEBUG +static FILE *aaTraceFILE = 0; +static char *aaTracePrompt = 0; +#endif /* NDEBUG */ - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("excluded"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("excluded"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("adapters"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("adapters"), &_3$$4); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } +#ifndef NDEBUG +static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ + aaTraceFILE = TraceFILE; + aaTracePrompt = zTracePrompt; + if( aaTraceFILE==0 ) aaTracePrompt = 0; + else if( aaTracePrompt==0 ) aaTraceFILE = 0; } +#endif /* NDEBUG */ +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *aaTokenName[] = { + "$", "COMMA", "AT", "IDENTIFIER", + "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", + "COLON", "INTEGER", "DOUBLE", "NULL", + "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", + "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", + "annotation_language", "annotation_list", "annotation", "argument_list", + "argument_item", "expr", "array", +}; +#endif /* NDEBUG */ +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *aaRuleName[] = { + /* 0 */ "program ::= annotation_language", + /* 1 */ "annotation_language ::= annotation_list", + /* 2 */ "annotation_list ::= annotation_list annotation", + /* 3 */ "annotation_list ::= annotation", + /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", + /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", + /* 6 */ "annotation ::= AT IDENTIFIER", + /* 7 */ "argument_list ::= argument_list COMMA argument_item", + /* 8 */ "argument_list ::= argument_item", + /* 9 */ "argument_item ::= expr", + /* 10 */ "argument_item ::= STRING EQUALS expr", + /* 11 */ "argument_item ::= STRING COLON expr", + /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", + /* 13 */ "argument_item ::= IDENTIFIER COLON expr", + /* 14 */ "expr ::= annotation", + /* 15 */ "expr ::= array", + /* 16 */ "expr ::= IDENTIFIER", + /* 17 */ "expr ::= INTEGER", + /* 18 */ "expr ::= STRING", + /* 19 */ "expr ::= DOUBLE", + /* 20 */ "expr ::= NULL", + /* 21 */ "expr ::= FALSE", + /* 22 */ "expr ::= TRUE", + /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", + /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", +}; +#endif /* NDEBUG */ - -#ifdef HAVE_CONFIG_H +const char *phannot_TokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ + return aaTokenName[tokenType]; + }else{ + return "Unknown"; + } +#else + return ""; #endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_AdapterFactory) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger, AdapterFactory, phalcon, logger_adapterfactory, phalcon_factory_abstractfactory_ce, phalcon_logger_adapterfactory_method_entry, 0); - - return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_AdapterFactory, __construct) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *services_param = NULL; - zval services; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&services); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(services) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &services_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); - } - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); +void *phannot_Alloc(void *(*mallocProc)(size_t)){ + aaParser *pParser; + pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); + if( pParser ){ + pParser->aaidx = -1; + } + return pParser; } -static PHP_METHOD(Phalcon_Logger_AdapterFactory, newInstance) +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "aamajor" is the symbol code, and "aapminor" is a pointer to +** the value. +*/ +static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ + switch( aamajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: +// 67 "parser.php.lemon" { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options, _0; - zval *name_param = NULL, *fileName_param = NULL, *options_param = NULL, definition; - zval name, fileName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&fileName); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(name) - Z_PARAM_STR(fileName) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &name_param, &fileName_param, &options_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (UNEXPECTED(Z_TYPE_P(fileName_param) != IS_STRING && Z_TYPE_P(fileName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'fileName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(fileName_param) == IS_STRING)) { - zephir_get_strval(&fileName, fileName_param); - } else { - ZEPHIR_INIT_VAR(&fileName); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); + if ((aapminor->aa0)) { + if ((aapminor->aa0)->free_flag) { + efree((aapminor->aa0)->token); + } + efree((aapminor->aa0)); } - - - ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0); - zephir_array_fast_append(&_0, &fileName); - zephir_array_fast_append(&_0, &options); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_0); - zephir_check_call_status(); - RETURN_MM(); } - -static PHP_METHOD(Phalcon_Logger_AdapterFactory, getExceptionClass) +// 380 "parser.php.c" + break; + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: +// 80 "parser.php.lemon" { - zval *this_ptr = getThis(); - - - - RETURN_STRING("Phalcon\\Logger\\Exception"); + zval_ptr_dtor(&(aapminor->aa8)); } - -static PHP_METHOD(Phalcon_Logger_AdapterFactory, getServices) -{ - zval *this_ptr = getThis(); - - - - zephir_create_array(return_value, 3, 0); - add_assoc_stringl_ex(return_value, SL("noop"), SL("Phalcon\\Logger\\Adapter\\Noop")); - add_assoc_stringl_ex(return_value, SL("stream"), SL("Phalcon\\Logger\\Adapter\\Stream")); - add_assoc_stringl_ex(return_value, SL("syslog"), SL("Phalcon\\Logger\\Adapter\\Syslog")); - return; +// 392 "parser.php.c" + break; + default: break; /* If no destructor action specified: do nothing */ + } } +static int aa_pop_parser_stack(aaParser *pParser){ + AACODETYPE aamajor; + aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; - - -#ifdef HAVE_CONFIG_H + if( pParser->aaidx<0 ) return 0; +#ifndef NDEBUG + if( aaTraceFILE && pParser->aaidx>=0 ){ + fprintf(aaTraceFILE,"%sPopping %s\n", + aaTracePrompt, + aaTokenName[aatos->major]); + } #endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Enum) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Logger, Enum, phalcon, logger_enum, NULL, 0); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("ALERT"), 2); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("CRITICAL"), 1); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("CUSTOM"), 8); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("DEBUG"), 7); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("EMERGENCY"), 0); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("ERROR"), 3); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("INFO"), 6); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("NOTICE"), 5); - - zephir_declare_class_constant_long(phalcon_logger_enum_ce, SL("WARNING"), 4); - - return SUCCESS; + aamajor = aatos->major; + aa_destructor( aamajor, &aatos->minor); + pParser->aaidx--; + return aamajor; } +static void phannot_Free( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + aaParser *pParser = (aaParser*)p; + if( pParser==0 ) return; + while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); +} +static int aa_find_shift_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->aastack[pParser->aaidx].stateno; - -#ifdef HAVE_CONFIG_H + /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ + i = aa_shift_ofst[stateno]; + if( i==AA_SHIFT_USE_DFLT ){ + return aa_default[stateno]; + } + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ +#ifdef AAFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead %s\n", + aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); + } #endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Exception) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger, Exception, phalcon, logger_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; + return aa_find_shift_action(pParser, iFallback); + } +#endif + return aa_default[stateno]; + }else{ + return aa_action[i]; + } } +static int aa_find_reduce_action( + aaParser *pParser, /* The parser */ + int iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->aastack[pParser->aaidx].stateno; + i = aa_reduce_ofst[stateno]; + if( i==AA_REDUCE_USE_DFLT ){ + return aa_default[stateno]; + } + if( iLookAhead==AANOCODE ){ + return AA_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ + return aa_default[stateno]; + }else{ + return aa_action[i]; + } +} - -#ifdef HAVE_CONFIG_H +static void aa_shift( + aaParser *aapParser, /* The parser to be shifted */ + int aaNewState, /* The new state to shift in */ + int aaMajor, /* The major token to shift in */ + AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ +){ + aaStackEntry *aatos; + aapParser->aaidx++; + if( aapParser->aaidx>=AASTACKDEPTH ){ + phannot_ARG_FETCH; + aapParser->aaidx--; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); + } #endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; + } + aatos = &aapParser->aastack[aapParser->aaidx]; + aatos->stateno = aaNewState; + aatos->major = aaMajor; + aatos->minor = *aapMinor; +#ifndef NDEBUG + if( aaTraceFILE && aapParser->aaidx>0 ){ + int i; + fprintf(aaTraceFILE,"%sShift %d\n",aaTracePrompt,aaNewState); + fprintf(aaTraceFILE,"%sStack:",aaTracePrompt); + for(i=1; i<=aapParser->aaidx; i++) + fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); + fprintf(aaTraceFILE,"\n"); + } +#endif +} +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static struct { + AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} aaRuleInfo[] = { + { 19, 1 }, + { 20, 1 }, + { 21, 2 }, + { 21, 1 }, + { 22, 5 }, + { 22, 4 }, + { 22, 2 }, + { 23, 3 }, + { 23, 1 }, + { 24, 1 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 24, 3 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 25, 1 }, + { 26, 3 }, + { 26, 3 }, +}; +static void aa_accept(aaParser*); /* Forward Declaration */ - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Item) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Logger, Item, phalcon, logger_item, phalcon_logger_item_method_entry, 0); - - zend_declare_property_null(phalcon_logger_item_ce, SL("context"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_item_ce, SL("dateTime"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_item_ce, SL("message"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_item_ce, SL("level"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_item_ce, SL("levelName"), ZEND_ACC_PROTECTED); - phalcon_logger_item_ce->create_object = zephir_init_properties_Phalcon_Logger_Item; - - return SUCCESS; -} - -static PHP_METHOD(Phalcon_Logger_Item, __construct) +static void aa_reduce( + aaParser *aapParser, /* The parser */ + int aaruleno /* Number of the rule by which to reduce */ +){ + int aagoto; /* The next state */ + int aaact; /* The next action */ + AAMINORTYPE aagotominor; /* The LHS of the rule reduced */ + aaStackEntry *aamsp; /* The top of the parser's stack */ + int aasize; /* Amount to pop the stack */ + phannot_ARG_FETCH; + aamsp = &aapParser->aastack[aapParser->aaidx]; +#ifndef NDEBUG + if( aaTraceFILE && aaruleno>=0 + && aaruleno + ** { ... } // User supplied code + ** // + ** break; + */ + case 0: +// 76 "parser.php.lemon" { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval context; - zend_long level; - zval *message_param = NULL, *levelName_param = NULL, *level_param = NULL, *dateTime, dateTime_sub, *context_param = NULL, _0; - zval message, levelName; - zval *this_ptr = getThis(); + ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); +} +// 634 "parser.php.c" + break; + case 1: + case 14: + case 15: +// 84 "parser.php.lemon" +{ + aagotominor.aa8 = aamsp[0].minor.aa8; +} +// 643 "parser.php.c" + break; + case 2: +// 92 "parser.php.lemon" +{ + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); +} +// 650 "parser.php.c" + break; + case 3: + case 8: +// 96 "parser.php.lemon" +{ + phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); +} +// 658 "parser.php.c" + break; + case 4: +// 104 "parser.php.lemon" +{ + phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); + aa_destructor(2,&aamsp[-4].minor); + aa_destructor(4,&aamsp[-2].minor); + aa_destructor(5,&aamsp[0].minor); +} +// 668 "parser.php.c" + break; + case 5: +// 108 "parser.php.lemon" +{ + phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-3].minor); + aa_destructor(4,&aamsp[-1].minor); + aa_destructor(5,&aamsp[0].minor); +} +// 678 "parser.php.c" + break; + case 6: +// 112 "parser.php.lemon" +{ + phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); + aa_destructor(2,&aamsp[-1].minor); +} +// 686 "parser.php.c" + break; + case 7: +// 120 "parser.php.lemon" +{ + phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); + aa_destructor(1,&aamsp[-1].minor); +} +// 694 "parser.php.c" + break; + case 9: +// 132 "parser.php.lemon" +{ + phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); +} +// 701 "parser.php.c" + break; + case 10: + case 12: +// 136 "parser.php.lemon" +{ + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); + aa_destructor(7,&aamsp[-1].minor); +} +// 710 "parser.php.c" + break; + case 11: + case 13: +// 140 "parser.php.lemon" +{ + phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); + aa_destructor(8,&aamsp[-1].minor); +} +// 719 "parser.php.c" + break; + case 16: +// 164 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); +} +// 726 "parser.php.c" + break; + case 17: +// 168 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); +} +// 733 "parser.php.c" + break; + case 18: +// 172 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); +} +// 740 "parser.php.c" + break; + case 19: +// 176 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); +} +// 747 "parser.php.c" + break; + case 20: +// 180 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); + aa_destructor(11,&aamsp[0].minor); +} +// 755 "parser.php.c" + break; + case 21: +// 184 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); + aa_destructor(12,&aamsp[0].minor); +} +// 763 "parser.php.c" + break; + case 22: +// 188 "parser.php.lemon" +{ + phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); + aa_destructor(13,&aamsp[0].minor); +} +// 771 "parser.php.c" + break; + case 23: +// 192 "parser.php.lemon" +{ + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); + aa_destructor(14,&aamsp[-2].minor); + aa_destructor(15,&aamsp[0].minor); +} +// 780 "parser.php.c" + break; + case 24: +// 196 "parser.php.lemon" +{ + phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); + aa_destructor(16,&aamsp[-2].minor); + aa_destructor(17,&aamsp[0].minor); +} +// 789 "parser.php.c" + break; + }; + aagoto = aaRuleInfo[aaruleno].lhs; + aasize = aaRuleInfo[aaruleno].nrhs; + aapParser->aaidx -= aasize; + aaact = aa_find_reduce_action(aapParser,aagoto); + if( aaact < AANSTATE ){ + aa_shift(aapParser,aaact,aagoto,&aagotominor); + }else if( aaact == AANSTATE + AANRULE + 1 ){ + aa_accept(aapParser); + } +} - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&levelName); - ZVAL_UNDEF(&dateTime_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(4, 5) - Z_PARAM_STR(message) - Z_PARAM_STR(levelName) - Z_PARAM_LONG(level) - Z_PARAM_OBJECT_OF_CLASS(dateTime, php_date_get_immutable_ce()) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); +static void aa_parse_failed( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); + } #endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 4, 1, &message_param, &levelName_param, &level_param, &dateTime, &context_param); - zephir_get_strval(&message, message_param); - zephir_get_strval(&levelName, levelName_param); - level = zephir_get_intval(level_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } - - - zephir_update_property_zval(this_ptr, ZEND_STRL("message"), &message); - zephir_update_property_zval(this_ptr, ZEND_STRL("levelName"), &levelName); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, level); - zephir_update_property_zval(this_ptr, ZEND_STRL("level"), &_0); - zephir_update_property_zval(this_ptr, ZEND_STRL("dateTime"), dateTime); - zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &context); - ZEPHIR_MM_RESTORE(); + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static PHP_METHOD(Phalcon_Logger_Item, getContext) -{ - zval *this_ptr = getThis(); +static void aa_syntax_error( + aaParser *aapParser, /* The parser */ + int aamajor, /* The major type of the error token */ + AAMINORTYPE aaminor /* The minor type of the error token */ +){ + phannot_ARG_FETCH; +#define ATOKEN (aaminor.aa0) +// 22 "parser.php.lemon" + if (status->scanner_state->start_length) { + char *token_name = NULL; + const phannot_token_names *tokens = phannot_tokens; + int active_token = status->scanner_state->active_token; + unsigned int near_length = status->scanner_state->start_length; + if (active_token) { + do { + if (tokens->code == active_token) { + token_name = tokens->name; + break; + } + ++tokens; + } while (tokens[0].code != 0); + } - RETURN_MEMBER(getThis(), "context"); -} + if (!token_name) { + token_name = "UNKNOWN"; + } -static PHP_METHOD(Phalcon_Logger_Item, getDateTime) -{ - zval *this_ptr = getThis(); + if (near_length > 0) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + if (active_token != PHANNOT_T_IGNORE) { + if (status->token->value) { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); + } + } + } else { + spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); + } + status->status = PHANNOT_PARSING_FAILED; +// 876 "parser.php.c" + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} - RETURN_MEMBER(getThis(), "dateTime"); +static void aa_accept( + aaParser *aapParser /* The parser */ +){ + phannot_ARG_FETCH; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); + } +#endif + while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static PHP_METHOD(Phalcon_Logger_Item, getMessage) -{ - zval *this_ptr = getThis(); +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "phannot_Alloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +static void phannot_( + void *aap, /* The parser */ + int aamajor, /* The major token code number */ + phannot_TOKENTYPE aaminor /* The value for the token */ + phannot_ARG_PDECL /* Optional %extra_argument parameter */ +){ + AAMINORTYPE aaminorunion; + int aaact; /* The parser action. */ + int aaendofinput; /* True if we are at the end of input */ + int aaerrorhit = 0; /* True if aamajor has invoked an error */ + aaParser *aapParser; /* The parser */ + /* (re)initialize the parser, if necessary */ + aapParser = (aaParser*)aap; + if( aapParser->aaidx<0 ){ + if( aamajor==0 ) return; + aapParser->aaidx = 0; + aapParser->aaerrcnt = -1; + aapParser->aastack[0].stateno = 0; + aapParser->aastack[0].major = 0; + } + aaminorunion.aa0 = aaminor; + aaendofinput = (aamajor==0); + phannot_ARG_STORE; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); + } +#endif - RETURN_MEMBER(getThis(), "message"); + do{ + aaact = aa_find_shift_action(aapParser,aamajor); + if( aaactaaerrcnt--; + if( aaendofinput && aapParser->aaidx>=0 ){ + aamajor = 0; + }else{ + aamajor = AANOCODE; + } + }else if( aaact < AANSTATE + AANRULE ){ + aa_reduce(aapParser,aaact-AANSTATE); + }else if( aaact == AA_ERROR_ACTION ){ + int aamx; +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); + } +#endif +#ifdef AAERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( aapParser->aaerrcnt<0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aamx = aapParser->aastack[aapParser->aaidx].major; + if( aamx==AAERRORSYMBOL || aaerrorhit ){ +#ifndef NDEBUG + if( aaTraceFILE ){ + fprintf(aaTraceFILE,"%sDiscard input token %s\n", + aaTracePrompt,aaTokenName[aamajor]); + } +#endif + aa_destructor(aamajor,&aaminorunion); + aamajor = AANOCODE; + }else{ + while( + aapParser->aaidx >= 0 && + aamx != AAERRORSYMBOL && + (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE + ){ + aa_pop_parser_stack(aapParser); + } + if( aapParser->aaidx < 0 || aamajor==0 ){ + aa_destructor(aamajor,&aaminorunion); + aa_parse_failed(aapParser); + aamajor = AANOCODE; + }else if( aamx!=AAERRORSYMBOL ){ + AAMINORTYPE u2; + u2.AAERRSYMDT = 0; + aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); + } + } + aapParser->aaerrcnt = 3; + aaerrorhit = 1; +#else /* AAERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( aapParser->aaerrcnt<=0 ){ + aa_syntax_error(aapParser,aamajor,aaminorunion); + } + aapParser->aaerrcnt = 3; + aa_destructor(aamajor,&aaminorunion); + if( aaendofinput ){ + aa_parse_failed(aapParser); + } + aamajor = AANOCODE; +#endif + }else{ + aa_accept(aapParser); + aamajor = AANOCODE; + } + }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); + return; } +/* base.c + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the + * LICENSE.txt file that was distributed with this source code. + */ -static PHP_METHOD(Phalcon_Logger_Item, getLevel) +const phannot_token_names phannot_tokens[] = { - zval *this_ptr = getThis(); - + { "INTEGER", PHANNOT_T_INTEGER }, + { "DOUBLE", PHANNOT_T_DOUBLE }, + { "STRING", PHANNOT_T_STRING }, + { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, + { "@", PHANNOT_T_AT }, + { ",", PHANNOT_T_COMMA }, + { "=", PHANNOT_T_EQUALS }, + { ":", PHANNOT_T_COLON }, + { "(", PHANNOT_T_PARENTHESES_OPEN }, + { ")", PHANNOT_T_PARENTHESES_CLOSE }, + { "{", PHANNOT_T_BRACKET_OPEN }, + { "}", PHANNOT_T_BRACKET_CLOSE }, + { "[", PHANNOT_T_SBRACKET_OPEN }, + { "]", PHANNOT_T_SBRACKET_CLOSE }, + { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, + { NULL, 0 } +}; +static void *phannot_wrapper_alloc(size_t bytes){ + return emalloc(bytes); +} - RETURN_MEMBER(getThis(), "level"); +static void phannot_wrapper_free(void *pointer){ + efree(pointer); } -static PHP_METHOD(Phalcon_Logger_Item, getLevelName) -{ - zval *this_ptr = getThis(); +static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ + + phannot_parser_token *pToken; + pToken = emalloc(sizeof(phannot_parser_token)); + pToken->opcode = opcode; + pToken->token = token->value; + pToken->token_len = token->len; + pToken->free_flag = 1; + phannot_(phannot_parser, parsercode, pToken, parser_status); - RETURN_MEMBER(getThis(), "levelName"); + token->value = NULL; + token->len = 0; } -zend_object *zephir_init_properties_Phalcon_Logger_Item(zend_class_entry *class_type) -{ - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - +static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg){ - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("context"), &_1$$3); + phannot_scanner_state *state = parser_status->scanner_state; + + if (state->start) { + if (state->start_length > 16) { + spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); + } else { + spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); + } else { + spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); } } +static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line) { + char *comment_str; + int comment_len; + char *file_path_str; + int line_num; + char *error_msg = NULL; -#ifdef HAVE_CONFIG_H -#endif + ZVAL_NULL(result); + if (Z_TYPE_P(comment) == IS_STRING) { + comment_str = Z_STRVAL_P(comment); + comment_len = Z_STRLEN_P(comment); + } else { + comment_str = ""; + comment_len = 0; + } + if (Z_TYPE_P(file_path) == IS_STRING) { + file_path_str = Z_STRVAL_P(file_path); + } else { + file_path_str = "eval"; + } + if (Z_TYPE_P(line) == IS_LONG) { + line_num = Z_LVAL_P(line); + } else { + line_num = 0; + } + if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg) == FAILURE) { + if (likely(error_msg != NULL)) { + zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg)); + efree(error_msg); + } else { + zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation")); + } -ZEPHIR_INIT_CLASS(Phalcon_Logger_Logger) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger, Logger, phalcon, logger_logger, phalcon_logger_abstractlogger_ce, phalcon_logger_logger_method_entry, 0); + return FAILURE; + } - zend_class_implements(phalcon_logger_logger_ce, 1, phalcon_logger_loggerinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Logger, alert) +static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + char ch; + int start_mode = 1, j, i, open_parentheses; + smart_str processed_str = {0}; + (*start_lines) = 0; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + for (i = 0; i < length; i++) { + ch = comment[i]; - ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + if (start_mode) { + if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { + continue; + } + start_mode = 0; + } -static PHP_METHOD(Phalcon_Logger_Logger, critical) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); + if (ch == '@') { - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + smart_str_appendc(&processed_str, ch); + i++; + open_parentheses = 0; + for (j = i; j < length; j++) { - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + ch = comment[j]; + if (start_mode) { + if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { + continue; + } + start_mode = 0; + } - ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + if (open_parentheses == 0) { -static PHP_METHOD(Phalcon_Logger_Logger, debug) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); + if (isalnum(ch) || '_' == ch || '\\' == ch) { + smart_str_appendc(&processed_str, ch); + continue; + } - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + if (ch == '(') { + smart_str_appendc(&processed_str, ch); + open_parentheses++; + continue; + } + } else { - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + smart_str_appendc(&processed_str, ch); + if (ch == '(') { + open_parentheses++; + } else { + if (ch == ')') { + open_parentheses--; + } else { + if (ch == '\n') { + (*start_lines)++; + start_mode = 1; + } + } + } - ZVAL_LONG(&_0, 7); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + if (open_parentheses > 0) { + continue; + } + } -static PHP_METHOD(Phalcon_Logger_Logger, emergency) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); + i = j; + smart_str_appendc(&processed_str, ' '); + break; + } + } - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + if (ch == '\n') { + (*start_lines)++; + start_mode = 1; + } + } + smart_str_0(&processed_str); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); + if (processed_str.s) { + *ret = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s)); + *ret_len = ZSTR_LEN(processed_str.s); + smart_str_free(&processed_str); } else { - zephir_get_arrval(&context, context_param); + *ret = NULL; + *ret_len = 0; } - - - ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Logger_Logger, error) +static int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + phannot_scanner_state *state; + phannot_scanner_token token; + int start_lines; + int scanner_status, status = SUCCESS; + phannot_parser_status *parser_status = NULL; + void* phannot_parser; + char *processed_comment; + int processed_comment_len; + *error_msg = NULL; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); + if (UNEXPECTED(!comment)) { + ZVAL_BOOL(*result, 0); + spprintf(error_msg, 0, "Empty annotation"); + return FAILURE; } + if (comment_len < 2) { + ZVAL_BOOL(*result, 0); + return SUCCESS; + } - ZVAL_LONG(&_0, 3); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Logger_Logger, info) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines); + if (processed_comment_len < 2) { + ZVAL_BOOL(*result, 0); + if (processed_comment) { + efree(processed_comment); + } - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); + return SUCCESS; } + phannot_parser = phannot_Alloc(phannot_wrapper_alloc); + if (unlikely(!phannot_parser)) { + ZVAL_BOOL(*result, 0); + return FAILURE; + } - ZVAL_LONG(&_0, 6); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state)); + state = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status)); -static PHP_METHOD(Phalcon_Logger_Logger, log) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval message, _0; - zval *level, level_sub, *message_param = NULL, *context_param = NULL, intLevel; - zval *this_ptr = getThis(); + parser_status->status = PHANNOT_PARSING_OK; + parser_status->scanner_state = state; + parser_status->token = &token; + parser_status->syntax_error = NULL; - ZVAL_UNDEF(&level_sub); - ZVAL_UNDEF(&intLevel); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_ZVAL(level) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + state->active_token = 0; + state->start = processed_comment; + state->start_length = 0; + state->mode = PHANNOT_MODE_RAW; + state->active_file = file_path; + token.value = NULL; + token.len = 0; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &level, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); + if (line) { + state->active_line = line - start_lines; } else { - zephir_get_arrval(&context, context_param); + state->active_line = 1; } + state->end = state->start; - ZEPHIR_CALL_METHOD(&intLevel, this_ptr, "getlevelnumber", NULL, 0, level); - zephir_check_call_status(); - zephir_cast_to_string(&_0, &message); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &intLevel, &_0, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Logger_Logger, notice) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); + while(0 <= (scanner_status = phannot_get_token(state, &token))) { - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + state->active_token = token.opcode; + state->start_length = processed_comment + processed_comment_len - state->start; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + switch (token.opcode) { + case PHANNOT_T_IGNORE: + break; - ZVAL_LONG(&_0, 5); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + case PHANNOT_T_AT: + phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status); + break; + case PHANNOT_T_COMMA: + phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status); + break; + case PHANNOT_T_EQUALS: + phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status); + break; + case PHANNOT_T_COLON: + phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status); + break; -static PHP_METHOD(Phalcon_Logger_Logger, warning) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); + case PHANNOT_T_PARENTHESES_OPEN: + phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status); + break; + case PHANNOT_T_PARENTHESES_CLOSE: + phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status); + break; - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) - ZEND_PARSE_PARAMETERS_END(); -#endif + case PHANNOT_T_BRACKET_OPEN: + phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status); + break; + case PHANNOT_T_BRACKET_CLOSE: + phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status); + break; + case PHANNOT_T_SBRACKET_OPEN: + phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status); + break; + case PHANNOT_T_SBRACKET_CLOSE: + phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status); + break; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + case PHANNOT_T_NULL: + phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status); + break; + case PHANNOT_T_TRUE: + phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status); + break; + case PHANNOT_T_FALSE: + phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status); + break; + + case PHANNOT_T_INTEGER: + phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status); + break; + case PHANNOT_T_DOUBLE: + phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status); + break; + case PHANNOT_T_STRING: + phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status); + break; + case PHANNOT_T_IDENTIFIER: + phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status); + break; + /*case PHANNOT_T_ARBITRARY_TEXT: + phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status); + break;*/ + default: + parser_status->status = PHANNOT_PARSING_FAILED; + if (!*error_msg) { + spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line); + } + break; + } - ZVAL_LONG(&_0, 4); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmessage", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} + if (parser_status->status != PHANNOT_PARSING_OK) { + status = FAILURE; + break; + } + state->end = state->start; + } + if (status != FAILURE) { + switch (scanner_status) { + case PHANNOT_SCANNER_RETCODE_ERR: + case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE: + if (!*error_msg) { + phannot_scanner_error_msg(parser_status, error_msg); + } + status = FAILURE; + break; -#ifdef HAVE_CONFIG_H -#endif + default: + phannot_(phannot_parser, 0, NULL, parser_status); + } + } + state->active_token = 0; + state->start = NULL; + if (parser_status->status != PHANNOT_PARSING_OK) { + status = FAILURE; + if (parser_status->syntax_error) { + if (!*error_msg) { + *error_msg = parser_status->syntax_error; + } else { + efree(parser_status->syntax_error); + } + } + } + phannot_Free(phannot_parser, phannot_wrapper_free); + if (status != FAILURE) { + if (parser_status->status == PHANNOT_PARSING_OK) { + ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); + } + } -ZEPHIR_INIT_CLASS(Phalcon_Logger_LoggerFactory) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger, LoggerFactory, phalcon, logger_loggerfactory, phalcon_factory_abstractconfigfactory_ce, phalcon_logger_loggerfactory_method_entry, 0); + efree(processed_comment); + efree(parser_status); - zend_declare_property_null(phalcon_logger_loggerfactory_ce, SL("adapterFactory"), ZEND_ACC_PRIVATE); - return SUCCESS; + return status; } -static PHP_METHOD(Phalcon_Logger_LoggerFactory, __construct) -{ - zval *factory, factory_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&factory_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_logger_adapterfactory_ce) - ZEND_PARSE_PARAMETERS_END(); + +#ifdef HAVE_CONFIG_H #endif - zephir_fetch_params_without_memory_grow(1, 0, &factory); - zephir_update_property_zval(this_ptr, ZEND_STRL("adapterFactory"), factory); + +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); + + zend_class_implements(phalcon_annotations_reader_ce, 1, phalcon_annotations_readerinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_LoggerFactory, load) +static PHP_METHOD(Phalcon_Annotations_Reader, parse) { - zend_string *_7; - zend_ulong _6; - zval data; + zval annotations; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *config = NULL, config_sub, adapter, adapterClass, adapterFileName, adapterName, adapterOptions, adapters, name, timezone, options, _0, _1, _2, _3, *_4, _5, _8$$3, _9$$3, _10$$3, _11$$3, _12$$4, _13$$4, _14$$4, _15$$4; + zephir_fcall_cache_entry *_4 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, line = 0; + zval *className_param = NULL, reflection, comment, arrayKeys, classAnnotations, properties, property, annotationsProperties, propertyAnnotations, methods, method, annotationsMethods, methodAnnotations, constants, constant, anotationsConstants, constantAnnotations, constantReflection, _0$$3, _1$$3, *_2$$5, _3$$5, _5$$7, _6$$7, _7$$10, _8$$10, *_9$$13, _10$$13, _11$$15, _12$$15, _13$$16, _14$$18, _15$$18, _16$$19, *_17$$21, _18$$21, _19$$23, _20$$23, _21$$24, _22$$26, _23$$26, _24$$27; + zval className; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config_sub); - ZVAL_UNDEF(&adapter); - ZVAL_UNDEF(&adapterClass); - ZVAL_UNDEF(&adapterFileName); - ZVAL_UNDEF(&adapterName); - ZVAL_UNDEF(&adapterOptions); - ZVAL_UNDEF(&adapters); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&timezone); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - ZVAL_UNDEF(&_12$$4); - ZVAL_UNDEF(&_13$$4); - ZVAL_UNDEF(&_14$$4); - ZVAL_UNDEF(&_15$$4); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&reflection); + ZVAL_UNDEF(&comment); + ZVAL_UNDEF(&arrayKeys); + ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&properties); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&annotationsProperties); + ZVAL_UNDEF(&propertyAnnotations); + ZVAL_UNDEF(&methods); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&annotationsMethods); + ZVAL_UNDEF(&methodAnnotations); + ZVAL_UNDEF(&constants); + ZVAL_UNDEF(&constant); + ZVAL_UNDEF(&anotationsConstants); + ZVAL_UNDEF(&constantAnnotations); + ZVAL_UNDEF(&constantReflection); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$10); + ZVAL_UNDEF(&_8$$10); + ZVAL_UNDEF(&_10$$13); + ZVAL_UNDEF(&_11$$15); + ZVAL_UNDEF(&_12$$15); + ZVAL_UNDEF(&_13$$16); + ZVAL_UNDEF(&_14$$18); + ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&_16$$19); + ZVAL_UNDEF(&_18$$21); + ZVAL_UNDEF(&_19$$23); + ZVAL_UNDEF(&_20$$23); + ZVAL_UNDEF(&_21$$24); + ZVAL_UNDEF(&_22$$26); + ZVAL_UNDEF(&_23$$26); + ZVAL_UNDEF(&_24$$27); + ZVAL_UNDEF(&annotations); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(config) + Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &config); - ZEPHIR_SEPARATE_PARAM(config); + zephir_fetch_params(1, 1, 0, &className_param); + zephir_get_strval(&className, className_param); - ZEPHIR_INIT_VAR(&data); - array_init(&data); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfig", NULL, 0, config); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "name"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfigelement", NULL, 0, config, &_1); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_0); - ZEPHIR_OBS_VAR(&name); - zephir_array_fetch_string(&name, config, SL("name"), PH_NOISY, "phalcon/Logger/LoggerFactory.zep", 62); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "timezone"); - ZEPHIR_CALL_METHOD(&timezone, this_ptr, "getarrval", NULL, 0, config, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_1); - array_init(&_1); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "options"); - ZEPHIR_CALL_METHOD(&options, this_ptr, "getarrval", NULL, 0, config, &_2, &_1); + ZEPHIR_INIT_VAR(&annotations); + array_init(&annotations); + ZEPHIR_INIT_VAR(&reflection); + object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionclass"))); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 153, &className); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_2); - array_init(&_2); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "adapters"); - ZEPHIR_CALL_METHOD(&adapters, this_ptr, "getarrval", NULL, 0, &options, &_3, &_2); + ZEPHIR_CALL_METHOD(&comment, &reflection, "getdoccomment", NULL, 159); zephir_check_call_status(); - zephir_is_iterable(&adapters, 0, "phalcon/Logger/LoggerFactory.zep", 81); - if (Z_TYPE_P(&adapters) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&adapters), _6, _7, _4) - { - ZEPHIR_INIT_NVAR(&adapterName); - if (_7 != NULL) { - ZVAL_STR_COPY(&adapterName, _7); - } else { - ZVAL_LONG(&adapterName, _6); - } - ZEPHIR_INIT_NVAR(&adapter); - ZVAL_COPY(&adapter, _4); - ZEPHIR_INIT_NVAR(&_8$$3); - ZVAL_STRING(&_8$$3, "adapter"); - ZEPHIR_CALL_METHOD(&adapterClass, this_ptr, "getarrval", NULL, 0, &adapter, &_8$$3); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$3); - ZVAL_STRING(&_8$$3, "name"); - ZEPHIR_CALL_METHOD(&adapterFileName, this_ptr, "getarrval", NULL, 0, &adapter, &_8$$3); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$3); - array_init(&_8$$3); - ZEPHIR_INIT_NVAR(&_9$$3); - ZVAL_STRING(&_9$$3, "options"); - ZEPHIR_CALL_METHOD(&adapterOptions, this_ptr, "getarrval", NULL, 0, &adapter, &_9$$3, &_8$$3); - zephir_check_call_status(); - zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("adapterFactory"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_11$$3, &_10$$3, "newinstance", NULL, 0, &adapterClass, &adapterFileName, &adapterOptions); - zephir_check_call_status(); - zephir_array_update_zval(&data, &adapterName, &_11$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &adapters, "rewind", NULL, 0); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_VAR(&classAnnotations); + ZEPHIR_CALL_METHOD(&_0$$3, &reflection, "getfilename", NULL, 160); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &adapters, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1$$3, &reflection, "getstartline", NULL, 161); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&classAnnotations, &comment, &_0$$3, &_1$$3); + zephir_check_call_status(); + if (Z_TYPE_P(&classAnnotations) == IS_ARRAY) { + zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&constants, &reflection, "getconstants", NULL, 162); + zephir_check_call_status(); + if (zephir_fast_count_int(&constants)) { + line = 1; + ZEPHIR_INIT_VAR(&arrayKeys); + zephir_array_keys(&arrayKeys, &constants); + ZEPHIR_INIT_VAR(&anotationsConstants); + array_init(&anotationsConstants); + zephir_is_iterable(&arrayKeys, 0, "phalcon/Annotations/Reader.zep", 92); + if (Z_TYPE_P(&arrayKeys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&arrayKeys), _2$$5) + { + ZEPHIR_INIT_NVAR(&constant); + ZVAL_COPY(&constant, _2$$5); + ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 163, &constant); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, &constantReflection, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&constantAnnotations); + ZEPHIR_CALL_METHOD(&_5$$7, &reflection, "getfilename", NULL, 160); + zephir_check_call_status(); + ZVAL_LONG(&_6$$7, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&constantAnnotations, &comment, &_5$$7, &_6$$7); + zephir_check_call_status(); + if (Z_TYPE_P(&constantAnnotations) == IS_ARRAY) { + zephir_array_update_zval(&anotationsConstants, &constant, &constantAnnotations, PH_COPY | PH_SEPARATE); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &arrayKeys, "rewind", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; + while (1) { + ZEPHIR_CALL_METHOD(&_3$$5, &arrayKeys, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$5)) { + break; + } + ZEPHIR_CALL_METHOD(&constant, &arrayKeys, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&constantReflection, &reflection, "getreflectionconstant", &_4, 163, &constant); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, &constantReflection, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&constantAnnotations); + ZEPHIR_CALL_METHOD(&_7$$10, &reflection, "getfilename", NULL, 160); + zephir_check_call_status(); + ZVAL_LONG(&_8$$10, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&constantAnnotations, &comment, &_7$$10, &_8$$10); + zephir_check_call_status(); + if (Z_TYPE_P(&constantAnnotations) == IS_ARRAY) { + zephir_array_update_zval(&anotationsConstants, &constant, &constantAnnotations, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(NULL, &arrayKeys, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&adapterName, &adapters, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&adapter, &adapters, "current", NULL, 0); + } + ZEPHIR_INIT_NVAR(&constant); + if (zephir_fast_count_int(&anotationsConstants)) { + zephir_array_update_string(&annotations, SL("constants"), &anotationsConstants, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&properties, &reflection, "getproperties", NULL, 164); + zephir_check_call_status(); + if (zephir_fast_count_int(&properties)) { + line = 1; + ZEPHIR_INIT_VAR(&annotationsProperties); + array_init(&annotationsProperties); + zephir_is_iterable(&properties, 0, "phalcon/Annotations/Reader.zep", 130); + if (Z_TYPE_P(&properties) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&properties), _9$$13) + { + ZEPHIR_INIT_NVAR(&property); + ZVAL_COPY(&property, _9$$13); + ZEPHIR_CALL_METHOD(&comment, &property, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&propertyAnnotations); + ZEPHIR_CALL_METHOD(&_11$$15, &reflection, "getfilename", NULL, 160); + zephir_check_call_status(); + ZVAL_LONG(&_12$$15, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_11$$15, &_12$$15); + zephir_check_call_status(); + if (Z_TYPE_P(&propertyAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&_13$$16); + zephir_read_property(&_13$$16, &property, ZEND_STRL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsProperties, &_13$$16, &propertyAnnotations, PH_COPY | PH_SEPARATE); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_12$$4); - ZVAL_STRING(&_12$$4, "adapter"); - ZEPHIR_CALL_METHOD(&adapterClass, this_ptr, "getarrval", NULL, 0, &adapter, &_12$$4); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$13, &properties, "valid", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_12$$4); - ZVAL_STRING(&_12$$4, "name"); - ZEPHIR_CALL_METHOD(&adapterFileName, this_ptr, "getarrval", NULL, 0, &adapter, &_12$$4); + if (!zend_is_true(&_10$$13)) { + break; + } + ZEPHIR_CALL_METHOD(&property, &properties, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_12$$4); - array_init(&_12$$4); - ZEPHIR_INIT_NVAR(&_13$$4); - ZVAL_STRING(&_13$$4, "options"); - ZEPHIR_CALL_METHOD(&adapterOptions, this_ptr, "getarrval", NULL, 0, &adapter, &_13$$4, &_12$$4); + ZEPHIR_CALL_METHOD(&comment, &property, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&propertyAnnotations); + ZEPHIR_CALL_METHOD(&_14$$18, &reflection, "getfilename", NULL, 160); + zephir_check_call_status(); + ZVAL_LONG(&_15$$18, line); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_14$$18, &_15$$18); + zephir_check_call_status(); + if (Z_TYPE_P(&propertyAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&_16$$19); + zephir_read_property(&_16$$19, &property, ZEND_STRL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsProperties, &_16$$19, &propertyAnnotations, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(NULL, &properties, "next", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_14$$4, this_ptr, ZEND_STRL("adapterFactory"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_15$$4, &_14$$4, "newinstance", NULL, 0, &adapterClass, &adapterFileName, &adapterOptions); + } + } + ZEPHIR_INIT_NVAR(&property); + if (zephir_fast_count_int(&annotationsProperties)) { + zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(&methods, &reflection, "getmethods", NULL, 165); + zephir_check_call_status(); + if (0 == ZEPHIR_IS_EMPTY(&methods)) { + ZEPHIR_INIT_VAR(&annotationsMethods); + array_init(&annotationsMethods); + zephir_is_iterable(&methods, 0, "phalcon/Annotations/Reader.zep", 164); + if (Z_TYPE_P(&methods) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&methods), _17$$21) + { + ZEPHIR_INIT_NVAR(&method); + ZVAL_COPY(&method, _17$$21); + ZEPHIR_CALL_METHOD(&comment, &method, "getdoccomment", NULL, 0); zephir_check_call_status(); - zephir_array_update_zval(&data, &adapterName, &_15$$4, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &adapters, "next", NULL, 0); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&methodAnnotations); + ZEPHIR_CALL_METHOD(&_19$$23, &method, "getfilename", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_20$$23, &method, "getstartline", NULL, 0); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&methodAnnotations, &comment, &_19$$23, &_20$$23); + zephir_check_call_status(); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&_21$$24); + zephir_read_property(&_21$$24, &method, ZEND_STRL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsMethods, &_21$$24, &methodAnnotations, PH_COPY | PH_SEPARATE); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &methods, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_18$$21, &methods, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_18$$21)) { + break; + } + ZEPHIR_CALL_METHOD(&method, &methods, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&comment, &method, "getdoccomment", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&comment)) { + ZEPHIR_INIT_NVAR(&methodAnnotations); + ZEPHIR_CALL_METHOD(&_22$$26, &method, "getfilename", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_23$$26, &method, "getstartline", NULL, 0); + zephir_check_call_status(); + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&methodAnnotations, &comment, &_22$$26, &_23$$26); + zephir_check_call_status(); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&_24$$27); + zephir_read_property(&_24$$27, &method, ZEND_STRL("name"), PH_NOISY_CC); + zephir_array_update_zval(&annotationsMethods, &_24$$27, &methodAnnotations, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(NULL, &methods, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&method); + if (zephir_fast_count_int(&annotationsMethods)) { + zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); } } - ZEPHIR_INIT_NVAR(&adapter); - ZEPHIR_INIT_NVAR(&adapterName); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &data, &timezone); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CTOR(&annotations); } -static PHP_METHOD(Phalcon_Logger_LoggerFactory, newInstance) +static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval adapters; - zval *name_param = NULL, *adapters_param = NULL, *timezone = NULL, timezone_sub, __$null; - zval name; + zval *docBlock_param = NULL, *file = NULL, file_sub, *line = NULL, line_sub, __$null; + zval docBlock; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&timezone_sub); + ZVAL_UNDEF(&docBlock); + ZVAL_UNDEF(&file_sub); + ZVAL_UNDEF(&line_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&adapters); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(name) + Z_PARAM_STR(docBlock) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(adapters) - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(timezone, php_date_get_timezone_ce()) + Z_PARAM_ZVAL_OR_NULL(file) + Z_PARAM_ZVAL_OR_NULL(line) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &name_param, &adapters_param, &timezone); - zephir_get_strval(&name, name_param); - if (!adapters_param) { - ZEPHIR_INIT_VAR(&adapters); - array_init(&adapters); + zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); + zephir_get_strval(&docBlock, docBlock_param); + if (!file) { + file = &file_sub; + ZEPHIR_CPY_WRT(file, &__$null); } else { - zephir_get_arrval(&adapters, adapters_param); + ZEPHIR_SEPARATE_PARAM(file); } - if (!timezone) { - timezone = &timezone_sub; - timezone = &__$null; + if (!line) { + line = &line_sub; + line = &__$null; } - object_init_ex(return_value, phalcon_logger_logger_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 417, &name, &adapters, timezone); + if (Z_TYPE_P(file) != IS_STRING) { + ZEPHIR_INIT_NVAR(file); + ZVAL_STRING(file, "eval code"); + } + ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, &docBlock, file, line); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Logger_LoggerFactory, getArrVal) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *collection_param = NULL, *index, index_sub, *defaultValue = NULL, defaultValue_sub, __$null, value; - zval collection; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&collection); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&defaultValue_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_ARRAY(collection) - Z_PARAM_ZVAL(index) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(defaultValue) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &collection_param, &index, &defaultValue); - ZEPHIR_OBS_COPY_OR_DUP(&collection, collection_param); - if (!defaultValue) { - defaultValue = &defaultValue_sub; - defaultValue = &__$null; - } - - - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, &collection, index, 1)))) { - RETVAL_ZVAL(defaultValue, 1, 0); - RETURN_MM(); - } - RETURN_CTOR(&value); -} - -static PHP_METHOD(Phalcon_Logger_LoggerFactory, getExceptionClass) -{ - zval *this_ptr = getThis(); - - - - RETURN_STRING("Phalcon\\Logger\\Exception"); -} - @@ -35384,26 +35093,15 @@ static PHP_METHOD(Phalcon_Logger_LoggerFactory, getExceptionClass) -ZEPHIR_INIT_CLASS(Phalcon_Logger_LoggerInterface) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Logger, LoggerInterface, phalcon, logger_loggerinterface, phalcon_logger_loggerinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations, ReaderInterface, phalcon, annotations_readerinterface, phalcon_annotations_readerinterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, alert); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, critical); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, debug); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, emergency); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, error); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, getAdapter); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, getAdapters); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, getLogLevel); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, info); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, log); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, notice); -ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, warning); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); @@ -35414,318 +35112,332 @@ ZEPHIR_DOC_METHOD(Phalcon_Logger_LoggerInterface, warning); -ZEPHIR_INIT_CLASS(Phalcon_Logger_Adapter_AbstractAdapter) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Logger\\Adapter, AbstractAdapter, phalcon, logger_adapter_abstractadapter, phalcon_logger_adapter_abstractadapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); - zend_declare_property_string(phalcon_logger_adapter_abstractadapter_ce, SL("defaultFormatter"), "Phalcon\\Logger\\Formatter\\Line", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_adapter_abstractadapter_ce, SL("formatter"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_logger_adapter_abstractadapter_ce, SL("inTransaction"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_adapter_abstractadapter_ce, SL("queue"), ZEND_ACC_PROTECTED); - phalcon_logger_adapter_abstractadapter_ce->create_object = zephir_init_properties_Phalcon_Logger_Adapter_AbstractAdapter; + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("classAnnotations"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("constantAnnotations"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("propertyAnnotations"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("methodAnnotations"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_reflection_ce, SL("reflectionData"), ZEND_ACC_PROTECTED); + phalcon_annotations_reflection_ce->create_object = zephir_init_properties_Phalcon_Annotations_Reflection; - zend_class_implements(phalcon_logger_adapter_abstractadapter_ce, 1, phalcon_logger_adapter_adapterinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, __destruct) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("inTransaction"), PH_NOISY_CC | PH_READONLY); - if (zephir_is_true(&_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "There is an active transaction", "phalcon/Logger/Adapter/AbstractAdapter.zep", 64); - return; - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "close", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, __serialize) -{ - zval *this_ptr = getThis(); - - - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_logger_exception_ce, "This object cannot be serialized", "phalcon/Logger/Adapter/AbstractAdapter.zep", 75); - return; -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, __unserialize) +static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *data_param = NULL; - zval data; + zval *reflectionData_param = NULL; + zval reflectionData; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&reflectionData); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(data) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(reflectionData) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &data_param); - zephir_get_arrval(&data, data_param); - - - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "This object cannot be unserialized", "phalcon/Logger/Adapter/AbstractAdapter.zep", 83); - return; -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, add) -{ - zval *item, item_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&item_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &item); + zephir_fetch_params(1, 0, 1, &reflectionData_param); + if (!reflectionData_param) { + ZEPHIR_INIT_VAR(&reflectionData); + array_init(&reflectionData); + } else { + zephir_get_arrval(&reflectionData, reflectionData_param); + } - zephir_update_property_array_append(this_ptr, SL("queue"), item); - RETURN_THISW(); + zephir_update_property_zval(this_ptr, ZEND_STRL("reflectionData"), &reflectionData); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, begin) +static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { - zval __$true, __$false; + zval reflectionClass, _0, _1$$3, _2$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&reflectionClass); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZEPHIR_MM_GROW(); - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("inTransaction"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("inTransaction"), &__$false); + zephir_read_property(&_0, this_ptr, ZEND_STRL("classAnnotations"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("reflectionData"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(&reflectionClass, &_1$$3, SL("class"), 1)) { + ZEPHIR_INIT_VAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 37, &reflectionClass); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("classAnnotations"), &_2$$4); + } } - RETURN_THISW(); + RETURN_MM_MEMBER(getThis(), "classAnnotations"); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, commit) +static PHP_METHOD(Phalcon_Annotations_Reflection, getConstantsAnnotations) { - zval item, queue, _0, *_1, _2; + zend_string *_5$$4; + zend_ulong _4$$4; + zend_bool _1$$3; + zval reflectionConstants, constant, reflectionConstant, _0, *_2$$4, _3$$4, _6$$5, _8$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&queue); + ZVAL_UNDEF(&reflectionConstants); + ZVAL_UNDEF(&constant); + ZVAL_UNDEF(&reflectionConstant); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_8$$6); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 64); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("queue"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&queue, &_0); - zephir_is_iterable(&queue, 0, "phalcon/Logger/Adapter/AbstractAdapter.zep", 132); - if (Z_TYPE_P(&queue) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&queue), _1) - { - ZEPHIR_INIT_NVAR(&item); - ZVAL_COPY(&item, _1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "process", &_3, 0, &item); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &queue, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &queue, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&item, &queue, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "process", &_3, 0, &item); + ZEPHIR_OBS_VAR(&reflectionConstants); + zephir_read_property(&_0, this_ptr, ZEND_STRL("reflectionData"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(&reflectionConstants, &_0, SL("constants"), 0)) { + _1$$3 = Z_TYPE_P(&reflectionConstants) == IS_ARRAY; + if (_1$$3) { + _1$$3 = zephir_fast_count_int(&reflectionConstants) > 0; + } + if (_1$$3) { + zephir_is_iterable(&reflectionConstants, 0, "phalcon/Annotations/Reflection.zep", 97); + if (Z_TYPE_P(&reflectionConstants) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&reflectionConstants), _4$$4, _5$$4, _2$$4) + { + ZEPHIR_INIT_NVAR(&constant); + if (_5$$4 != NULL) { + ZVAL_STR_COPY(&constant, _5$$4); + } else { + ZVAL_LONG(&constant, _4$$4); + } + ZEPHIR_INIT_NVAR(&reflectionConstant); + ZVAL_COPY(&reflectionConstant, _2$$4); + ZEPHIR_INIT_NVAR(&_6$$5); + object_init_ex(&_6$$5, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionConstant); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("constantAnnotations"), &constant, &_6$$5); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &reflectionConstants, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &queue, "next", NULL, 0); - zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$4, &reflectionConstants, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&constant, &reflectionConstants, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&reflectionConstant, &reflectionConstants, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$6); + object_init_ex(&_8$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionConstant); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("constantAnnotations"), &constant, &_8$$6); + ZEPHIR_CALL_METHOD(NULL, &reflectionConstants, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&reflectionConstant); + ZEPHIR_INIT_NVAR(&constant); } } - ZEPHIR_INIT_NVAR(&item); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 65); - zephir_check_call_status(); - RETURN_THIS(); + RETURN_MM_MEMBER(getThis(), "constantAnnotations"); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, getFormatter) +static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { - zval _0, _1$$3, _2$$3; + zend_string *_5$$4; + zend_ulong _4$$4; + zend_bool _1$$3; + zval reflectionProperties, property, reflectionProperty, _0, *_2$$4, _3$$4, _6$$5, _8$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&reflectionProperties); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&reflectionProperty); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_8$$6); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("formatter"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("defaultFormatter"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&_1$$3, &_2$$3); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("formatter"), &_1$$3); + ZEPHIR_OBS_VAR(&reflectionProperties); + zephir_read_property(&_0, this_ptr, ZEND_STRL("reflectionData"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(&reflectionProperties, &_0, SL("properties"), 0)) { + _1$$3 = Z_TYPE_P(&reflectionProperties) == IS_ARRAY; + if (_1$$3) { + _1$$3 = zephir_fast_count_int(&reflectionProperties) > 0; + } + if (_1$$3) { + zephir_is_iterable(&reflectionProperties, 0, "phalcon/Annotations/Reflection.zep", 119); + if (Z_TYPE_P(&reflectionProperties) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&reflectionProperties), _4$$4, _5$$4, _2$$4) + { + ZEPHIR_INIT_NVAR(&property); + if (_5$$4 != NULL) { + ZVAL_STR_COPY(&property, _5$$4); + } else { + ZVAL_LONG(&property, _4$$4); + } + ZEPHIR_INIT_NVAR(&reflectionProperty); + ZVAL_COPY(&reflectionProperty, _2$$4); + ZEPHIR_INIT_NVAR(&_6$$5); + object_init_ex(&_6$$5, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionProperty); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_6$$5); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &reflectionProperties, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$4, &reflectionProperties, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&property, &reflectionProperties, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&reflectionProperty, &reflectionProperties, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$6); + object_init_ex(&_8$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionProperty); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_8$$6); + ZEPHIR_CALL_METHOD(NULL, &reflectionProperties, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&reflectionProperty); + ZEPHIR_INIT_NVAR(&property); + } } - RETURN_MM_MEMBER(getThis(), "formatter"); -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, inTransaction) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "inTransaction"); -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, process) -{ + RETURN_MM_MEMBER(getThis(), "propertyAnnotations"); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, rollback) +static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { + zend_string *_5$$4; + zend_ulong _4$$4; + zend_bool _1$$3; + zval reflectionMethods, methodName, reflectionMethod, _0, *_2$$4, _3$$4, _6$$5, _8$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&reflectionMethods); + ZVAL_UNDEF(&methodName); + ZVAL_UNDEF(&reflectionMethod); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_8$$6); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checktransaction", NULL, 64); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "resettransaction", NULL, 65); - zephir_check_call_status(); - RETURN_THIS(); + ZEPHIR_OBS_VAR(&reflectionMethods); + zephir_read_property(&_0, this_ptr, ZEND_STRL("reflectionData"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(&reflectionMethods, &_0, SL("methods"), 0)) { + _1$$3 = Z_TYPE_P(&reflectionMethods) == IS_ARRAY; + if (_1$$3) { + _1$$3 = zephir_fast_count_int(&reflectionMethods) > 0; + } + if (_1$$3) { + zephir_is_iterable(&reflectionMethods, 0, "phalcon/Annotations/Reflection.zep", 141); + if (Z_TYPE_P(&reflectionMethods) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&reflectionMethods), _4$$4, _5$$4, _2$$4) + { + ZEPHIR_INIT_NVAR(&methodName); + if (_5$$4 != NULL) { + ZVAL_STR_COPY(&methodName, _5$$4); + } else { + ZVAL_LONG(&methodName, _4$$4); + } + ZEPHIR_INIT_NVAR(&reflectionMethod); + ZVAL_COPY(&reflectionMethod, _2$$4); + ZEPHIR_INIT_NVAR(&_6$$5); + object_init_ex(&_6$$5, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_6$$5, "__construct", &_7, 37, &reflectionMethod); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_6$$5); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &reflectionMethods, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$4, &reflectionMethods, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&methodName, &reflectionMethods, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&reflectionMethod, &reflectionMethods, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$6); + object_init_ex(&_8$$6, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, &_8$$6, "__construct", &_7, 37, &reflectionMethod); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_8$$6); + ZEPHIR_CALL_METHOD(NULL, &reflectionMethods, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&reflectionMethod); + ZEPHIR_INIT_NVAR(&methodName); + } + } + RETURN_MM_MEMBER(getThis(), "methodAnnotations"); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, setFormatter) +static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { - zval *formatter, formatter_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&formatter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(formatter, phalcon_logger_formatter_formatterinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &formatter); - zephir_update_property_zval(this_ptr, ZEND_STRL("formatter"), formatter); - RETURN_THISW(); + RETURN_MEMBER(getThis(), "reflectionData"); } -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, getFormattedItem) +zend_object *zephir_init_properties_Phalcon_Annotations_Reflection(zend_class_entry *class_type) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, formatter; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&item_sub); - ZVAL_UNDEF(&formatter); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); - - - ZEPHIR_CALL_METHOD(&formatter, this_ptr, "getformatter", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&formatter, "format", NULL, 0, item); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, checkTransaction) -{ - zval _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("inTransaction"), PH_NOISY_CC | PH_READONLY); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&_0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_logger_exception_ce, "There is no active transaction", "phalcon/Logger/Adapter/AbstractAdapter.zep", 213); - return; - } -} - -static PHP_METHOD(Phalcon_Logger_Adapter_AbstractAdapter, resetTransaction) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, _0; - zval *this_ptr = getThis(); - - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - zephir_update_property_zval(this_ptr, ZEND_STRL("queue"), &_0); - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("inTransaction"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("inTransaction"), &__$false); - } - ZEPHIR_MM_RESTORE(); -} - -zend_object *zephir_init_properties_Phalcon_Logger_Adapter_AbstractAdapter(zend_class_entry *class_type) -{ - zval _0, _1$$3; + zval _0, _2, _4, _6, _1$$3, _3$$4, _5$$5, _7$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); ZEPHIR_MM_GROW(); @@ -35733,11 +35445,29 @@ zend_object *zephir_init_properties_Phalcon_Logger_Adapter_AbstractAdapter(zend_ { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("queue"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("reflectionData"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("queue"), &_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("reflectionData"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("methodAnnotations"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("methodAnnotations"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("propertyAnnotations"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("propertyAnnotations"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("constantAnnotations"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("constantAnnotations"), &_7$$6); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -35746,78 +35476,882 @@ zend_object *zephir_init_properties_Phalcon_Logger_Adapter_AbstractAdapter(zend_ - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Adapter_AdapterInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Logger\\Adapter, AdapterInterface, phalcon, logger_adapter_adapterinterface, phalcon_logger_adapter_adapterinterface_method_entry); - - return SUCCESS; -} - -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, add); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, begin); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, close); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, commit); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, getFormatter); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, inTransaction); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, process); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, rollback); -ZEPHIR_DOC_METHOD(Phalcon_Logger_Adapter_AdapterInterface, setFormatter); - - - -#ifdef HAVE_CONFIG_H -#endif +/* Generated by re2c 1.1.1 */ +/* scanner.re + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the + * LICENSE.txt file that was distributed with this source code. + */ +#define AACTYPE unsigned char +#define AACURSOR (s->start) +#define AALIMIT (s->end) +#define AAMARKER q +static int phannot_get_token(phannot_scanner_state *s, phannot_scanner_token *token) { -ZEPHIR_INIT_CLASS(Phalcon_Logger_Adapter_Noop) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Adapter, Noop, phalcon, logger_adapter_noop, phalcon_logger_adapter_abstractadapter_ce, phalcon_logger_adapter_noop_method_entry, 0); + char next, *q = AACURSOR, *start = AACURSOR; + int status = PHANNOT_SCANNER_RETCODE_IMPOSSIBLE; - return SUCCESS; -} + while (PHANNOT_SCANNER_RETCODE_IMPOSSIBLE == status) { -static PHP_METHOD(Phalcon_Logger_Adapter_Noop, close) -{ - zval *this_ptr = getThis(); + if (s->mode == PHANNOT_MODE_RAW) { + if (*AACURSOR == '\n') { + s->active_line++; + } + next = *(AACURSOR+1); - RETURN_BOOL(1); -} + if (*AACURSOR == '\0' || *AACURSOR == '@') { + if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z')) { + s->mode = PHANNOT_MODE_ANNOTATION; + continue; + } + } -static PHP_METHOD(Phalcon_Logger_Adapter_Noop, process) -{ - zval *item, item_sub; - zval *this_ptr = getThis(); + ++AACURSOR; + token->opcode = PHANNOT_T_IGNORE; + return 0; - ZVAL_UNDEF(&item_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif + } else { + + { + AACTYPE aach; + unsigned int aaaccept = 0; + aach = *AACURSOR; + switch (aach) { + case 0x00: goto aa2; + case '\t': + case '\r': + case ' ': goto aa6; + case '\n': goto aa9; + case '"': goto aa11; + case '\'': goto aa12; + case '(': goto aa13; + case ')': goto aa15; + case ',': goto aa17; + case '-': goto aa19; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto aa20; + case ':': goto aa23; + case '=': goto aa25; + case '@': goto aa27; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + case 'F': + case 'f': goto aa32; + case 'N': + case 'n': goto aa33; + case 'T': + case 't': goto aa34; + case '[': goto aa35; + case '\\': goto aa37; + case ']': goto aa38; + case '{': goto aa40; + case '}': goto aa42; + default: goto aa4; + } +aa2: + ++AACURSOR; + { + status = PHANNOT_SCANNER_RETCODE_EOF; + break; + } +aa4: + ++AACURSOR; +aa5: + { + status = PHANNOT_SCANNER_RETCODE_ERR; + break; + } +aa6: + aach = *++AACURSOR; + switch (aach) { + case '\t': + case '\r': + case ' ': goto aa6; + default: goto aa8; + } +aa8: + { + token->opcode = PHANNOT_T_IGNORE; + return 0; + } +aa9: + ++AACURSOR; + { + s->active_line++; + token->opcode = PHANNOT_T_IGNORE; + return 0; + } +aa11: + aaaccept = 0; + aach = *(AAMARKER = ++AACURSOR); + if (aach <= 0x00) goto aa5; + goto aa45; +aa12: + aaaccept = 0; + aach = *(AAMARKER = ++AACURSOR); + if (aach <= 0x00) goto aa5; + goto aa51; +aa13: + ++AACURSOR; + { + token->opcode = PHANNOT_T_PARENTHESES_OPEN; + return 0; + } +aa15: + ++AACURSOR; + { + token->opcode = PHANNOT_T_PARENTHESES_CLOSE; + return 0; + } +aa17: + ++AACURSOR; + { + token->opcode = PHANNOT_T_COMMA; + return 0; + } +aa19: + aach = *++AACURSOR; + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto aa20; + default: goto aa5; + } +aa20: + aaaccept = 1; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case '.': goto aa53; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto aa20; + default: goto aa22; + } +aa22: + { + token->opcode = PHANNOT_T_INTEGER; + token->value = estrndup(start, AACURSOR - start); + token->len = AACURSOR - start; + q = AACURSOR; + return 0; + } +aa23: + ++AACURSOR; + { + token->opcode = PHANNOT_T_COLON; + return 0; + } +aa25: + ++AACURSOR; + { + token->opcode = PHANNOT_T_EQUALS; + return 0; + } +aa27: + ++AACURSOR; + { + token->opcode = PHANNOT_T_AT; + return 0; + } +aa29: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); +aa30: + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + case '\\': goto aa54; + default: goto aa31; + } +aa31: + { + token->opcode = PHANNOT_T_IDENTIFIER; + token->value = estrndup(start, AACURSOR - start); + token->len = AACURSOR - start; + q = AACURSOR; + return 0; + } +aa32: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'A': + case 'a': goto aa55; + default: goto aa30; + } +aa33: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'U': + case 'u': goto aa56; + default: goto aa30; + } +aa34: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'R': + case 'r': goto aa57; + default: goto aa30; + } +aa35: + ++AACURSOR; + { + token->opcode = PHANNOT_T_SBRACKET_OPEN; + return 0; + } +aa37: + aach = *++AACURSOR; + switch (aach) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + default: goto aa5; + } +aa38: + ++AACURSOR; + { + token->opcode = PHANNOT_T_SBRACKET_CLOSE; + return 0; + } +aa40: + ++AACURSOR; + { + token->opcode = PHANNOT_T_BRACKET_OPEN; + return 0; + } +aa42: + ++AACURSOR; + { + token->opcode = PHANNOT_T_BRACKET_CLOSE; + return 0; + } +aa44: + aach = *++AACURSOR; +aa45: + switch (aach) { + case 0x00: goto aa46; + case '"': goto aa47; + case '\\': goto aa49; + default: goto aa44; + } +aa46: + AACURSOR = AAMARKER; + switch (aaaccept) { + case 0: goto aa5; + case 1: goto aa22; + case 2: goto aa31; + case 3: goto aa66; + case 4: goto aa68; + default: goto aa70; + } +aa47: + ++AACURSOR; + { + token->opcode = PHANNOT_T_STRING; + token->value = estrndup(q, AACURSOR - q - 1); + token->len = AACURSOR - q - 1; + q = AACURSOR; + return 0; + } +aa49: + aach = *++AACURSOR; + switch (aach) { + case '\n': goto aa46; + default: goto aa44; + } +aa50: + aach = *++AACURSOR; +aa51: + switch (aach) { + case 0x00: goto aa46; + case '\'': goto aa47; + case '\\': goto aa52; + default: goto aa50; + } +aa52: + aach = *++AACURSOR; + switch (aach) { + case '\n': goto aa46; + default: goto aa50; + } +aa53: + aach = *++AACURSOR; + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto aa58; + default: goto aa46; + } +aa54: + aach = *++AACURSOR; + switch (aach) { + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + default: goto aa46; + } +aa55: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'L': + case 'l': goto aa61; + default: goto aa30; + } +aa56: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'L': + case 'l': goto aa62; + default: goto aa30; + } +aa57: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'U': + case 'u': goto aa63; + default: goto aa30; + } +aa58: + aach = *++AACURSOR; + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto aa58; + default: goto aa60; + } +aa60: + { + token->opcode = PHANNOT_T_DOUBLE; + token->value = estrndup(start, AACURSOR - start); + token->len = AACURSOR - start; + q = AACURSOR; + return 0; + } +aa61: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'S': + case 's': goto aa64; + default: goto aa30; + } +aa62: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'L': + case 'l': goto aa65; + default: goto aa30; + } +aa63: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'E': + case 'e': goto aa67; + default: goto aa30; + } +aa64: + aaaccept = 2; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case 'E': + case 'e': goto aa69; + default: goto aa30; + } +aa65: + aaaccept = 3; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + case '\\': goto aa54; + default: goto aa66; + } +aa66: + { + token->opcode = PHANNOT_T_NULL; + return 0; + } +aa67: + aaaccept = 4; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + case '\\': goto aa54; + default: goto aa68; + } +aa68: + { + token->opcode = PHANNOT_T_TRUE; + return 0; + } +aa69: + aaaccept = 5; + aach = *(AAMARKER = ++AACURSOR); + switch (aach) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto aa29; + case '\\': goto aa54; + default: goto aa70; + } +aa70: + { + token->opcode = PHANNOT_T_FALSE; + return 0; + } + } - zephir_fetch_params_without_memory_grow(1, 0, &item); + } + } + return status; } - #ifdef HAVE_CONFIG_H #endif @@ -35825,429 +36359,407 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Noop, process) -ZEPHIR_INIT_CLASS(Phalcon_Logger_Adapter_Stream) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_AbstractAdapter) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Adapter, Stream, phalcon, logger_adapter_stream, phalcon_logger_adapter_abstractadapter_ce, phalcon_logger_adapter_stream_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations\\Adapter, AbstractAdapter, phalcon, annotations_adapter_abstractadapter, phalcon_annotations_adapter_abstractadapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - zend_declare_property_string(phalcon_logger_adapter_stream_ce, SL("mode"), "ab", ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_adapter_stream_ce, SL("name"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_logger_adapter_stream_ce, SL("options"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_adapter_abstractadapter_ce, SL("annotations"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_annotations_adapter_abstractadapter_ce, SL("reader"), ZEND_ACC_PROTECTED); + phalcon_annotations_adapter_abstractadapter_ce->create_object = zephir_init_properties_Phalcon_Annotations_Adapter_AbstractAdapter; + + zend_class_implements(phalcon_annotations_adapter_abstractadapter_ce, 1, phalcon_annotations_adapter_adapterinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Adapter_Stream, __construct) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, get) { + zend_bool _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *name_param = NULL, *options_param = NULL, mode, _0, _1; - zval name; + zval *className, className_sub, classAnnotations, parsedAnnotations, realClassName, reader, _0, _1$$5, _2$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&mode); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&className_sub); + ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&parsedAnnotations); + ZVAL_UNDEF(&realClassName); + ZVAL_UNDEF(&reader); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_2$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &options_param); - zephir_get_strval(&name, name_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); - } + zephir_fetch_params(1, 1, 0, &className); - if (1 == zephir_array_isset_string(&options, SL("mode"))) { - ZEPHIR_OBS_VAR(&mode); - zephir_array_fetch_string(&mode, &options, SL("mode"), PH_NOISY, "phalcon/Logger/Adapter/Stream.zep", 74); + if (Z_TYPE_P(className) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&realClassName); + zephir_get_class(&realClassName, className, 0); } else { - ZEPHIR_INIT_NVAR(&mode); - ZVAL_STRING(&mode, "ab"); + ZEPHIR_CPY_WRT(&realClassName, className); } - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "r"); - ZEPHIR_CALL_FUNCTION(&_1, "mb_strpos", NULL, 82, &mode, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_0, &realClassName)) { + zephir_read_property(&_1$$5, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_2$$5, &_1$$5, &realClassName, PH_NOISY | PH_READONLY, "phalcon/Annotations/Adapter/AbstractAdapter.zep", 51); + RETURN_CTOR(&_2$$5); + } + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "read", NULL, 0, &realClassName); zephir_check_call_status(); - if (!ZEPHIR_IS_FALSE_IDENTICAL(&_1)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Adapter cannot be opened in read mode", "phalcon/Logger/Adapter/Stream.zep", 76); - return; + _3 = Z_TYPE_P(&classAnnotations) == IS_NULL; + if (!(_3)) { + _3 = ZEPHIR_IS_FALSE_IDENTICAL(&classAnnotations); } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - zephir_update_property_zval(this_ptr, ZEND_STRL("mode"), &mode); - ZEPHIR_MM_RESTORE(); + if (_3) { + ZEPHIR_CALL_METHOD(&reader, this_ptr, "getreader", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&parsedAnnotations, &reader, "parse", NULL, 0, &realClassName); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&classAnnotations); + object_init_ex(&classAnnotations, phalcon_annotations_reflection_ce); + ZEPHIR_CALL_METHOD(NULL, &classAnnotations, "__construct", NULL, 36, &parsedAnnotations); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("annotations"), &realClassName, &classAnnotations); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, &realClassName, &classAnnotations); + zephir_check_call_status(); + } + RETURN_CCTOR(&classAnnotations); } -static PHP_METHOD(Phalcon_Logger_Adapter_Stream, close) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getConstant) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *className_param = NULL, *constantName_param = NULL, constants, constant; + zval className, constantName; zval *this_ptr = getThis(); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&constantName); + ZVAL_UNDEF(&constants); + ZVAL_UNDEF(&constant); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(className) + Z_PARAM_STR(constantName) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_BOOL(1); -} - -static PHP_METHOD(Phalcon_Logger_Adapter_Stream, getName) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &className_param, &constantName_param); + zephir_get_strval(&className, className_param); + zephir_get_strval(&constantName, constantName_param); - RETURN_MEMBER(getThis(), "name"); + ZEPHIR_CALL_METHOD(&constants, this_ptr, "getconstants", NULL, 0, &className); + zephir_check_call_status(); + if (!(zephir_array_isset_fetch(&constant, &constants, &constantName, 1))) { + object_init_ex(return_value, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_CTOR(&constant); } -static PHP_METHOD(Phalcon_Logger_Adapter_Stream, process) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getConstants) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, handler, message, _0, _1, _6, _7, _8, _2$$3, _3$$3, _4$$3, _5$$3; + zval *className_param = NULL, classAnnotations; + zval className; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item_sub); - ZVAL_UNDEF(&handler); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&classAnnotations); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) + Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); + zephir_fetch_params(1, 1, 0, &className_param); + zephir_get_strval(&className, className_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("mode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&handler, this_ptr, "phpfopen", NULL, 0, &_0, &_1); - zephir_check_call_status(); - if (!(Z_TYPE_P(&handler) == IS_RESOURCE)) { - ZEPHIR_INIT_VAR(&_2$$3); - object_init_ex(&_2$$3, spl_ce_LogicException); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("mode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_5$$3); - ZEPHIR_CONCAT_SVSVS(&_5$$3, "The file '", &_3$$3, "' cannot be opened with mode '", &_4$$3, "'"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 412, &_5$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$3, "phalcon/Logger/Adapter/Stream.zep", 119); - ZEPHIR_MM_RESTORE(); - return; - } - ZVAL_LONG(&_6, 2); - ZEPHIR_CALL_FUNCTION(NULL, "flock", NULL, 128, &handler, &_6); + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "getformatteditem", NULL, 0, item); + ZEPHIR_RETURN_CALL_METHOD(&classAnnotations, "getconstantsannotations", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_8); - ZEPHIR_GET_CONSTANT(&_8, "PHP_EOL"); - ZEPHIR_INIT_VAR(&message); - ZEPHIR_CONCAT_VV(&message, &_7, &_8); - zephir_fwrite(NULL, &handler, &message); - zephir_fclose(&handler); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Logger_Adapter_Stream, phpFopen) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getProperty) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *filename_param = NULL, *mode_param = NULL; - zval filename, mode; + zval *className_param = NULL, *propertyName_param = NULL, classAnnotations, properties, property; + zval className, propertyName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&filename); - ZVAL_UNDEF(&mode); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&propertyName); + ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&properties); + ZVAL_UNDEF(&property); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(filename) - Z_PARAM_STR(mode) + Z_PARAM_STR(className) + Z_PARAM_STR(propertyName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &filename_param, &mode_param); - zephir_get_strval(&filename, filename_param); - zephir_get_strval(&mode, mode_param); + zephir_fetch_params(1, 2, 0, &className_param, &propertyName_param); + zephir_get_strval(&className, className_param); + zephir_get_strval(&propertyName, propertyName_param); - ZEPHIR_RETURN_CALL_FUNCTION("fopen", NULL, 136, &filename, &mode); + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); zephir_check_call_status(); - RETURN_MM(); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Adapter_Syslog) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Adapter, Syslog, phalcon, logger_adapter_syslog, phalcon_logger_adapter_abstractadapter_ce, phalcon_logger_adapter_syslog_method_entry, 0); - - zend_declare_property_long(phalcon_logger_adapter_syslog_ce, SL("facility"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_logger_adapter_syslog_ce, SL("name"), "", ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_logger_adapter_syslog_ce, SL("opened"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_logger_adapter_syslog_ce, SL("option"), 0, ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_CALL_METHOD(&properties, &classAnnotations, "getpropertiesannotations", NULL, 0); + zephir_check_call_status(); + if (!(zephir_array_isset_fetch(&property, &properties, &propertyName, 1))) { + object_init_ex(return_value, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_CTOR(&property); } -static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, __construct) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getProperties) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval options; - zval *name_param = NULL, *options_param = NULL, facility, option; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *className_param = NULL, classAnnotations; + zval className; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&facility); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&classAnnotations); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &options_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); - } + zephir_fetch_params(1, 1, 0, &className_param); + zephir_get_strval(&className, className_param); - ZEPHIR_OBS_VAR(&facility); - if (!(zephir_array_isset_string_fetch(&facility, &options, SL("facility"), 0))) { - ZEPHIR_INIT_NVAR(&facility); - ZVAL_LONG(&facility, 8); - } - ZEPHIR_OBS_VAR(&option); - if (!(zephir_array_isset_string_fetch(&option, &options, SL("option"), 0))) { - ZEPHIR_INIT_NVAR(&option); - ZVAL_LONG(&option, 4); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - zephir_update_property_zval(this_ptr, ZEND_STRL("option"), &option); - zephir_update_property_zval(this_ptr, ZEND_STRL("facility"), &facility); - ZEPHIR_MM_RESTORE(); + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&classAnnotations, "getpropertiesannotations", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, close) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethod) { - zval _0; + zend_string *_3$$3; + zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *className_param = NULL, *methodName_param = NULL, classAnnotations, methods, method, methodKey, *_0$$3, _1$$3, _4$$4, _6$$6; + zval className, methodName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&methodName); + ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&methods); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&methodKey); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_6$$6); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(className) + Z_PARAM_STR(methodName) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &className_param, &methodName_param); + zephir_get_strval(&className, className_param); + zephir_get_strval(&methodName, methodName_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("opened"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_is_true(&_0))) { - RETURN_MM_BOOL(1); + + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&methods, &classAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methods) == IS_ARRAY) { + zephir_is_iterable(&methods, 0, "phalcon/Annotations/Adapter/AbstractAdapter.zep", 167); + if (Z_TYPE_P(&methods) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methods), _2$$3, _3$$3, _0$$3) + { + ZEPHIR_INIT_NVAR(&methodKey); + if (_3$$3 != NULL) { + ZVAL_STR_COPY(&methodKey, _3$$3); + } else { + ZVAL_LONG(&methodKey, _2$$3); + } + ZEPHIR_INIT_NVAR(&method); + ZVAL_COPY(&method, _0$$3); + ZEPHIR_CALL_FUNCTION(&_4$$4, "strcasecmp", &_5, 38, &methodKey, &methodName); + zephir_check_call_status(); + if (!(zephir_is_true(&_4$$4))) { + RETURN_CCTOR(&method); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &methods, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &methods, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&methodKey, &methods, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&method, &methods, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&_6$$6, "strcasecmp", &_5, 38, &methodKey, &methodName); + zephir_check_call_status(); + if (!(zephir_is_true(&_6$$6))) { + RETURN_CCTOR(&method); + } + ZEPHIR_CALL_METHOD(NULL, &methods, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&method); + ZEPHIR_INIT_NVAR(&methodKey); } - ZEPHIR_RETURN_CALL_FUNCTION("closelog", NULL, 413); + object_init_ex(return_value, phalcon_annotations_collection_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 37); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, process) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethods) { - zval _6$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, __$true, __$false, level, message, result, _0, _1, _2, _9, _3$$3, _4$$3, _5$$3, _7$$3, _8$$3; + zval *className_param = NULL, classAnnotations; + zval className; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&level); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&classAnnotations); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) + Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); + zephir_fetch_params(1, 1, 0, &className_param); + zephir_get_strval(&className, className_param); - ZEPHIR_CALL_METHOD(&message, this_ptr, "getformatteditem", NULL, 0, item); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("option"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_2, this_ptr, ZEND_STRL("facility"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, this_ptr, "openlog", NULL, 0, &_0, &_1, &_2); - zephir_check_call_status(); - if (!zephir_is_true(&result)) { - ZEPHIR_INIT_VAR(&_3$$3); - object_init_ex(&_3$$3, spl_ce_LogicException); - zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("name"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_5$$3); - zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("facility"), PH_NOISY_CC); - zephir_cast_to_string(&_6$$3, &_5$$3); - ZEPHIR_INIT_VAR(&_7$$3); - ZVAL_STRING(&_7$$3, "Cannot open syslog for name [%s] and facility [%s]"); - ZEPHIR_CALL_FUNCTION(&_8$$3, "sprintf", NULL, 113, &_7$$3, &_4$$3, &_6$$3); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 412, &_8$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$3, "phalcon/Logger/Adapter/Syslog.zep", 106); - ZEPHIR_MM_RESTORE(); - return; - } - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("opened"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("opened"), &__$false); - } - ZEPHIR_CALL_METHOD(&_9, item, "getlevel", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&level, this_ptr, "logleveltosyslog", NULL, 414, &_9); + ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(NULL, "syslog", NULL, 415, &level, &message); + ZEPHIR_RETURN_CALL_METHOD(&classAnnotations, "getmethodsannotations", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, openlog) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getReader) { + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long option, facility, ZEPHIR_LAST_CALL_STATUS; - zval *ident_param = NULL, *option_param = NULL, *facility_param = NULL, _0, _1; - zval ident; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&ident); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(ident) - Z_PARAM_LONG(option) - Z_PARAM_LONG(facility) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &ident_param, &option_param, &facility_param); - zephir_get_strval(&ident, ident_param); - option = zephir_get_intval(option_param); - facility = zephir_get_intval(facility_param); + zephir_read_property(&_0, this_ptr, ZEND_STRL("reader"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_annotations_reader_ce); + if (zephir_has_constructor(&_1$$3)) { + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 0); + zephir_check_call_status(); + } - ZVAL_LONG(&_0, option); - ZVAL_LONG(&_1, facility); - ZEPHIR_RETURN_CALL_FUNCTION("openlog", NULL, 416, &ident, &_0, &_1); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("reader"), &_1$$3); + } + RETURN_MM_MEMBER(getThis(), "reader"); } -static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, logLevelToSyslog) +static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, setReader) { - zval levels; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *level_param = NULL, result; - zend_long level; + zval *reader, reader_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&levels); + ZVAL_UNDEF(&reader_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(level) + Z_PARAM_OBJECT_OF_CLASS(reader, phalcon_annotations_readerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &level_param); - level = zephir_get_intval(level_param); + zephir_fetch_params_without_memory_grow(1, 0, &reader); - ZEPHIR_INIT_VAR(&levels); - zephir_create_array(&levels, 9, 0); - add_index_long(&levels, 2, 1); - add_index_long(&levels, 1, 2); - add_index_long(&levels, 8, 3); - add_index_long(&levels, 7, 7); - add_index_long(&levels, 0, 0); - add_index_long(&levels, 3, 3); - add_index_long(&levels, 6, 6); - add_index_long(&levels, 5, 5); - add_index_long(&levels, 4, 4); - ZEPHIR_OBS_VAR(&result); - if (!(zephir_array_isset_long_fetch(&result, &levels, level, 0))) { - ZEPHIR_INIT_NVAR(&result); - ZVAL_LONG(&result, 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("reader"), reader); +} + +zend_object *zephir_init_properties_Phalcon_Annotations_Adapter_AbstractAdapter(zend_class_entry *class_type) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("annotations"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("annotations"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - RETURN_CCTOR(&result); } @@ -36260,97 +36772,169 @@ static PHP_METHOD(Phalcon_Logger_Adapter_Syslog, logLevelToSyslog) -ZEPHIR_INIT_CLASS(Phalcon_Logger_Formatter_AbstractFormatter) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_AdapterInterface) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Formatter, AbstractFormatter, phalcon, logger_formatter_abstractformatter, phalcon_support_helper_str_abstractstr_ce, phalcon_logger_formatter_abstractformatter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations\\Adapter, AdapterInterface, phalcon, annotations_adapter_adapterinterface, phalcon_annotations_adapter_adapterinterface_method_entry); - zend_declare_property_string(phalcon_logger_formatter_abstractformatter_ce, SL("dateFormat"), "c", ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_logger_formatter_abstractformatter_ce, 1, phalcon_logger_formatter_formatterinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Formatter_AbstractFormatter, getDateFormat) -{ - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, get); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getConstant); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getConstants); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getProperty); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getProperties); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getMethod); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getMethods); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getReader); +ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, setReader); - RETURN_MEMBER(getThis(), "dateFormat"); +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Apcu) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Apcu, phalcon, annotations_adapter_apcu, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_apcu_method_entry, 0); + + zend_declare_property_string(phalcon_annotations_adapter_apcu_ce, SL("prefix"), "", ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_annotations_adapter_apcu_ce, SL("ttl"), 172800, ZEND_ACC_PROTECTED); + return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Formatter_AbstractFormatter, getFormattedDate) +static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, _0, _1; + zval *options_param = NULL, prefix, ttl; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&ttl); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); + zephir_fetch_params(1, 0, 1, &options_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } - ZEPHIR_CALL_METHOD(&_0, item, "getdatetime", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dateFormat"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "format", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + if (zephir_array_isset_string_fetch(&prefix, &options, SL("prefix"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("prefix"), &prefix); + } + if (zephir_array_isset_string_fetch(&ttl, &options, SL("lifetime"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("ttl"), &ttl); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Logger_Formatter_AbstractFormatter, setDateFormat) +static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, read) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *format_param = NULL; - zval format; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, _0, _1, _2; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&format); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(format) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &format_param); - zephir_get_strval(&format, format_param); + zephir_fetch_params(1, 1, 0, &key_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("dateFormat"), &format); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); + zephir_fast_strtolower(&_0, &_2); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 106, &_0); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, write) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *data, data_sub, _0, _1, _2, _3; + zval key; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_OBJECT_OF_CLASS(data, phalcon_annotations_reflection_ce) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &data); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + } - -ZEPHIR_INIT_CLASS(Phalcon_Logger_Formatter_FormatterInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Logger\\Formatter, FormatterInterface, phalcon, logger_formatter_formatterinterface, phalcon_logger_formatter_formatterinterface_method_entry); - - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); + zephir_fast_strtolower(&_0, &_2); + zephir_read_property(&_3, this_ptr, ZEND_STRL("ttl"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 107, &_0, data, &_3); + zephir_check_call_status(); + RETURN_MM(); } -ZEPHIR_DOC_METHOD(Phalcon_Logger_Formatter_FormatterInterface, format); @@ -36361,90 +36945,91 @@ ZEPHIR_DOC_METHOD(Phalcon_Logger_Formatter_FormatterInterface, format); -ZEPHIR_INIT_CLASS(Phalcon_Logger_Formatter_Json) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Memory) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Formatter, Json, phalcon, logger_formatter_json, phalcon_logger_formatter_abstractformatter_ce, phalcon_logger_formatter_json_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Memory, phalcon, annotations_adapter_memory, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_memory_method_entry, 0); + zend_declare_property_null(phalcon_annotations_adapter_memory_ce, SL("data"), ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Formatter_Json, __construct) +static PHP_METHOD(Phalcon_Annotations_Adapter_Memory, read) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *dateFormat_param = NULL; - zval dateFormat; + zval *key_param = NULL, data, _0, _1; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&dateFormat); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(dateFormat) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &dateFormat_param); - if (!dateFormat_param) { - ZEPHIR_INIT_VAR(&dateFormat); - ZVAL_STRING(&dateFormat, "c"); + zephir_fetch_params(1, 1, 0, &key_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - zephir_get_strval(&dateFormat, dateFormat_param); + ZEPHIR_INIT_VAR(&key); } - zephir_update_property_zval(this_ptr, ZEND_STRL("dateFormat"), &dateFormat); - ZEPHIR_MM_RESTORE(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_fast_strtolower(&_1, &key); + if (!(zephir_array_isset_fetch(&data, &_0, &_1, 1))) { + RETURN_MM_BOOL(0); + } + RETURN_CTOR(&data); } -static PHP_METHOD(Phalcon_Logger_Formatter_Json, format) +static PHP_METHOD(Phalcon_Annotations_Adapter_Memory, write) { - zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, message, options, _0, _1, _3; + zval *key_param = NULL, *data, data_sub, lowercasedKey; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item_sub); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&lowercasedKey); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_OBJECT_OF_CLASS(data, phalcon_annotations_reflection_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); + zephir_fetch_params(1, 2, 0, &key_param, &data); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + } - ZEPHIR_INIT_VAR(&options); - ZVAL_LONG(&options, (((((1 + 4) + 2) + 8) + 64) + 4194304)); - ZEPHIR_CALL_METHOD(&_0, item, "getmessage", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, item, "getcontext", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&message, this_ptr, "tointerpolate", NULL, 0, &_0, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - zephir_create_array(&_2, 3, 0); - ZEPHIR_CALL_METHOD(&_3, item, "getlevelname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_string(&_2, SL("level"), &_3, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_2, SL("message"), &message, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getformatteddate", NULL, 0, item); - zephir_check_call_status(); - zephir_array_update_string(&_2, SL("timestamp"), &_3, PH_COPY | PH_SEPARATE); - zephir_json_encode(return_value, &_2, zephir_get_intval(&options) ); - RETURN_MM(); + ZEPHIR_INIT_VAR(&lowercasedKey); + zephir_fast_strtolower(&lowercasedKey, &key); + zephir_update_property_array(this_ptr, SL("data"), &lowercasedKey, data); + ZEPHIR_MM_RESTORE(); } @@ -36457,132 +37042,194 @@ static PHP_METHOD(Phalcon_Logger_Formatter_Json, format) -ZEPHIR_INIT_CLASS(Phalcon_Logger_Formatter_Line) +ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Stream) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Logger\\Formatter, Line, phalcon, logger_formatter_line, phalcon_logger_formatter_abstractformatter_ce, phalcon_logger_formatter_line_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Stream, phalcon, annotations_adapter_stream, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_stream_method_entry, 0); - zend_declare_property_null(phalcon_logger_formatter_line_ce, SL("format"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_annotations_adapter_stream_ce, SL("annotationsDir"), "./", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Logger_Formatter_Line, __construct) +static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *format_param = NULL, *dateFormat_param = NULL; - zval format, dateFormat; + zval *options_param = NULL, annotationsDir; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&format); - ZVAL_UNDEF(&dateFormat); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&annotationsDir); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 2) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR(format) - Z_PARAM_STR(dateFormat) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, &format_param, &dateFormat_param); - if (!format_param) { - ZEPHIR_INIT_VAR(&format); - ZVAL_STRING(&format, "[%date%][%level%] %message%"); - } else { - zephir_get_strval(&format, format_param); - } - if (!dateFormat_param) { - ZEPHIR_INIT_VAR(&dateFormat); - ZVAL_STRING(&dateFormat, "c"); + zephir_fetch_params(1, 0, 1, &options_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - zephir_get_strval(&dateFormat, dateFormat_param); + zephir_get_arrval(&options, options_param); } - zephir_update_property_zval(this_ptr, ZEND_STRL("format"), &format); - zephir_update_property_zval(this_ptr, ZEND_STRL("dateFormat"), &dateFormat); + if (zephir_array_isset_string_fetch(&annotationsDir, &options, SL("annotationsDir"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("annotationsDir"), &annotationsDir); + } ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Logger_Formatter_Line, format) +static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, read) { - zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *item, item_sub, message, _0, _2; + zval *key_param = NULL, __$false, contents, version, _0, _1, _2, _3, _4, _5, _6, _11, _7$$5, _8$$5, _9$$6, _10$$6; + zval key, path; zval *this_ptr = getThis(); - ZVAL_UNDEF(&item_sub); - ZVAL_UNDEF(&message); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&path); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&contents); + ZVAL_UNDEF(&version); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_11); + ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_8$$5); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(item, phalcon_logger_item_ce) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &item); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("format"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotationsDir"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_1); - zephir_create_array(&_1, 3, 0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getformatteddate", NULL, 0, item); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("%date%"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_2, item, "getlevelname", NULL, 0); - zephir_check_call_status(); - zephir_array_update_string(&_1, SL("%level%"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&_2, item, "getmessage", NULL, 0); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "_"); + zephir_prepare_virtual_path(&_1, &key, &_2); + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_CONCAT_VVS(&_3, &_0, &_1, ".php"); + zephir_get_strval(&path, &_3); + if (!((zephir_file_exists(&path) == SUCCESS))) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(&contents); + zephir_file_get_contents(&contents, &path); + if (UNEXPECTED(ZEPHIR_IS_EMPTY(&contents))) { + RETURN_MM_BOOL(0); + } + ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); + ZEPHIR_CALL_FUNCTION(&version, "phpversion", NULL, 132); zephir_check_call_status(); - zephir_array_update_string(&_1, SL("%message%"), &_2, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&message, "strtr", NULL, 5, &_0, &_1); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "8.0"); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, ">="); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 133, &version, &_4, &_5); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, item, "getcontext", NULL, 0); + if (zephir_is_true(&_6)) { + ZEPHIR_INIT_VAR(&_7$$5); + ZEPHIR_INIT_NVAR(&_7$$5); + zephir_create_closure_ex(&_7$$5, NULL, phalcon_5__closure_ce, SL("__invoke")); + ZVAL_LONG(&_8$$5, 2); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_7$$5, &_8$$5); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(&_9$$6); + ZEPHIR_INIT_NVAR(&_9$$6); + zephir_create_closure_ex(&_9$$6, NULL, phalcon_6__closure_ce, SL("__invoke")); + ZVAL_LONG(&_10$$6, 2); + ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 134, &_9$$6, &_10$$6); + zephir_check_call_status(); + } + ZEPHIR_CALL_FUNCTION(&_11, "unserialize", NULL, 16, &contents); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "tointerpolate", NULL, 0, &message, &_2); + ZEPHIR_CPY_WRT(&contents, &_11); + ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 135); zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Logger_Formatter_Line, getFormat) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "format"); + if (UNEXPECTED(ZEPHIR_GLOBAL(warning).enable)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Cannot read annotation data", "phalcon/Annotations/Adapter/Stream.zep", 102); + return; + } + RETURN_CCTOR(&contents); } -static PHP_METHOD(Phalcon_Logger_Formatter_Line, setFormat) +static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, write) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *format_param = NULL; - zval format; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *data, data_sub, code, _0, _1, _2, _3, _4; + zval key, path; zval *this_ptr = getThis(); - ZVAL_UNDEF(&format); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&path); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&code); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(format) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_OBJECT_OF_CLASS(data, phalcon_annotations_reflection_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &format_param); - zephir_get_strval(&format, format_param); + zephir_fetch_params(1, 2, 0, &key_param, &data); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("format"), &format); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("annotationsDir"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "_"); + zephir_prepare_virtual_path(&_1, &key, &_2); + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_CONCAT_VVS(&_3, &_0, &_1, ".php"); + zephir_get_strval(&path, &_3); + ZEPHIR_CALL_FUNCTION(&code, "serialize", NULL, 15, data); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_4); + zephir_file_put_contents(&_4, &path, &code); + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_4))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written", "phalcon/Annotations/Adapter/Stream.zep", 123); + return; + } + ZEPHIR_MM_RESTORE(); } @@ -36595,325 +37242,495 @@ static PHP_METHOD(Phalcon_Logger_Formatter_Line, setFormat) -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_AbstractConditions) +ZEPHIR_INIT_CLASS(Phalcon_Cache_AbstractCache) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, AbstractConditions, phalcon, datamapper_query_abstractconditions, phalcon_datamapper_query_abstractquery_ce, phalcon_datamapper_query_abstractconditions_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS(Phalcon\\Cache, AbstractCache, phalcon, cache_abstractcache, phalcon_cache_abstractcache_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_declare_property_null(phalcon_cache_abstractcache_ce, SL("adapter"), ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_cache_abstractcache_ce, 1, phalcon_cache_cacheinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, limit) +static PHP_METHOD(Phalcon_Cache_AbstractCache, __construct) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *limit_param = NULL, _0, _1; - zend_long limit; + zval *adapter, adapter_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&adapter_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(limit) + Z_PARAM_OBJECT_OF_CLASS(adapter, phalcon_cache_adapter_adapterinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &limit_param); - limit = zephir_get_intval(limit_param); + zephir_fetch_params_without_memory_grow(1, 0, &adapter); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "LIMIT"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, limit); - zephir_update_property_array(this_ptr, SL("store"), &_0, &_1); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), adapter); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, offset) +static PHP_METHOD(Phalcon_Cache_AbstractCache, getAdapter) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "adapter"); +} + +static PHP_METHOD(Phalcon_Cache_AbstractCache, checkKey) { + zend_class_entry *_6$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *offset_param = NULL, _0, _1; - zend_long offset; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, exception, _0, _1, _2, _3, _4$$3, _5$$3, _7$$3; + zval key; zval *this_ptr = getThis(); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&exception); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_7$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(offset) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &offset_param); - offset = zephir_get_intval(offset_param); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "OFFSET"); ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, offset); - zephir_update_property_array(this_ptr, SL("store"), &_0, &_1); - RETURN_THIS(); + ZVAL_STRING(&_1, "/[^A-Za-z0-9-_.]/"); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "/[^A-Za-z0-9-_.]/"); + zephir_preg_match(&_2, &_3, &key, &_0, 0, 0 , 0 ); + if (zephir_is_true(&_2)) { + ZEPHIR_CALL_METHOD(&exception, this_ptr, "getexceptionclass", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_4$$3); + zephir_fetch_safe_class(&_5$$3, &exception); + _6$$3 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_5$$3), Z_STRLEN_P(&_5$$3), ZEND_FETCH_CLASS_AUTO); + if(!_6$$3) { + RETURN_MM_NULL(); + } + object_init_ex(&_4$$3, _6$$3); + ZEPHIR_INIT_VAR(&_7$$3); + ZVAL_STRING(&_7$$3, "The key contains invalid characters"); + ZEPHIR_CALL_METHOD(NULL, &_4$$3, "__construct", NULL, 0, &_7$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_4$$3, "phalcon/Cache/AbstractCache.zep", 65); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, andWhere) +static PHP_METHOD(Phalcon_Cache_AbstractCache, checkKeys) { + zend_class_entry *_3$$3; + zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0; - zval condition; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *keys, keys_sub, exception, _1$$3, _2$$3, _4$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&keys_sub); + ZVAL_UNDEF(&exception); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(keys) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; + zephir_fetch_params(1, 1, 0, &keys); + + + _0 = Z_TYPE_P(keys) == IS_ARRAY; + if (!(_0)) { + _0 = zephir_zval_is_traversable(keys); } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); + if (!(_0)) { + ZEPHIR_CALL_METHOD(&exception, this_ptr, "getexceptionclass", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1$$3); + zephir_fetch_safe_class(&_2$$3, &exception); + _3$$3 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_2$$3), Z_STRLEN_P(&_2$$3), ZEND_FETCH_CLASS_AUTO); + if(!_3$$3) { + RETURN_MM_NULL(); + } + object_init_ex(&_1$$3, _3$$3); + ZEPHIR_INIT_VAR(&_4$$3); + ZVAL_STRING(&_4$$3, "The keys need to be an array or instance of Traversable"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 0, &_4$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Cache/AbstractCache.zep", 84); + ZEPHIR_MM_RESTORE(); + return; } + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Cache_AbstractCache, doClear) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - ZVAL_LONG(&_0, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", NULL, 0, &condition, value, &_0); + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "clear", NULL, 0); zephir_check_call_status(); - RETURN_THIS(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, appendWhere) +static PHP_METHOD(Phalcon_Cache_AbstractCache, doDelete) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1; - zval condition; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, _0; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "WHERE"); - ZVAL_LONG(&_1, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendcondition", NULL, 0, &_0, &condition, value, &_1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkey", NULL, 0, &key); zephir_check_call_status(); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "delete", NULL, 0, &key); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, orderBy) +static PHP_METHOD(Phalcon_Cache_AbstractCache, doDeleteMultiple) { + zend_bool result = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *orderBy, orderBy_sub, _0; + zval *keys, keys_sub, key, *_0, _1, _2$$3, _3$$3, _4$$5, _5$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&orderBy_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&keys_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(orderBy) + Z_PARAM_ZVAL(keys) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &orderBy); + zephir_fetch_params(1, 1, 0, &keys); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "ORDER"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processvalue", NULL, 0, &_0, orderBy); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkeys", NULL, 0, keys); zephir_check_call_status(); - RETURN_THIS(); + result = 1; + zephir_is_iterable(keys, 0, "phalcon/Cache/AbstractCache.zep", 132); + if (Z_TYPE_P(keys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), _0) + { + ZEPHIR_INIT_NVAR(&key); + ZVAL_COPY(&key, _0); + zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_3$$3, &_2$$3, "delete", NULL, 0, &key); + zephir_check_call_status(); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&_3$$3)) { + result = 0; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, keys, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, keys, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, keys, "current", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_4$$5, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_5$$5, &_4$$5, "delete", NULL, 0, &key); + zephir_check_call_status(); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&_5$$5)) { + result = 0; + } + ZEPHIR_CALL_METHOD(NULL, keys, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&key); + RETURN_MM_BOOL(result); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, orWhere) +static PHP_METHOD(Phalcon_Cache_AbstractCache, doGet) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; - zval condition; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, _0; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&defaultValue_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(key) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &key_param, &defaultValue); + zephir_get_strval(&key, key_param); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; + } + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkey", NULL, 0, &key); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "get", NULL, 0, &key, defaultValue); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Cache_AbstractCache, doGetMultiple) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_3 = NULL, *_5 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *keys, keys_sub, *defaultValue = NULL, defaultValue_sub, __$null, element, results, *_0, _1, _2$$3, _4$$4; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&keys_sub); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&results); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(keys) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + Z_PARAM_ZVAL_OR_NULL(defaultValue) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; + zephir_fetch_params(1, 1, 1, &keys, &defaultValue); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; } - if (!type_param) { - type = -1; + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkeys", NULL, 0, keys); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&results); + array_init(&results); + zephir_is_iterable(keys, 0, "phalcon/Cache/AbstractCache.zep", 168); + if (Z_TYPE_P(keys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), _0) + { + ZEPHIR_INIT_NVAR(&element); + ZVAL_COPY(&element, _0); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "get", &_3, 0, &element, defaultValue); + zephir_check_call_status(); + zephir_array_update_zval(&results, &element, &_2$$3, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); } else { - type = zephir_get_intval(type_param); + ZEPHIR_CALL_METHOD(NULL, keys, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, keys, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&element, keys, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$4, this_ptr, "get", &_5, 0, &element, defaultValue); + zephir_check_call_status(); + zephir_array_update_zval(&results, &element, &_4$$4, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, keys, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&element); + RETURN_CCTOR(&results); +} + +static PHP_METHOD(Phalcon_Cache_AbstractCache, doHas) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, _0; + zval key; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) + ZEND_PARSE_PARAMETERS_END(); +#endif - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "WHERE"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "OR "); - ZVAL_LONG(&_2, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); + + + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkey", NULL, 0, &key); zephir_check_call_status(); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "has", NULL, 0, &key); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, where) +static PHP_METHOD(Phalcon_Cache_AbstractCache, doSet) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; - zval condition; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null, _0; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&ttl_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + Z_PARAM_ZVAL_OR_NULL(ttl) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); + zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); + zephir_get_strval(&key, key_param); + if (!ttl) { + ttl = &ttl_sub; + ttl = &__$null; } - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "WHERE"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "AND "); - ZVAL_LONG(&_2, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkey", NULL, 0, &key); zephir_check_call_status(); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "set", NULL, 0, &key, value, ttl); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, whereEquals) +static PHP_METHOD(Phalcon_Cache_AbstractCache, doSetMultiple) { zend_string *_3; zend_ulong _2; + zend_bool result = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; + zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *columnsValues_param = NULL, key, value, *_0, _1, _5$$5, _6$$6, _7$$7, _8$$10, _9$$11, _10$$12; - zval columnsValues; + zval *values, values_sub, *ttl = NULL, ttl_sub, __$null, key, value, *_0, _1, _4$$3, _6$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columnsValues); + ZVAL_UNDEF(&values_sub); + ZVAL_UNDEF(&ttl_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&key); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_9$$11); - ZVAL_UNDEF(&_10$$12); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_6$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columnsValues) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(values) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(ttl) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columnsValues_param); - zephir_get_arrval(&columnsValues, columnsValues_param); + zephir_fetch_params(1, 1, 1, &values, &ttl); + if (!ttl) { + ttl = &ttl_sub; + ttl = &__$null; + } - zephir_is_iterable(&columnsValues, 0, "phalcon/DataMapper/Query/AbstractConditions.zep", 162); - if (Z_TYPE_P(&columnsValues) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columnsValues), _2, _3, _0) + ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkkeys", NULL, 0, values); + zephir_check_call_status(); + result = 1; + zephir_is_iterable(values, 0, "phalcon/Cache/AbstractCache.zep", 229); + if (Z_TYPE_P(values) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(values), _2, _3, _0) { ZEPHIR_INIT_NVAR(&key); if (_3 != NULL) { @@ -36923,1019 +37740,577 @@ static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, whereEquals) } ZEPHIR_INIT_NVAR(&value); ZVAL_COPY(&value, _0); - if (zephir_is_numeric(&key)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &value); - zephir_check_call_status(); - } else if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_5$$5); - ZEPHIR_CONCAT_VS(&_5$$5, &key, " IS NULL"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_5$$5); - zephir_check_call_status(); - } else if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_6$$6); - ZEPHIR_CONCAT_VS(&_6$$6, &key, " IN "); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_6$$6, &value); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_7$$7); - ZEPHIR_CONCAT_VS(&_7$$7, &key, " = "); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_7$$7, &value); - zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "set", &_5, 0, &key, &value, ttl); + zephir_check_call_status(); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&_4$$3)) { + result = 0; } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &columnsValues, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, values, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &columnsValues, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1, values, "valid", NULL, 0); zephir_check_call_status(); if (!zend_is_true(&_1)) { break; } - ZEPHIR_CALL_METHOD(&key, &columnsValues, "key", NULL, 0); + ZEPHIR_CALL_METHOD(&key, values, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &columnsValues, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&value, values, "current", NULL, 0); zephir_check_call_status(); - if (zephir_is_numeric(&key)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &value); - zephir_check_call_status(); - } else if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_8$$10); - ZEPHIR_CONCAT_VS(&_8$$10, &key, " IS NULL"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_8$$10); - zephir_check_call_status(); - } else if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_9$$11); - ZEPHIR_CONCAT_VS(&_9$$11, &key, " IN "); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_9$$11, &value); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_10$$12); - ZEPHIR_CONCAT_VS(&_10$$12, &key, " = "); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "where", &_4, 0, &_10$$12, &value); - zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_6$$5, this_ptr, "set", &_7, 0, &key, &value, ttl); + zephir_check_call_status(); + if (!ZEPHIR_IS_TRUE_IDENTICAL(&_6$$5)) { + result = 0; } - ZEPHIR_CALL_METHOD(NULL, &columnsValues, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, values, "next", NULL, 0); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(&value); ZEPHIR_INIT_NVAR(&key); - RETURN_THIS(); + RETURN_MM_BOOL(result); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, addCondition) +static PHP_METHOD(Phalcon_Cache_AbstractCache, getExceptionClass) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *store_param = NULL, *andor_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0$$3, _1$$3, _2, _3; - zval store, andor, condition, _4; - zval *this_ptr = getThis(); +} - ZVAL_UNDEF(&store); - ZVAL_UNDEF(&andor); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STR(store) - Z_PARAM_STR(andor) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &store_param, &andor_param, &condition_param, &value, &type_param); - zephir_get_strval(&store, store_param); - zephir_get_strval(&andor, andor_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - if (!(ZEPHIR_IS_EMPTY(value))) { - ZVAL_LONG(&_1$$3, type); - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "bindinline", NULL, 0, value, &_1$$3); - zephir_check_call_status(); - zephir_concat_self(&condition, &_0$$3); - } - zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_3, &_2, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 185); - if (ZEPHIR_IS_EMPTY(&_3)) { - ZEPHIR_INIT_NVAR(&andor); - } - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_VV(&_4, &andor, &condition); - zephir_update_property_array_multi(this_ptr, SL("store"), &_4, SL("za"), 2, &store); - ZEPHIR_MM_RESTORE(); + +ZEPHIR_INIT_CLASS(Phalcon_Cache_AdapterFactory) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache, AdapterFactory, phalcon, cache_adapterfactory, phalcon_factory_abstractfactory_ce, phalcon_cache_adapterfactory_method_entry, 0); + + zend_declare_property_null(phalcon_cache_adapterfactory_ce, SL("serializerFactory"), ZEND_ACC_PRIVATE); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildBy) +static PHP_METHOD(Phalcon_Cache_AdapterFactory, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, _0, _1, _2, _3, _4, _5; - zval type; + zval services; + zval *factory, factory_sub, *services_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&factory_sub); + ZVAL_UNDEF(&services); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(type) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_storage_serializerfactory_ce) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(services) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &type_param); - zephir_get_strval(&type, type_param); + zephir_fetch_params(1, 1, 1, &factory, &services_param); + if (!services_param) { + ZEPHIR_INIT_VAR(&services); + array_init(&services); + } else { + ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_1, &_0, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 201); - if (ZEPHIR_IS_EMPTY(&_1)) { - RETURN_MM_STRING(""); - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4, &_3, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 206); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, ","); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4, &_5); + zephir_update_property_zval(this_ptr, ZEND_STRL("serializerFactory"), factory); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSV(return_value, " ", &type, " BY", &_2); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildCondition) +static PHP_METHOD(Phalcon_Cache_AdapterFactory, newInstance) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, _0, _1, _2, _3, _4; - zval type; + zval options, _0; + zval *name_param = NULL, *options_param = NULL, definition, _1; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&definition); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(type) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(name) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &type_param); - zephir_get_strval(&type, type_param); + zephir_fetch_params(1, 1, 1, &name_param, &options_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); + } else { + ZEPHIR_INIT_VAR(&name); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_1, &_0, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 218); - if (ZEPHIR_IS_EMPTY(&_1)) { - RETURN_MM_STRING(""); - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_4, &_3, &type, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 223); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4); + ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + ZEPHIR_OBS_VAR(&_1); + zephir_read_property(&_1, this_ptr, ZEND_STRL("serializerFactory"), PH_NOISY_CC); + zephir_array_fast_append(&_0, &_1); + zephir_array_fast_append(&_0, &options); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_0); zephir_check_call_status(); - ZEPHIR_CONCAT_SVV(return_value, " ", &type, &_2); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitEarly) +static PHP_METHOD(Phalcon_Cache_AdapterFactory, getExceptionClass) { - zend_bool _3, _6; - zval _0, _1, _2, _4, _5, _7, _8, _9$$3, _10$$3, _11$$3; - zval limit; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - - ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&limit); - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "getdrivername", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "sqlsrv"); - _3 = ZEPHIR_IS_IDENTICAL(&_2, &_1); - if (_3) { - zephir_read_property(&_4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_5, &_4, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 237); - _3 = ZEPHIR_GT_LONG(&_5, 0); - } - _6 = _3; - if (_6) { - zephir_read_property(&_7, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_8, &_7, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 239); - _6 = ZEPHIR_IS_LONG_IDENTICAL(&_8, 0); - } - if (_6) { - zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_10$$3, &_9$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 240); - ZEPHIR_INIT_VAR(&_11$$3); - ZEPHIR_CONCAT_SV(&_11$$3, " TOP ", &_10$$3); - zephir_get_strval(&limit, &_11$$3); - } - RETURN_CTOR(&limit); + RETURN_STRING("Phalcon\\Cache\\Exception\\Exception"); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimit) +static PHP_METHOD(Phalcon_Cache_AdapterFactory, getServices) { - zval method, suffix, _0, _1, _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&suffix); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&suffix, &_0, "getdrivername", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "sqlsrv"); - if (!ZEPHIR_IS_IDENTICAL(&_1, &suffix)) { - ZEPHIR_INIT_NVAR(&suffix); - ZVAL_STRING(&suffix, "common"); - } - ZEPHIR_INIT_VAR(&_2); - zephir_ucfirst(&_2, &suffix); - ZEPHIR_INIT_VAR(&method); - ZEPHIR_CONCAT_SV(&method, "buildLimit", &_2); - ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &method, NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + zephir_create_array(return_value, 6, 0); + add_assoc_stringl_ex(return_value, SL("apcu"), SL("Phalcon\\Cache\\Adapter\\Apcu")); + add_assoc_stringl_ex(return_value, SL("libmemcached"), SL("Phalcon\\Cache\\Adapter\\Libmemcached")); + add_assoc_stringl_ex(return_value, SL("memory"), SL("Phalcon\\Cache\\Adapter\\Memory")); + add_assoc_stringl_ex(return_value, SL("redis"), SL("Phalcon\\Cache\\Adapter\\Redis")); + add_assoc_stringl_ex(return_value, SL("stream"), SL("Phalcon\\Cache\\Adapter\\Stream")); + add_assoc_stringl_ex(return_value, SL("weak"), SL("Phalcon\\Cache\\Adapter\\Weak")); + return; } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitCommon) -{ - zval _0, _1, _5, _6, _10, _2$$3, _3$$3, _4$$3, _7$$4, _8$$4, _9$$4, _11$$5, _12$$5; - zval limit; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&_12$$5); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_INIT_VAR(&limit); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 275); - if (!ZEPHIR_IS_LONG_IDENTICAL(&_1, 0)) { - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_3$$3, &_2$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 276); - ZEPHIR_INIT_VAR(&_4$$3); - ZEPHIR_CONCAT_SV(&_4$$3, "LIMIT ", &_3$$3); - zephir_concat_self(&limit, &_4$$3); - } - zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_6, &_5, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 279); - if (!ZEPHIR_IS_LONG_IDENTICAL(&_6, 0)) { - zephir_read_property(&_7$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_8$$4, &_7$$4, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 280); - ZEPHIR_INIT_VAR(&_9$$4); - ZEPHIR_CONCAT_SV(&_9$$4, " OFFSET ", &_8$$4); - zephir_concat_self(&limit, &_9$$4); - } - ZEPHIR_INIT_VAR(&_10); - ZVAL_STRING(&_10, ""); - if (!ZEPHIR_IS_IDENTICAL(&_10, &limit)) { - ZEPHIR_INIT_VAR(&_11$$5); - zephir_fast_trim(&_11$$5, &limit, NULL , ZEPHIR_TRIM_LEFT); - ZEPHIR_INIT_VAR(&_12$$5); - ZEPHIR_CONCAT_SV(&_12$$5, " ", &_11$$5); - zephir_get_strval(&limit, &_12$$5); - } - RETURN_CTOR(&limit); + + + + +ZEPHIR_INIT_CLASS(Phalcon_Cache_Cache) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache, Cache, phalcon, cache_cache, phalcon_cache_abstractcache_ce, phalcon_cache_cache_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, buildLimitSqlsrv) +static PHP_METHOD(Phalcon_Cache_Cache, clear) { - zend_bool _2; - zval _0, _1, _3, _4, _5$$3, _6$$3, _7$$3, _8$$3, _9$$3; - zval limit; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$3); ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&limit); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 299); - _2 = ZEPHIR_GT_LONG(&_1, 0); - if (_2) { - zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_4, &_3, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 299); - _2 = ZEPHIR_GT_LONG(&_4, 0); - } - if (_2) { - zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_6$$3, &_5$$3, SL("OFFSET"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 300); - zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_8$$3, &_7$$3, SL("LIMIT"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 301); - ZEPHIR_INIT_VAR(&_9$$3); - ZEPHIR_CONCAT_SVSSVS(&_9$$3, " OFFSET ", &_6$$3, " ROWS", " FETCH NEXT ", &_8$$3, " ROWS ONLY"); - zephir_get_strval(&limit, &_9$$3); - } - RETURN_CTOR(&limit); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doclear", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, appendCondition) +static PHP_METHOD(Phalcon_Cache_Cache, delete) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *store_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, key, _2, _3, _5, _6, _7, _8, _9, _10, _0$$3, _1$$3, _4$$4; - zval store, condition; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&store); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_4$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR(store) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 2, &store_param, &condition_param, &value, &type_param); - zephir_get_strval(&store, store_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params(1, 1, 0, &key_param); + zephir_get_strval(&key, key_param); - if (!(ZEPHIR_IS_EMPTY(value))) { - ZVAL_LONG(&_1$$3, type); - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "bindinline", NULL, 0, value, &_1$$3); - zephir_check_call_status(); - zephir_concat_self(&condition, &_0$$3); - } - zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_3, &_2, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 327); - if (ZEPHIR_IS_EMPTY(&_3)) { - ZEPHIR_INIT_VAR(&_4$$4); - ZVAL_STRING(&_4$$4, ""); - zephir_update_property_array_multi(this_ptr, SL("store"), &_4$$4, SL("za"), 2, &store); - } - zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_6, &_5, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 331); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_6); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dodelete", NULL, 0, &key); zephir_check_call_status(); - zephir_read_property(&_7, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_8, &_7, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 333); - zephir_array_fetch(&_9, &_8, &key, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 333); - ZEPHIR_INIT_VAR(&_10); - ZEPHIR_CONCAT_VV(&_10, &_9, &condition); - zephir_update_property_array_multi(this_ptr, SL("store"), &_10, SL("zz"), 2, &store, &key); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractConditions, processValue) +static PHP_METHOD(Phalcon_Cache_Cache, deleteMultiple) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *store_param = NULL, *data = NULL, data_sub, _0$$3, _1$$4, _2$$4, _3$$4; - zval store; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *keys, keys_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&store); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&keys_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(store) - Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(keys) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &store_param, &data); - zephir_get_strval(&store, store_param); - ZEPHIR_SEPARATE_PARAM(data); - - - if (Z_TYPE_P(data) == IS_STRING) { - ZEPHIR_INIT_VAR(&_0$$3); - zephir_create_array(&_0$$3, 1, 0); - zephir_array_fast_append(&_0$$3, data); - ZEPHIR_CPY_WRT(data, &_0$$3); - } - if (Z_TYPE_P(data) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_1$$4); - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_3$$4, &_2$$4, &store, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractConditions.zep", 350); - zephir_fast_array_merge(&_1$$4, &_3$$4, data); - zephir_update_property_array(this_ptr, SL("store"), &store, &_1$$4); - } - ZEPHIR_MM_RESTORE(); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_AbstractQuery) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, AbstractQuery, phalcon, datamapper_query_abstractquery, phalcon_datamapper_query_abstractquery_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zephir_fetch_params(1, 1, 0, &keys); - zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("bind"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("connection"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_query_abstractquery_ce, SL("store"), ZEND_ACC_PROTECTED); - phalcon_datamapper_query_abstractquery_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Query_AbstractQuery; - return SUCCESS; + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dodeletemultiple", NULL, 0, keys); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, __construct) +static PHP_METHOD(Phalcon_Cache_Cache, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, *bind, bind_sub, _0, _1; + zval *key_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&bind_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) - Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(key) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(defaultValue) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &bind); + zephir_fetch_params(1, 1, 1, &key_param, &defaultValue); + zephir_get_strval(&key, key_param); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; + } - zephir_update_property_zval(this_ptr, ZEND_STRL("bind"), bind); - zephir_update_property_zval(this_ptr, ZEND_STRL("connection"), connection); - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "UNION"); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doget", NULL, 0, &key, defaultValue); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindInline) +static PHP_METHOD(Phalcon_Cache_Cache, getMultiple) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub, *type_param = NULL, _0, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *keys, keys_sub, *defaultValue = NULL, defaultValue_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&keys_sub); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(value) + Z_PARAM_ZVAL(keys) Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) + Z_PARAM_ZVAL_OR_NULL(defaultValue) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &value, &type_param); - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); + zephir_fetch_params(1, 1, 1, &keys, &defaultValue); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, type); - ZEPHIR_RETURN_CALL_METHOD(&_0, "bindinline", NULL, 0, value, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dogetmultiple", NULL, 0, keys, defaultValue); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindValue) +static PHP_METHOD(Phalcon_Cache_Cache, has) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *type_param = NULL, _0, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL; zval key; zval *this_ptr = getThis(); ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &type_param); + zephir_fetch_params(1, 1, 0, &key_param); zephir_get_strval(&key, key_param); - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, type); - ZEPHIR_CALL_METHOD(NULL, &_0, "setvalue", NULL, 0, &key, value, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dohas", NULL, 0, &key); zephir_check_call_status(); - RETURN_THIS(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, bindValues) +static PHP_METHOD(Phalcon_Cache_Cache, set) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *values_param = NULL, _0; - zval values; + zval *key_param = NULL, *value, value_sub, *ttl = NULL, ttl_sub, __$null; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&ttl_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(ttl) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &values_param); - zephir_get_arrval(&values, values_param); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_0, "setvalues", NULL, 0, &values); - zephir_check_call_status(); - RETURN_THIS(); -} - -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, getBindValues) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - + zephir_fetch_params(1, 2, 1, &key_param, &value, &ttl); + zephir_get_strval(&key, key_param); + if (!ttl) { + ttl = &ttl_sub; + ttl = &__$null; + } - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "toarray", NULL, 0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "doset", NULL, 0, &key, value, ttl); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, getStatement) -{ -} - -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, perform) +static PHP_METHOD(Phalcon_Cache_Cache, setMultiple) { - zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *values, values_sub, *ttl = NULL, ttl_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getstatement", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getbindvalues", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&_0, "perform", NULL, 0, &_1, &_2); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, setFlag) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_bool enable; - zval *flag_param = NULL, *enable_param = NULL, __$true, flags, _0$$4, _1$$4; - zval flag; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&flag); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&flags); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&values_sub); + ZVAL_UNDEF(&ttl_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(flag) + Z_PARAM_ZVAL(values) Z_PARAM_OPTIONAL - Z_PARAM_BOOL(enable) + Z_PARAM_ZVAL_OR_NULL(ttl) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &flag_param, &enable_param); - zephir_get_strval(&flag, flag_param); - if (!enable_param) { - enable = 1; - } else { - enable = zephir_get_boolval(enable_param); + zephir_fetch_params(1, 1, 1, &values, &ttl); + if (!ttl) { + ttl = &ttl_sub; + ttl = &__$null; } - if (enable) { - zephir_update_property_array_multi(this_ptr, SL("store"), &__$true, SL("sz"), 3, SL("FLAGS"), &flag); - } else { - zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&flags); - zephir_array_fetch_string(&flags, &_0$$4, SL("FLAGS"), PH_NOISY, "phalcon/DataMapper/Query/AbstractQuery.zep", 144); - zephir_array_unset(&flags, &flag, PH_SEPARATE); - ZEPHIR_INIT_VAR(&_1$$4); - ZVAL_STRING(&_1$$4, "FLAGS"); - zephir_update_property_array(this_ptr, SL("store"), &_1$$4, &flags); - } - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "dosetmultiple", NULL, 0, values, ttl); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, quoteIdentifier) +static PHP_METHOD(Phalcon_Cache_Cache, getExceptionClass) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, *type_param = NULL, _0, _1; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &type_param); - zephir_get_strval(&name, name_param); - if (!type_param) { - type = 2; - } else { - type = zephir_get_intval(type_param); - } + RETURN_STRING("Phalcon\\Cache\\Exception\\InvalidArgumentException"); +} - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, type); - ZEPHIR_RETURN_CALL_METHOD(&_0, "quote", NULL, 0, &name, &_1); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, reset) -{ - zval _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_15); - ZVAL_UNDEF(&_16); - ZVAL_UNDEF(&_17); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "COLUMNS"); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_0); - ZEPHIR_INIT_VAR(&_2); - array_init(&_2); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "FLAGS"); - zephir_update_property_array(this_ptr, SL("store"), &_3, &_2); - ZEPHIR_INIT_VAR(&_4); - array_init(&_4); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, "FROM"); - zephir_update_property_array(this_ptr, SL("store"), &_5, &_4); - ZEPHIR_INIT_VAR(&_6); - array_init(&_6); - ZEPHIR_INIT_VAR(&_7); - ZVAL_STRING(&_7, "GROUP"); - zephir_update_property_array(this_ptr, SL("store"), &_7, &_6); - ZEPHIR_INIT_VAR(&_8); - array_init(&_8); - ZEPHIR_INIT_VAR(&_9); - ZVAL_STRING(&_9, "HAVING"); - zephir_update_property_array(this_ptr, SL("store"), &_9, &_8); - ZEPHIR_INIT_VAR(&_10); - ZVAL_STRING(&_10, "LIMIT"); - ZEPHIR_INIT_VAR(&_11); - ZVAL_LONG(&_11, 0); - zephir_update_property_array(this_ptr, SL("store"), &_10, &_11); - ZEPHIR_INIT_VAR(&_12); - array_init(&_12); - ZEPHIR_INIT_VAR(&_13); - ZVAL_STRING(&_13, "ORDER"); - zephir_update_property_array(this_ptr, SL("store"), &_13, &_12); - ZEPHIR_INIT_VAR(&_14); - ZVAL_STRING(&_14, "OFFSET"); - ZEPHIR_INIT_VAR(&_15); - ZVAL_LONG(&_15, 0); - zephir_update_property_array(this_ptr, SL("store"), &_14, &_15); - ZEPHIR_INIT_VAR(&_16); - array_init(&_16); - ZEPHIR_INIT_VAR(&_17); - ZVAL_STRING(&_17, "WHERE"); - zephir_update_property_array(this_ptr, SL("store"), &_17, &_16); - ZEPHIR_MM_RESTORE(); + + +ZEPHIR_INIT_CLASS(Phalcon_Cache_CacheFactory) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache, CacheFactory, phalcon, cache_cachefactory, phalcon_factory_abstractconfigfactory_ce, phalcon_cache_cachefactory_method_entry, 0); + + zend_declare_property_null(phalcon_cache_cachefactory_ce, SL("adapterFactory"), ZEND_ACC_PROTECTED); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, buildFlags) +static PHP_METHOD(Phalcon_Cache_CacheFactory, __construct) { - zval _0, _1, _2, _3, _4, _5; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *factory, factory_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&factory_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(factory, phalcon_cache_adapterfactory_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif - ZEPHIR_MM_GROW(); + zephir_fetch_params_without_memory_grow(1, 0, &factory); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("FLAGS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 190); - if (ZEPHIR_IS_EMPTY(&_1)) { - RETURN_MM_STRING(""); - } - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_INIT_VAR(&_3); - zephir_read_property(&_4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_5, &_4, SL("FLAGS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 194); - zephir_array_keys(&_3, &_5); - zephir_fast_join_str(&_2, SL(" "), &_3); - ZEPHIR_CONCAT_SV(return_value, " ", &_2); - RETURN_MM(); + + zephir_update_property_zval(this_ptr, ZEND_STRL("adapterFactory"), factory); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, buildReturning) +static PHP_METHOD(Phalcon_Cache_CacheFactory, load) { - zval _0, _1, _2, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *config = NULL, config_sub, name, options, _0, _1; zval *this_ptr = getThis(); + ZVAL_UNDEF(&config_sub); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&options); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(config) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &config); + ZEPHIR_SEPARATE_PARAM(config); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 204); - if (ZEPHIR_IS_EMPTY(&_1)) { - RETURN_MM_STRING(""); + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfig", NULL, 0, config); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(config, &_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "adapter"); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfigelement", NULL, 0, config, &_1); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(config, &_0); + ZEPHIR_OBS_VAR(&name); + zephir_array_fetch_string(&name, config, SL("adapter"), PH_NOISY, "phalcon/Cache/CacheFactory.zep", 73); + ZEPHIR_OBS_VAR(&options); + if (!(zephir_array_isset_string_fetch(&options, config, SL("options"), 0))) { + ZEPHIR_INIT_NVAR(&options); + array_init(&options); } - zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_4, &_3, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/AbstractQuery.zep", 208); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, ","); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "indent", NULL, 0, &_4, &_5); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, " RETURNING", &_2); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_AbstractQuery, indent) +static PHP_METHOD(Phalcon_Cache_CacheFactory, newInstance) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval glue, _1; - zval *collection_param = NULL, *glue_param = NULL, _0; - zval collection; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval *name_param = NULL, *options_param = NULL, adapter, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&collection); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&adapter); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&glue); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ARRAY(collection) + Z_PARAM_STR(name) Z_PARAM_OPTIONAL - Z_PARAM_STR(glue) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &collection_param, &glue_param); - zephir_get_arrval(&collection, collection_param); - if (!glue_param) { - ZEPHIR_INIT_VAR(&glue); - ZVAL_STRING(&glue, ""); + zephir_fetch_params(1, 1, 1, &name_param, &options_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - zephir_get_strval(&glue, glue_param); + ZEPHIR_INIT_VAR(&name); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); } - if (ZEPHIR_IS_EMPTY(&collection)) { - RETURN_MM_STRING(""); - } - ZEPHIR_INIT_VAR(&_0); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_VS(&_1, &glue, " "); - zephir_fast_join(&_0, &_1, &collection); - ZEPHIR_CONCAT_SV(return_value, " ", &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("adapterFactory"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&adapter, &_0, "newinstance", NULL, 0, &name, &options); + zephir_check_call_status(); + object_init_ex(return_value, phalcon_cache_cache_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 188, &adapter); + zephir_check_call_status(); RETURN_MM(); } -zend_object *zephir_init_properties_Phalcon_DataMapper_Query_AbstractQuery(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Cache_CacheFactory, getExceptionClass) { - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - + zval *this_ptr = getThis(); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + + + RETURN_STRING("Phalcon\\Cache\\Exception\\Exception"); } @@ -37948,392 +38323,107 @@ zend_object *zephir_init_properties_Phalcon_DataMapper_Query_AbstractQuery(zend_ -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Bind) +ZEPHIR_INIT_CLASS(Phalcon_Cache_CacheInterface) { - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, Bind, phalcon, datamapper_query_bind, phalcon_datamapper_query_bind_method_entry, 0); - - zend_declare_property_long(phalcon_datamapper_query_bind_ce, SL("inlineCount"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_query_bind_ce, SL("store"), ZEND_ACC_PROTECTED); - phalcon_datamapper_query_bind_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Query_Bind; + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cache, CacheInterface, phalcon, cache_cacheinterface, phalcon_cache_cacheinterface_method_entry); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, bindInline) -{ - zend_bool _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub, *type_param = NULL, key, _3, _4, _5, _1$$3, _2$$4; - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, clear); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, delete); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, deleteMultiple); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, get); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, getMultiple); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, has); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, set); +ZEPHIR_DOC_METHOD(Phalcon_Cache_CacheInterface, setMultiple); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &value, &type_param); - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - _0 = Z_TYPE_P(value) == IS_OBJECT; - if (_0) { - _0 = zephir_instance_of_ev(value, phalcon_datamapper_query_select_ce); - } - if (_0) { - ZEPHIR_CALL_METHOD(&_1$$3, value, "getstatement", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_1$$3, ")"); - RETURN_MM(); - } - if (Z_TYPE_P(value) == IS_ARRAY) { - ZVAL_LONG(&_2$$4, type); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "inlinearray", NULL, 0, value, &_2$$4); - zephir_check_call_status(); - RETURN_MM(); - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_ZVAL_NREF(_4); - ZVAL_LONG(&_4, (zephir_get_numberval(&_3) + 1)); - zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_4); - zephir_read_property(&_4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&key); - ZEPHIR_CONCAT_SVS(&key, "__", &_4, "__"); - ZVAL_LONG(&_5, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", NULL, 0, &key, value, &_5); - zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, ":", &key); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, remove) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Exception_Exception) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *key_param = NULL, store, _0; - zval key; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Exception, Exception, phalcon, cache_exception_exception, zend_ce_exception, NULL, 0); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&store); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(key) - ZEND_PARSE_PARAMETERS_END(); -#endif + return SUCCESS; +} - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - zephir_get_strval(&key, key_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&store, &_0); - zephir_array_unset(&store, &key, PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("store"), &store); - ZEPHIR_MM_RESTORE(); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, setValue) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *value, value_sub, *type_param = NULL, localType; - zval key; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&localType); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(key) - Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &key_param, &value, &type_param); - zephir_get_strval(&key, key_param); - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } +ZEPHIR_INIT_CLASS(Phalcon_Cache_Exception_InvalidArgumentException) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Exception, InvalidArgumentException, phalcon, cache_exception_invalidargumentexception, zend_ce_exception, NULL, 0); - ZEPHIR_INIT_VAR(&localType); - ZVAL_LONG(&localType, type); - if (ZEPHIR_IS_LONG_IDENTICAL(&localType, -1)) { - ZEPHIR_CALL_METHOD(&localType, this_ptr, "gettype", NULL, 0, value); - zephir_check_call_status(); - } - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0); - zephir_array_fast_append(&_0, value); - zephir_array_fast_append(&_0, &localType); - zephir_update_property_array(this_ptr, SL("store"), &key, &_0); - ZEPHIR_MM_RESTORE(); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, setValues) -{ - zend_string *_3; - zend_ulong _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *values_param = NULL, *type_param = NULL, key, value, *_0, _1, _4$$3, _6$$4; - zval values; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_6$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ARRAY(values) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &values_param, &type_param); - zephir_get_arrval(&values, values_param); - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - zephir_is_iterable(&values, 0, "phalcon/DataMapper/Query/Bind.zep", 108); - if (Z_TYPE_P(&values) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&values), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&key); - if (_3 != NULL) { - ZVAL_STR_COPY(&key, _3); - } else { - ZVAL_LONG(&key, _2); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - ZVAL_LONG(&_4$$3, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_4$$3); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &values, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &values, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); - zephir_check_call_status(); - ZVAL_LONG(&_6$$4, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_6$$4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_MM_RESTORE(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, toArray) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_AdapterInterface) { - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Cache\\Adapter, AdapterInterface, phalcon, cache_adapter_adapterinterface, NULL); + zend_class_implements(phalcon_cache_adapter_adapterinterface_ce, 1, phalcon_storage_adapter_adapterinterface_ce); + return SUCCESS; +} - RETURN_MEMBER(getThis(), "store"); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, getType) -{ - zval *value, value_sub; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - zephir_fetch_params_without_memory_grow(1, 0, &value); - if (Z_TYPE_P(value) == IS_NULL) { - RETURN_LONG(0); - } - if (((Z_TYPE_P(value) == IS_TRUE || Z_TYPE_P(value) == IS_FALSE) == 1)) { - RETURN_LONG(5); - } - if (Z_TYPE_P(value) == IS_LONG) { - RETURN_LONG(1); - } - RETURN_LONG(2); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Bind, inlineArray) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Apcu) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *data_param = NULL, *type_param = NULL, key, value, *_0, _1, _11, _2$$3, _3$$3, _4$$3, _6$$3, _7$$4, _8$$4, _9$$4, _10$$4; - zval data, keys; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Apcu, phalcon, cache_adapter_apcu, phalcon_storage_adapter_apcu_ce, NULL, 0); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&keys); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ARRAY(data) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + zend_class_implements(phalcon_cache_adapter_apcu_ce, 1, phalcon_cache_adapter_adapterinterface_ce); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &data_param, &type_param); - zephir_get_arrval(&data, data_param); - type = zephir_get_intval(type_param); - ZEPHIR_INIT_VAR(&keys); - array_init(&keys); - zephir_is_iterable(&data, 0, "phalcon/DataMapper/Query/Bind.zep", 167); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&data), _0) - { - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - zephir_read_property(&_2$$3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_ZVAL_NREF(_3$$3); - ZVAL_LONG(&_3$$3, (zephir_get_numberval(&_2$$3) + 1)); - zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_3$$3); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_CONCAT_SVS(&key, "__", &_3$$3, "__"); - ZVAL_LONG(&_4$$3, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_4$$3); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6$$3); - ZEPHIR_CONCAT_SV(&_6$$3, ":", &key); - zephir_array_append(&keys, &_6$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Bind.zep", 164); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &data, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_7$$4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_ZVAL_NREF(_8$$4); - ZVAL_LONG(&_8$$4, (zephir_get_numberval(&_7$$4) + 1)); - zephir_update_property_zval(this_ptr, ZEND_STRL("inlineCount"), &_8$$4); - zephir_read_property(&_8$$4, this_ptr, ZEND_STRL("inlineCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_CONCAT_SVS(&key, "__", &_8$$4, "__"); - ZVAL_LONG(&_9$$4, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_5, 0, &key, &value, &_9$$4); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$4); - ZEPHIR_CONCAT_SV(&_10$$4, ":", &key); - zephir_array_append(&keys, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Bind.zep", 164); - ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_VAR(&_11); - zephir_fast_join_str(&_11, SL(", "), &keys); - ZEPHIR_CONCAT_SVS(return_value, "(", &_11, ")"); - RETURN_MM(); -} -zend_object *zephir_init_properties_Phalcon_DataMapper_Query_Bind(zend_class_entry *class_type) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Libmemcached) { - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Libmemcached, phalcon, cache_adapter_libmemcached, phalcon_storage_adapter_libmemcached_ce, NULL, 0); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("store"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + zend_class_implements(phalcon_cache_adapter_libmemcached_ce, 1, phalcon_cache_adapter_adapterinterface_ce); + return SUCCESS; } @@ -38346,178 +38436,66 @@ zend_object *zephir_init_properties_Phalcon_DataMapper_Query_Bind(zend_class_ent -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Delete) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Memory) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Delete, phalcon, datamapper_query_delete, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_delete_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Memory, phalcon, cache_adapter_memory, phalcon_storage_adapter_memory_ce, NULL, 0); + zend_class_implements(phalcon_cache_adapter_memory_ce, 1, phalcon_cache_adapter_adapterinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Delete, __construct) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&bind_sub); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) - Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &bind); - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_delete_ce, getThis(), "__construct", &_0, 0, connection, bind); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); - ZEPHIR_MM_RESTORE(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Delete, from) +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Redis) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, _0; - zval table; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Redis, phalcon, cache_adapter_redis, phalcon_storage_adapter_redis_ce, NULL, 0); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(table) - ZEND_PARSE_PARAMETERS_END(); -#endif + zend_class_implements(phalcon_cache_adapter_redis_ce, 1, phalcon_cache_adapter_adapterinterface_ce); + return SUCCESS; +} - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &table_param); - zephir_get_strval(&table, table_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "FROM"); - zephir_update_property_array(this_ptr, SL("store"), &_0, &table); - RETURN_THIS(); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_DataMapper_Query_Delete, returning) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *columns_param = NULL, _0, _1, _2, _3; - zval columns; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columns) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columns_param); - zephir_get_arrval(&columns, columns_param); +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Stream) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Stream, phalcon, cache_adapter_stream, phalcon_storage_adapter_stream_ce, NULL, 0); - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Delete.zep", 63); - zephir_fast_array_merge(&_0, &_2, &columns); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); - RETURN_THIS(); + zend_class_implements(phalcon_cache_adapter_stream_ce, 1, phalcon_cache_adapter_adapterinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Delete, getStatement) -{ - zval _0, _1, _2, _3, _4, _5; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Delete.zep", 78); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "WHERE"); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcondition", NULL, 0, &_4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "buildreturning", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVVV(return_value, "DELETE", &_0, " FROM ", &_2, &_3, &_5); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Delete, reset) -{ - zval _1, _2, _3, _4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZEPHIR_MM_GROW(); +ZEPHIR_INIT_CLASS(Phalcon_Cache_Adapter_Weak) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Adapter, Weak, phalcon, cache_adapter_weak, phalcon_storage_adapter_weak_ce, NULL, 0); - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_delete_ce, getThis(), "reset", &_0, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); - ZEPHIR_MM_RESTORE(); + zend_class_implements(phalcon_cache_adapter_weak_ce, 1, phalcon_cache_adapter_adapterinterface_ce); + return SUCCESS; } @@ -38530,531 +38508,1156 @@ static PHP_METHOD(Phalcon_DataMapper_Query_Delete, reset) -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Insert) +ZEPHIR_INIT_CLASS(Phalcon_Dispatcher_AbstractDispatcher) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Insert, phalcon, datamapper_query_insert, phalcon_datamapper_query_abstractquery_ce, phalcon_datamapper_query_insert_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Dispatcher, AbstractDispatcher, phalcon, dispatcher_abstractdispatcher, phalcon_di_abstractinjectionaware_ce, phalcon_dispatcher_abstractdispatcher_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("activeHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("activeMethodMap"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("actionName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("actionSuffix"), "Action", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("camelCaseMap"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("defaultAction"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("defaultNamespace"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("defaultHandler"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("handlerHashes"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("handlerName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("handlerSuffix"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_dispatcher_abstractdispatcher_ce, SL("finished"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_dispatcher_abstractdispatcher_ce, SL("forwarded"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_dispatcher_abstractdispatcher_ce, SL("isControllerInitialize"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("lastHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("modelBinder"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_dispatcher_abstractdispatcher_ce, SL("modelBinding"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("moduleName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("namespaceName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("params"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("previousActionName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("previousHandlerName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_dispatcher_abstractdispatcher_ce, SL("previousNamespaceName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_dispatcher_abstractdispatcher_ce, SL("returnedValue"), ZEND_ACC_PROTECTED); + phalcon_dispatcher_abstractdispatcher_ce->create_object = zephir_init_properties_Phalcon_Dispatcher_AbstractDispatcher; + zend_class_implements(phalcon_dispatcher_abstractdispatcher_ce, 1, phalcon_dispatcher_dispatcherinterface_ce); + zend_class_implements(phalcon_dispatcher_abstractdispatcher_ce, 1, phalcon_events_eventsawareinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, __construct) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, callActionMethod) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; + zval params, _0; + zval actionMethod; + zval *handler, handler_sub, *actionMethod_param = NULL, *params_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&bind_sub); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&actionMethod); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) - Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_ZVAL(handler) + Z_PARAM_STR(actionMethod) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &bind); + zephir_fetch_params(1, 2, 1, &handler, &actionMethod_param, ¶ms_param); + zephir_get_strval(&actionMethod, actionMethod_param); + if (!params_param) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else { + ZEPHIR_OBS_COPY_OR_DUP(¶ms, params_param); + } - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_insert_ce, getThis(), "__construct", &_0, 0, connection, bind); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + zephir_array_fast_append(&_0, handler); + zephir_array_fast_append(&_0, &actionMethod); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_0, ¶ms); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, column) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, dispatch) { + zval _44$$10; + zend_bool hasService = 0, hasEventsManager = 0, isNewHandler = 0, _5$$5, _16$$13, _21$$15, _29$$18, _34$$20, _42$$23, _52$$25, _56$$31, _62$$33, _66$$36, _72$$38, _78$$43, _83$$46, _88$$48, _105$$59, _110$$62, _115$$64, _118$$67, _123$$69, _130$$73; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _1$$3, _2$$3; - zval column, _0; + zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL, *_15 = NULL, *_20 = NULL, *_23 = NULL, *_25 = NULL, *_28 = NULL, *_30 = NULL, *_33 = NULL, *_35 = NULL, *_41 = NULL, *_43 = NULL, *_47 = NULL, *_51 = NULL, *_55 = NULL, *_58 = NULL, *_61 = NULL, *_64 = NULL, *_68 = NULL, *_71 = NULL, *_74 = NULL, *_77 = NULL, *_82 = NULL, *_87 = NULL, *_94 = NULL, *_100 = NULL, *_104 = NULL, *_109 = NULL, *_114 = NULL, *_122 = NULL, *_126 = NULL, *_129 = NULL; + zval __$true, __$false, value, handler, container, namespaceName, handlerName, actionName, eventsManager, handlerClass, status, actionMethod, modelBinder, bindCacheKey, handlerHash, e, _0, _1$$3, _2$$3, _3$$5, _4$$5, _6$$5, _7$$4, _8$$7, _9$$11, _10$$11, _13$$13, _14$$13, _17$$13, _18$$12, _19$$15, _22$$15, _24$$10, _36$$10, _37$$10, _38$$10, _102$$10, _26$$18, _27$$18, _31$$20, _32$$20, _39$$23, _40$$23, _45$$26, _46$$26, _48$$26, _49$$25, _50$$25, _53$$31, _54$$31, _57$$31, _59$$30, _60$$33, _63$$33, _65$$36, _67$$36, _69$$35, _70$$38, _73$$38, _75$$41, _76$$43, _79$$43, _80$$46, _81$$46, _84$$46, _85$$45, _86$$48, _89$$48, _90$$50, _91$$50, _92$$51, _93$$51, _95$$51, _96$$54, _97$$54, _98$$57, _99$$57, _101$$57, _103$$59, _106$$59, _107$$62, _108$$62, _111$$62, _112$$61, _113$$64, _116$$64, _117$$67, _119$$67, _120$$66, _121$$69, _124$$69, _125$$72, _127$$71, _128$$73, _131$$73, _132$$76, _133$$75, _134$$77; + zend_long ZEPHIR_LAST_CALL_STATUS, numberDispatches = 0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&handlerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&handlerClass); + ZVAL_UNDEF(&status); + ZVAL_UNDEF(&actionMethod); + ZVAL_UNDEF(&modelBinder); + ZVAL_UNDEF(&bindCacheKey); + ZVAL_UNDEF(&handlerHash); + ZVAL_UNDEF(&e); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(column) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_9$$11); + ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&_13$$13); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_17$$13); + ZVAL_UNDEF(&_18$$12); + ZVAL_UNDEF(&_19$$15); + ZVAL_UNDEF(&_22$$15); + ZVAL_UNDEF(&_24$$10); + ZVAL_UNDEF(&_36$$10); + ZVAL_UNDEF(&_37$$10); + ZVAL_UNDEF(&_38$$10); + ZVAL_UNDEF(&_102$$10); + ZVAL_UNDEF(&_26$$18); + ZVAL_UNDEF(&_27$$18); + ZVAL_UNDEF(&_31$$20); + ZVAL_UNDEF(&_32$$20); + ZVAL_UNDEF(&_39$$23); + ZVAL_UNDEF(&_40$$23); + ZVAL_UNDEF(&_45$$26); + ZVAL_UNDEF(&_46$$26); + ZVAL_UNDEF(&_48$$26); + ZVAL_UNDEF(&_49$$25); + ZVAL_UNDEF(&_50$$25); + ZVAL_UNDEF(&_53$$31); + ZVAL_UNDEF(&_54$$31); + ZVAL_UNDEF(&_57$$31); + ZVAL_UNDEF(&_59$$30); + ZVAL_UNDEF(&_60$$33); + ZVAL_UNDEF(&_63$$33); + ZVAL_UNDEF(&_65$$36); + ZVAL_UNDEF(&_67$$36); + ZVAL_UNDEF(&_69$$35); + ZVAL_UNDEF(&_70$$38); + ZVAL_UNDEF(&_73$$38); + ZVAL_UNDEF(&_75$$41); + ZVAL_UNDEF(&_76$$43); + ZVAL_UNDEF(&_79$$43); + ZVAL_UNDEF(&_80$$46); + ZVAL_UNDEF(&_81$$46); + ZVAL_UNDEF(&_84$$46); + ZVAL_UNDEF(&_85$$45); + ZVAL_UNDEF(&_86$$48); + ZVAL_UNDEF(&_89$$48); + ZVAL_UNDEF(&_90$$50); + ZVAL_UNDEF(&_91$$50); + ZVAL_UNDEF(&_92$$51); + ZVAL_UNDEF(&_93$$51); + ZVAL_UNDEF(&_95$$51); + ZVAL_UNDEF(&_96$$54); + ZVAL_UNDEF(&_97$$54); + ZVAL_UNDEF(&_98$$57); + ZVAL_UNDEF(&_99$$57); + ZVAL_UNDEF(&_101$$57); + ZVAL_UNDEF(&_103$$59); + ZVAL_UNDEF(&_106$$59); + ZVAL_UNDEF(&_107$$62); + ZVAL_UNDEF(&_108$$62); + ZVAL_UNDEF(&_111$$62); + ZVAL_UNDEF(&_112$$61); + ZVAL_UNDEF(&_113$$64); + ZVAL_UNDEF(&_116$$64); + ZVAL_UNDEF(&_117$$67); + ZVAL_UNDEF(&_119$$67); + ZVAL_UNDEF(&_120$$66); + ZVAL_UNDEF(&_121$$69); + ZVAL_UNDEF(&_124$$69); + ZVAL_UNDEF(&_125$$72); + ZVAL_UNDEF(&_127$$71); + ZVAL_UNDEF(&_128$$73); + ZVAL_UNDEF(&_131$$73); + ZVAL_UNDEF(&_132$$76); + ZVAL_UNDEF(&_133$$75); + ZVAL_UNDEF(&_134$$77); + ZVAL_UNDEF(&_44$$10); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column_param, &value, &type_param); - zephir_get_strval(&column, column_param); - if (!value) { - value = &value_sub; - value = &__$null; + + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "A dependency injection container is required to access related dispatching services"); + ZVAL_LONG(&_2$$3, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwdispatchexception", NULL, 0, &_1$$3, &_2$$3); + zephir_check_call_status(); + RETURN_MM_BOOL(0); } - if (!type_param) { - type = -1; + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + hasEventsManager = Z_TYPE_P(&eventsManager) == IS_OBJECT; + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$true); } else { - type = zephir_get_intval(type_param); + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$false); } + if (hasEventsManager) { + /* try_start_1: */ - ZEPHIR_INIT_VAR(&_0); - ZEPHIR_CONCAT_SV(&_0, ":", &column); - zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sz"), 3, SL("COLUMNS"), &column); - if (Z_TYPE_P(value) != IS_NULL) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_2$$3, type); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "setvalue", NULL, 0, &column, value, &_2$$3); - zephir_check_call_status(); - } - RETURN_THIS(); -} + ZEPHIR_INIT_VAR(&_4$$5); + ZVAL_STRING(&_4$$5, "dispatch:beforeDispatchLoop"); + ZEPHIR_CALL_METHOD(&_3$$5, &eventsManager, "fire", NULL, 0, &_4$$5, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + _5$$5 = ZEPHIR_IS_FALSE_IDENTICAL(&_3$$5); + if (_5$$5) { + zephir_read_property(&_6$$5, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _5$$5 = !ZEPHIR_IS_FALSE_IDENTICAL(&_6$$5); + } + if (_5$$5) { + RETURN_MM_BOOL(0); + } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, columns) -{ - zend_string *_3; - zend_ulong _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *columns_param = NULL, column, value, *_0, _1; - zval columns; - zval *this_ptr = getThis(); + try_end_1: - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columns) - ZEND_PARSE_PARAMETERS_END(); -#endif + if (EG(exception)) { + ZEPHIR_INIT_VAR(&_7$$4); + ZVAL_OBJ(&_7$$4, EG(exception)); + Z_ADDREF_P(&_7$$4); + if (zephir_is_instance_of(&_7$$4, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_7$$4); + ZEPHIR_CALL_METHOD(&status, this_ptr, "handleexception", NULL, 0, &e); + zephir_check_call_status(); + zephir_read_property(&_8$$7, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_8$$7)) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&status)) { + RETURN_MM_BOOL(0); + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 229); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + } + ZEPHIR_INIT_VAR(&value); + ZVAL_NULL(&value); + ZEPHIR_INIT_VAR(&handler); + ZVAL_NULL(&handler); + numberDispatches = 0; + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$false); + } + while (1) { + zephir_read_property(&_0, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (!(!(zephir_is_true(&_0)))) { + break; + } + numberDispatches++; + if (UNEXPECTED(numberDispatches == 256)) { + ZEPHIR_INIT_NVAR(&_9$$11); + ZVAL_STRING(&_9$$11, "Dispatcher has detected a cyclic routing causing stability problems"); + ZVAL_LONG(&_10$$11, 1); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwdispatchexception", &_11, 0, &_9$$11, &_10$$11); + zephir_check_call_status(); + break; + } + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$false); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "resolveemptyproperties", &_12, 0); + zephir_check_call_status(); + if (hasEventsManager) { + /* try_start_2: */ - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columns_param); - zephir_get_arrval(&columns, columns_param); + ZEPHIR_INIT_NVAR(&_14$$13); + ZVAL_STRING(&_14$$13, "dispatch:beforeDispatch"); + ZEPHIR_CALL_METHOD(&_13$$13, &eventsManager, "fire", &_15, 0, &_14$$13, this_ptr); + zephir_check_call_status_or_jump(try_end_2); + _16$$13 = ZEPHIR_IS_FALSE_IDENTICAL(&_13$$13); + if (!(_16$$13)) { + zephir_read_property(&_17$$13, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _16$$13 = ZEPHIR_IS_FALSE_IDENTICAL(&_17$$13); + } + if (_16$$13) { + continue; + } + try_end_2: - zephir_is_iterable(&columns, 0, "phalcon/DataMapper/Query/Insert.zep", 76); - if (Z_TYPE_P(&columns) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columns), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&column); - if (_3 != NULL) { - ZVAL_STR_COPY(&column, _3); - } else { - ZVAL_LONG(&column, _2); + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_18$$12); + ZVAL_OBJ(&_18$$12, EG(exception)); + Z_ADDREF_P(&_18$$12); + if (zephir_is_instance_of(&_18$$12, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_18$$12); + ZEPHIR_CALL_METHOD(&_19$$15, this_ptr, "handleexception", &_20, 0, &e); + zephir_check_call_status(); + _21$$15 = ZEPHIR_IS_FALSE_IDENTICAL(&_19$$15); + if (!(_21$$15)) { + zephir_read_property(&_22$$15, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _21$$15 = ZEPHIR_IS_FALSE_IDENTICAL(&_22$$15); + } + if (_21$$15) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 269); + ZEPHIR_MM_RESTORE(); + return; + } } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - if (Z_TYPE_P(&column) == IS_LONG) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); - zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&handlerClass, this_ptr, "gethandlerclass", &_23, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_24$$10, &container, "has", &_25, 0, &handlerClass); + zephir_check_call_status(); + hasService = zephir_get_boolval(&_24$$10); + if (!(hasService)) { + hasService = zephir_class_exists(&handlerClass, 1); + } + if (!(hasService)) { + ZEPHIR_INIT_NVAR(&_26$$18); + ZEPHIR_CONCAT_VS(&_26$$18, &handlerClass, " handler class cannot be loaded"); + ZVAL_LONG(&_27$$18, 2); + ZEPHIR_CALL_METHOD(&status, this_ptr, "throwdispatchexception", &_28, 0, &_26$$18, &_27$$18); + zephir_check_call_status(); + _29$$18 = ZEPHIR_IS_FALSE_IDENTICAL(&status); + if (_29$$18) { + zephir_read_property(&_27$$18, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _29$$18 = ZEPHIR_IS_FALSE_IDENTICAL(&_27$$18); } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); + if (_29$$18) { + continue; + } + break; + } + ZEPHIR_CALL_METHOD(&handler, &container, "getshared", &_30, 0, &handlerClass); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &columns, "valid", NULL, 0); + if (UNEXPECTED(Z_TYPE_P(&handler) != IS_OBJECT)) { + ZEPHIR_INIT_NVAR(&_31$$20); + ZVAL_STRING(&_31$$20, "Invalid handler returned from the services container"); + ZVAL_LONG(&_32$$20, 3); + ZEPHIR_CALL_METHOD(&status, this_ptr, "throwdispatchexception", &_33, 0, &_31$$20, &_32$$20); zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; + _34$$20 = ZEPHIR_IS_FALSE_IDENTICAL(&status); + if (_34$$20) { + zephir_read_property(&_32$$20, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _34$$20 = ZEPHIR_IS_FALSE_IDENTICAL(&_32$$20); } - ZEPHIR_CALL_METHOD(&column, &columns, "key", NULL, 0); + if (_34$$20) { + continue; + } + break; + } + ZEPHIR_CALL_FUNCTION(&handlerHash, "spl_object_hash", &_35, 80, &handler); + zephir_check_call_status(); + zephir_read_property(&_36$$10, this_ptr, ZEND_STRL("handlerHashes"), PH_NOISY_CC | PH_READONLY); + isNewHandler = !((zephir_array_isset(&_36$$10, &handlerHash))); + if (isNewHandler) { + zephir_update_property_array(this_ptr, SL("handlerHashes"), &handlerHash, &__$true); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("activeHandler"), &handler); + zephir_read_property(&_37$$10, this_ptr, ZEND_STRL("namespaceName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&namespaceName, &_37$$10); + zephir_read_property(&_37$$10, this_ptr, ZEND_STRL("handlerName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&handlerName, &_37$$10); + zephir_read_property(&_37$$10, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&actionName, &_37$$10); + ZEPHIR_OBS_NVAR(&_38$$10); + zephir_read_property(&_38$$10, this_ptr, ZEND_STRL("params"), PH_NOISY_CC); + if (UNEXPECTED(Z_TYPE_P(&_38$$10) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_39$$23); + ZVAL_STRING(&_39$$23, "Action parameters must be an Array"); + ZVAL_LONG(&_40$$23, 4); + ZEPHIR_CALL_METHOD(&status, this_ptr, "throwdispatchexception", &_41, 0, &_39$$23, &_40$$23); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &columns, "current", NULL, 0); + _42$$23 = ZEPHIR_IS_FALSE_IDENTICAL(&status); + if (_42$$23) { + zephir_read_property(&_40$$23, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _42$$23 = ZEPHIR_IS_FALSE_IDENTICAL(&_40$$23); + } + if (_42$$23) { + continue; + } + break; + } + ZEPHIR_CALL_METHOD(&actionMethod, this_ptr, "getactivemethod", &_43, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_44$$10); + zephir_create_array(&_44$$10, 2, 0); + zephir_array_fast_append(&_44$$10, &handler); + zephir_array_fast_append(&_44$$10, &actionMethod); + if (UNEXPECTED(!(zephir_is_callable(&_44$$10)))) { + if (hasEventsManager) { + ZEPHIR_INIT_NVAR(&_46$$26); + ZVAL_STRING(&_46$$26, "dispatch:beforeNotFoundAction"); + ZEPHIR_CALL_METHOD(&_45$$26, &eventsManager, "fire", &_47, 0, &_46$$26, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_45$$26)) { + continue; + } + zephir_read_property(&_48$$26, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_48$$26)) { + continue; + } + } + ZEPHIR_INIT_NVAR(&_49$$25); + ZEPHIR_CONCAT_SVSVS(&_49$$25, "Action '", &actionName, "' was not found on handler '", &handlerName, "'"); + ZVAL_LONG(&_50$$25, 5); + ZEPHIR_CALL_METHOD(&status, this_ptr, "throwdispatchexception", &_51, 0, &_49$$25, &_50$$25); zephir_check_call_status(); - if (Z_TYPE_P(&column) == IS_LONG) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); + _52$$25 = ZEPHIR_IS_FALSE_IDENTICAL(&status); + if (_52$$25) { + zephir_read_property(&_50$$25, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _52$$25 = ZEPHIR_IS_FALSE_IDENTICAL(&_50$$25); + } + if (_52$$25) { + continue; + } + break; + } + if (hasEventsManager) { + + /* try_start_3: */ + + ZEPHIR_INIT_NVAR(&_54$$31); + ZVAL_STRING(&_54$$31, "dispatch:beforeExecuteRoute"); + ZEPHIR_CALL_METHOD(&_53$$31, &eventsManager, "fire", &_55, 0, &_54$$31, this_ptr); + zephir_check_call_status_or_jump(try_end_3); + _56$$31 = ZEPHIR_IS_FALSE_IDENTICAL(&_53$$31); + if (!(_56$$31)) { + zephir_read_property(&_57$$31, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _56$$31 = ZEPHIR_IS_FALSE_IDENTICAL(&_57$$31); + } + if (_56$$31) { + ZEPHIR_CALL_METHOD(NULL, &container, "remove", &_58, 0, &handlerClass); + zephir_check_call_status_or_jump(try_end_3); + continue; + } + + try_end_3: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_59$$30); + ZVAL_OBJ(&_59$$30, EG(exception)); + Z_ADDREF_P(&_59$$30); + if (zephir_is_instance_of(&_59$$30, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_59$$30); + ZEPHIR_CALL_METHOD(&_60$$33, this_ptr, "handleexception", &_61, 0, &e); zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); + _62$$33 = ZEPHIR_IS_FALSE_IDENTICAL(&_60$$33); + if (!(_62$$33)) { + zephir_read_property(&_63$$33, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _62$$33 = ZEPHIR_IS_FALSE_IDENTICAL(&_63$$33); + } + if (_62$$33) { + ZEPHIR_CALL_METHOD(NULL, &container, "remove", &_64, 0, &handlerClass); + zephir_check_call_status(); + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 408); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + if ((zephir_method_exists_ex(&handler, ZEND_STRL("beforeexecuteroute")) == SUCCESS)) { + + /* try_start_4: */ + + ZEPHIR_CALL_METHOD(&_65$$36, &handler, "beforeexecuteroute", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_4); + _66$$36 = ZEPHIR_IS_FALSE_IDENTICAL(&_65$$36); + if (!(_66$$36)) { + zephir_read_property(&_67$$36, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _66$$36 = ZEPHIR_IS_FALSE_IDENTICAL(&_67$$36); + } + if (_66$$36) { + ZEPHIR_CALL_METHOD(NULL, &container, "remove", &_68, 0, &handlerClass); + zephir_check_call_status_or_jump(try_end_4); + continue; + } + + try_end_4: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_69$$35); + ZVAL_OBJ(&_69$$35, EG(exception)); + Z_ADDREF_P(&_69$$35); + if (zephir_is_instance_of(&_69$$35, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_69$$35); + ZEPHIR_CALL_METHOD(&_70$$38, this_ptr, "handleexception", &_71, 0, &e); zephir_check_call_status(); + _72$$38 = ZEPHIR_IS_FALSE_IDENTICAL(&_70$$38); + if (!(_72$$38)) { + zephir_read_property(&_73$$38, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _72$$38 = ZEPHIR_IS_FALSE_IDENTICAL(&_73$$38); + } + if (_72$$38) { + ZEPHIR_CALL_METHOD(NULL, &container, "remove", &_74, 0, &handlerClass); + zephir_check_call_status(); + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 427); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); + } + } + if (isNewHandler) { + if ((zephir_method_exists_ex(&handler, ZEND_STRL("initialize")) == SUCCESS)) { + + /* try_start_5: */ + + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$false); + } + ZEPHIR_CALL_METHOD(NULL, &handler, "initialize", NULL, 0); + zephir_check_call_status_or_jump(try_end_5); + + try_end_5: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_75$$41); + ZVAL_OBJ(&_75$$41, EG(exception)); + Z_ADDREF_P(&_75$$41); + if (zephir_is_instance_of(&_75$$41, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_75$$41); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$false); + } + ZEPHIR_CALL_METHOD(&_76$$43, this_ptr, "handleexception", &_77, 0, &e); + zephir_check_call_status(); + _78$$43 = ZEPHIR_IS_FALSE_IDENTICAL(&_76$$43); + if (!(_78$$43)) { + zephir_read_property(&_79$$43, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _78$$43 = ZEPHIR_IS_FALSE_IDENTICAL(&_79$$43); + } + if (_78$$43) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 469); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("isControllerInitialize"), &__$false); + } + if (zephir_is_true(&eventsManager)) { + + /* try_start_6: */ + + ZEPHIR_INIT_NVAR(&_81$$46); + ZVAL_STRING(&_81$$46, "dispatch:afterInitialize"); + ZEPHIR_CALL_METHOD(&_80$$46, &eventsManager, "fire", &_82, 0, &_81$$46, this_ptr); + zephir_check_call_status_or_jump(try_end_6); + _83$$46 = ZEPHIR_IS_FALSE_IDENTICAL(&_80$$46); + if (!(_83$$46)) { + zephir_read_property(&_84$$46, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _83$$46 = ZEPHIR_IS_FALSE_IDENTICAL(&_84$$46); + } + if (_83$$46) { + continue; + } + + try_end_6: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_85$$45); + ZVAL_OBJ(&_85$$45, EG(exception)); + Z_ADDREF_P(&_85$$45); + if (zephir_is_instance_of(&_85$$45, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_85$$45); + ZEPHIR_CALL_METHOD(&_86$$48, this_ptr, "handleexception", &_87, 0, &e); + zephir_check_call_status(); + _88$$48 = ZEPHIR_IS_FALSE_IDENTICAL(&_86$$48); + if (!(_88$$48)) { + zephir_read_property(&_89$$48, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _88$$48 = ZEPHIR_IS_FALSE_IDENTICAL(&_89$$48); + } + if (_88$$48) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 488); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + } + zephir_read_property(&_37$$10, this_ptr, ZEND_STRL("modelBinding"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_37$$10)) { + zephir_read_property(&_90$$50, this_ptr, ZEND_STRL("modelBinder"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&modelBinder, &_90$$50); + ZEPHIR_INIT_NVAR(&bindCacheKey); + ZEPHIR_CONCAT_SVSV(&bindCacheKey, "_PHMB_", &handlerClass, "_", &actionMethod); + zephir_read_property(&_90$$50, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_91$$50, &modelBinder, "bindtohandler", NULL, 0, &handler, &_90$$50, &bindCacheKey, &actionMethod); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), &_91$$50); + } + if (hasEventsManager) { + ZEPHIR_INIT_NVAR(&_93$$51); + ZVAL_STRING(&_93$$51, "dispatch:afterBinding"); + ZEPHIR_CALL_METHOD(&_92$$51, &eventsManager, "fire", &_94, 0, &_93$$51, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_92$$51)) { + continue; + } + zephir_read_property(&_95$$51, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_95$$51)) { + continue; + } + } + if ((zephir_method_exists_ex(&handler, ZEND_STRL("afterbinding")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(&_96$$54, &handler, "afterbinding", NULL, 0, this_ptr); zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_96$$54)) { + continue; + } + zephir_read_property(&_97$$54, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_97$$54)) { + continue; + } + } + zephir_update_property_zval(this_ptr, ZEND_STRL("lastHandler"), &handler); + + /* try_start_7: */ + + zephir_read_property(&_99$$57, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_98$$57, this_ptr, "callactionmethod", &_100, 0, &handler, &actionMethod, &_99$$57); + zephir_check_call_status_or_jump(try_end_7); + zephir_update_property_zval(this_ptr, ZEND_STRL("returnedValue"), &_98$$57); + zephir_read_property(&_101$$57, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_101$$57)) { + continue; + } + + try_end_7: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_102$$10); + ZVAL_OBJ(&_102$$10, EG(exception)); + Z_ADDREF_P(&_102$$10); + if (zephir_is_instance_of(&_102$$10, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_102$$10); + ZEPHIR_CALL_METHOD(&_103$$59, this_ptr, "handleexception", &_104, 0, &e); + zephir_check_call_status(); + _105$$59 = ZEPHIR_IS_FALSE_IDENTICAL(&_103$$59); + if (!(_105$$59)) { + zephir_read_property(&_106$$59, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _105$$59 = ZEPHIR_IS_FALSE_IDENTICAL(&_106$$59); + } + if (_105$$59) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 560); + ZEPHIR_MM_RESTORE(); + return; + } + } + if (hasEventsManager) { + + /* try_start_8: */ + + ZEPHIR_INIT_NVAR(&_108$$62); + ZVAL_STRING(&_108$$62, "dispatch:afterExecuteRoute"); + ZEPHIR_CALL_METHOD(&_107$$62, &eventsManager, "fire", &_109, 0, &_108$$62, this_ptr, &value); + zephir_check_call_status_or_jump(try_end_8); + _110$$62 = ZEPHIR_IS_FALSE_IDENTICAL(&_107$$62); + if (!(_110$$62)) { + zephir_read_property(&_111$$62, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _110$$62 = ZEPHIR_IS_FALSE_IDENTICAL(&_111$$62); + } + if (_110$$62) { + continue; + } + + try_end_8: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_112$$61); + ZVAL_OBJ(&_112$$61, EG(exception)); + Z_ADDREF_P(&_112$$61); + if (zephir_is_instance_of(&_112$$61, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_112$$61); + ZEPHIR_CALL_METHOD(&_113$$64, this_ptr, "handleexception", &_114, 0, &e); + zephir_check_call_status(); + _115$$64 = ZEPHIR_IS_FALSE_IDENTICAL(&_113$$64); + if (!(_115$$64)) { + zephir_read_property(&_116$$64, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _115$$64 = ZEPHIR_IS_FALSE_IDENTICAL(&_116$$64); + } + if (_115$$64) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 576); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + if ((zephir_method_exists_ex(&handler, ZEND_STRL("afterexecuteroute")) == SUCCESS)) { + + /* try_start_9: */ + + ZEPHIR_CALL_METHOD(&_117$$67, &handler, "afterexecuteroute", NULL, 0, this_ptr, &value); + zephir_check_call_status_or_jump(try_end_9); + _118$$67 = ZEPHIR_IS_FALSE_IDENTICAL(&_117$$67); + if (!(_118$$67)) { + zephir_read_property(&_119$$67, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _118$$67 = ZEPHIR_IS_FALSE_IDENTICAL(&_119$$67); + } + if (_118$$67) { + continue; + } + + try_end_9: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_120$$66); + ZVAL_OBJ(&_120$$66, EG(exception)); + Z_ADDREF_P(&_120$$66); + if (zephir_is_instance_of(&_120$$66, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_120$$66); + ZEPHIR_CALL_METHOD(&_121$$69, this_ptr, "handleexception", &_122, 0, &e); + zephir_check_call_status(); + _123$$69 = ZEPHIR_IS_FALSE_IDENTICAL(&_121$$69); + if (!(_123$$69)) { + zephir_read_property(&_124$$69, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _123$$69 = ZEPHIR_IS_FALSE_IDENTICAL(&_124$$69); + } + if (_123$$69) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 593); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + if (hasEventsManager) { + + /* try_start_10: */ + + ZEPHIR_INIT_NVAR(&_125$$72); + ZVAL_STRING(&_125$$72, "dispatch:afterDispatch"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_126, 0, &_125$$72, this_ptr, &value); + zephir_check_call_status_or_jump(try_end_10); + + try_end_10: + + if (EG(exception)) { + ZEPHIR_INIT_NVAR(&_127$$71); + ZVAL_OBJ(&_127$$71, EG(exception)); + Z_ADDREF_P(&_127$$71); + if (zephir_is_instance_of(&_127$$71, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_127$$71); + ZEPHIR_CALL_METHOD(&_128$$73, this_ptr, "handleexception", &_129, 0, &e); + zephir_check_call_status(); + _130$$73 = ZEPHIR_IS_FALSE_IDENTICAL(&_128$$73); + if (!(_130$$73)) { + zephir_read_property(&_131$$73, this_ptr, ZEND_STRL("finished"), PH_NOISY_CC | PH_READONLY); + _130$$73 = ZEPHIR_IS_FALSE_IDENTICAL(&_131$$73); + } + if (_130$$73) { + continue; + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 610); + ZEPHIR_MM_RESTORE(); + return; + } + } } } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&column); - RETURN_THIS(); + if (hasEventsManager) { + + /* try_start_11: */ + + ZEPHIR_INIT_VAR(&_132$$76); + ZVAL_STRING(&_132$$76, "dispatch:afterDispatchLoop"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_132$$76, this_ptr); + zephir_check_call_status_or_jump(try_end_11); + + try_end_11: + + if (EG(exception)) { + ZEPHIR_INIT_VAR(&_133$$75); + ZVAL_OBJ(&_133$$75, EG(exception)); + Z_ADDREF_P(&_133$$75); + if (zephir_is_instance_of(&_133$$75, SL("Exception"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_133$$75); + ZEPHIR_CALL_METHOD(&_134$$77, this_ptr, "handleexception", NULL, 0, &e); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_134$$77)) { + RETURN_MM_BOOL(0); + } + zephir_throw_exception_debug(&e, "phalcon/Dispatcher/AbstractDispatcher.zep", 627); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + RETURN_CCTOR(&handler); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, into) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, forward) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, _0; - zval table; + zval *forward_param = NULL, __$true, __$false, namespaceName, controllerName, params, actionName, taskName, _0, _1, _2, _3; + zval forward; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&forward); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&taskName); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(table) + Z_PARAM_ARRAY(forward) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &table_param); - zephir_get_strval(&table, table_param); + zephir_fetch_params(1, 1, 0, &forward_param); + zephir_get_arrval(&forward, forward_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "FROM"); - zephir_update_property_array(this_ptr, SL("store"), &_0, &table); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("isControllerInitialize"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(ZEPHIR_IS_TRUE_IDENTICAL(&_0))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_dispatcher_exception_ce, "Forwarding inside a controller's initialize() method is forbidden", "phalcon/Dispatcher/AbstractDispatcher.zep", 661); + return; + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("namespaceName"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("previousNamespaceName"), &_1); + zephir_read_property(&_2, this_ptr, ZEND_STRL("handlerName"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("previousHandlerName"), &_2); + zephir_read_property(&_3, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("previousActionName"), &_3); + if (zephir_array_isset_string_fetch(&namespaceName, &forward, SL("namespace"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("namespaceName"), &namespaceName); + } + ZEPHIR_OBS_VAR(&taskName); + if (zephir_array_isset_string_fetch(&controllerName, &forward, SL("controller"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerName"), &controllerName); + } else if (zephir_array_isset_string_fetch(&taskName, &forward, SL("task"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerName"), &taskName); + } + if (zephir_array_isset_string_fetch(&actionName, &forward, SL("action"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("actionName"), &actionName); + } + if (zephir_array_isset_string_fetch(¶ms, &forward, SL("params"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), ¶ms); + } + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("finished"), &__$false); + } + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("forwarded"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("forwarded"), &__$false); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, getLastInsertId) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getActionName) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(name) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &name_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); - } else { - zephir_get_strval(&name, name_param); - } + RETURN_MEMBER(getThis(), "actionName"); +} + +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getActionSuffix) +{ + zval *this_ptr = getThis(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "lastinsertid", NULL, 0, &name); - zephir_check_call_status(); - RETURN_MM(); + + RETURN_MEMBER(getThis(), "actionSuffix"); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, getStatement) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getActiveMethod) { - zval _0, _1, _2, _3, _4; + zval activeMethodName, _0, _1, _5, _2$$3, _3$$3, _4$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&activeMethodName); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 113); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 204); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildreturning", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVVV(return_value, "INSERT", &_0, " INTO ", &_2, &_3, &_4); + ZEPHIR_OBS_VAR(&activeMethodName); + zephir_read_property(&_0, this_ptr, ZEND_STRL("activeMethodMap"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&activeMethodName, &_0, &_1, 0))) { + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "tocamelcase", NULL, 0, &_3$$3); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&activeMethodName, "lcfirst", NULL, 76, &_2$$3); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&_4$$3); + zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC); + zephir_update_property_array(this_ptr, SL("activeMethodMap"), &_4$$3, &activeMethodName); + } + zephir_read_property(&_5, this_ptr, ZEND_STRL("actionSuffix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_VV(return_value, &activeMethodName, &_5); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, returning) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getBoundModels) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *columns_param = NULL, _0, _1, _2, _3; - zval columns; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columns); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columns) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columns_param); - zephir_get_arrval(&columns, columns_param); - - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 127); - zephir_fast_array_merge(&_0, &_2, &columns); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelBinder"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + array_init(return_value); + RETURN_MM(); + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("modelBinder"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_1, "getboundmodels", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, reset) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getDefaultNamespace) { - zval _1, _2, _3, _4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZEPHIR_MM_GROW(); + RETURN_MEMBER(getThis(), "defaultNamespace"); +} - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_insert_ce, getThis(), "reset", &_0, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); - ZEPHIR_MM_RESTORE(); +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getEventsManager) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "eventsManager"); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, set) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getHandlerSuffix) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *value = NULL, value_sub, __$null, _0; - zval column; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(column) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &column_param, &value); - zephir_get_strval(&column, column_param); - if (!value) { - value = &value_sub; - ZEPHIR_CPY_WRT(value, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(value); - } + RETURN_MEMBER(getThis(), "handlerSuffix"); +} +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getModelBinder) +{ + zval *this_ptr = getThis(); - if (Z_TYPE_P(value) == IS_NULL) { - ZEPHIR_INIT_NVAR(value); - ZVAL_STRING(value, "NULL"); - } - zephir_update_property_array_multi(this_ptr, SL("store"), value, SL("sz"), 3, SL("COLUMNS"), &column); - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &column); - zephir_check_call_status(); - RETURN_THIS(); + + + RETURN_MEMBER(getThis(), "modelBinder"); } -static PHP_METHOD(Phalcon_DataMapper_Query_Insert, buildColumns) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getModuleName) { - zend_string *_6; - zend_ulong _5; - zval columns; - zval column, _0, _1, _2, *_3, _4, _10, _11, _12, _13, _14, _15, _16, _17, _7$$3, _9$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_8 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_15); - ZVAL_UNDEF(&_16); - ZVAL_UNDEF(&_17); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&columns); - - ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 176); - ZEPHIR_INIT_VAR(&_2); - zephir_is_iterable(&_1, 0, "phalcon/DataMapper/Query/Insert.zep", 180); - if (Z_TYPE_P(&_1) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_1), _5, _6, _3) - { - ZEPHIR_INIT_NVAR(&column); - if (_6 != NULL) { - ZVAL_STR_COPY(&column, _6); - } else { - ZVAL_LONG(&column, _5); - } - ZEPHIR_INIT_NVAR(&_2); - ZVAL_COPY(&_2, _3); - ZEPHIR_CALL_METHOD(&_7$$3, this_ptr, "quoteidentifier", &_8, 0, &column); - zephir_check_call_status(); - zephir_array_append(&columns, &_7$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Insert.zep", 177); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &_1, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &_1, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, &_1, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "quoteidentifier", &_8, 0, &column); - zephir_check_call_status(); - zephir_array_append(&columns, &_9$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Insert.zep", 177); - ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&_2); - ZEPHIR_INIT_NVAR(&column); - ZEPHIR_INIT_VAR(&_10); - ZEPHIR_INIT_VAR(&_12); - ZVAL_STRING(&_12, ","); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "indent", NULL, 0, &columns, &_12); - zephir_check_call_status(); - zephir_fast_trim(&_10, &_11, NULL , ZEPHIR_TRIM_LEFT); - ZEPHIR_INIT_NVAR(&_12); - zephir_read_property(&_14, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_15, &_14, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Insert.zep", 183); - ZEPHIR_CALL_FUNCTION(&_16, "array_values", NULL, 14, &_15); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_17); - ZVAL_STRING(&_17, ","); - ZEPHIR_CALL_METHOD(&_13, this_ptr, "indent", NULL, 0, &_16, &_17); - zephir_check_call_status(); - zephir_fast_trim(&_12, &_13, NULL , ZEPHIR_TRIM_LEFT); - ZEPHIR_CONCAT_SVSVS(return_value, " (", &_10, ") VALUES (", &_12, ")"); - RETURN_MM(); + RETURN_MEMBER(getThis(), "moduleName"); } +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getNamespaceName) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(getThis(), "namespaceName"); +} +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getParam) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *param, param_sub, *filters = NULL, filters_sub, *defaultValue = NULL, defaultValue_sub, __$null; + zval *this_ptr = getThis(); + ZVAL_UNDEF(¶m_sub); + ZVAL_UNDEF(&filters_sub); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_ZVAL(param) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(filters) + Z_PARAM_ZVAL_OR_NULL(defaultValue) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 2, ¶m, &filters, &defaultValue); + if (!filters) { + filters = &filters_sub; + filters = &__$null; + } + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; + } -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_QueryFactory) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Query, QueryFactory, phalcon, datamapper_query_queryfactory, phalcon_datamapper_query_queryfactory_method_entry, 0); - zend_declare_property_string(phalcon_datamapper_query_queryfactory_ce, SL("selectClass"), "", ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getparameter", NULL, 0, param, filters, defaultValue); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, __construct) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getParameter) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *selectClass_param = NULL; - zval selectClass; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *param, param_sub, *filters = NULL, filters_sub, *defaultValue = NULL, defaultValue_sub, __$null, params, filter, paramValue, _0, _3, _4, _5, _1$$5, _2$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&selectClass); + ZVAL_UNDEF(¶m_sub); + ZVAL_UNDEF(&filters_sub); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&filter); + ZVAL_UNDEF(¶mValue); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_2$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_ZVAL(param) Z_PARAM_OPTIONAL - Z_PARAM_STR(selectClass) + Z_PARAM_ZVAL_OR_NULL(filters) + Z_PARAM_ZVAL_OR_NULL(defaultValue) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &selectClass_param); - if (!selectClass_param) { - ZEPHIR_INIT_VAR(&selectClass); - ZVAL_STRING(&selectClass, ""); - } else { - zephir_get_strval(&selectClass, selectClass_param); + zephir_fetch_params(1, 1, 2, ¶m, &filters, &defaultValue); + if (!filters) { + filters = &filters_sub; + filters = &__$null; + } + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; } - if (ZEPHIR_IS_EMPTY(&selectClass)) { - ZEPHIR_INIT_NVAR(&selectClass); - ZVAL_STRING(&selectClass, "Phalcon\\DataMapper\\Query\\Select"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(¶ms, &_0); + ZEPHIR_OBS_VAR(¶mValue); + if (!(zephir_array_isset_fetch(¶mValue, ¶ms, param, 0))) { + RETVAL_ZVAL(defaultValue, 1, 0); + RETURN_MM(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("selectClass"), &selectClass); - ZEPHIR_MM_RESTORE(); + if (Z_TYPE_P(filters) == IS_NULL) { + RETURN_CCTOR(¶mValue); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$5); + ZVAL_STRING(&_1$$5, "A dependency injection container is required to access the 'filter' service"); + ZVAL_LONG(&_2$$5, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "throwdispatchexception", NULL, 0, &_1$$5, &_2$$5); + zephir_check_call_status(); + } + zephir_read_property(&_3, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, "filter"); + ZEPHIR_CALL_METHOD(&_4, &_3, "getshared", NULL, 0, &_5); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&filter, &_4); + ZEPHIR_RETURN_CALL_METHOD(&filter, "sanitize", NULL, 0, ¶mValue, filters); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newBind) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; @@ -39064,1168 +39667,1180 @@ static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newBind) ZEPHIR_MM_GROW(); - object_init_ex(return_value, phalcon_datamapper_query_bind_ce); - if (zephir_has_constructor(return_value)) { - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); - zephir_check_call_status(); - } - + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getparameters", NULL, 0); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newDelete) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getParameters) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "params"); +} + +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, hasParam) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, _0; + zval *param, param_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(¶m_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); + zephir_fetch_params(1, 1, 0, ¶m); - object_init_ex(return_value, phalcon_datamapper_query_delete_ce); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 205, connection, &_0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hasparameter", NULL, 0, param); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newInsert) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, hasParameter) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, _0; + zval *param, param_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(¶m_sub); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); + zephir_fetch_params_without_memory_grow(1, 0, ¶m); - object_init_ex(return_value, phalcon_datamapper_query_insert_ce); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 206, connection, &_0); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, param)); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newSelect) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, isFinished) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "finished"); +} + +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setActionName) { - zend_class_entry *_2; - zval selectClass; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, _0, _1, _3; + zval *actionName_param = NULL; + zval actionName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&selectClass); + ZVAL_UNDEF(&actionName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_STR(actionName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); - + zephir_fetch_params(1, 1, 0, &actionName_param); + zephir_get_strval(&actionName, actionName_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("selectClass"), PH_NOISY_CC | PH_READONLY); - zephir_get_strval(&selectClass, &_0); - zephir_fetch_safe_class(&_1, &selectClass); - _2 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_1), Z_STRLEN_P(&_1), ZEND_FETCH_CLASS_AUTO); - if(!_2) { - RETURN_MM_NULL(); - } - object_init_ex(return_value, _2); - if (zephir_has_constructor(return_value)) { - ZEPHIR_CALL_METHOD(&_3, this_ptr, "newbind", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, connection, &_3); - zephir_check_call_status(); - } - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("actionName"), &actionName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_QueryFactory, newUpdate) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setDefaultAction) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *connection, connection_sub, _0; + zval *actionName_param = NULL; + zval actionName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&actionName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) + Z_PARAM_STR(actionName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &connection); + zephir_fetch_params(1, 1, 0, &actionName_param); + zephir_get_strval(&actionName, actionName_param); - object_init_ex(return_value, phalcon_datamapper_query_update_ce); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "newbind", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 207, connection, &_0); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultAction"), &actionName); + ZEPHIR_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setDefaultNamespace) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *defaultNamespace_param = NULL; + zval defaultNamespace; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&defaultNamespace); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(defaultNamespace) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &defaultNamespace_param); + zephir_get_strval(&defaultNamespace, defaultNamespace_param); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultNamespace"), &defaultNamespace); + ZEPHIR_MM_RESTORE(); +} -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Select) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getHandlerClass) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Select, phalcon, datamapper_query_select, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_select_method_entry, 0); - - zend_declare_property_string(phalcon_datamapper_query_select_ce, SL("asAlias"), "", ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_datamapper_query_select_ce, SL("forUpdate"), 0, ZEND_ACC_PROTECTED); - zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_INNER"), "INNER"); + zval handlerSuffix, handlerName, namespaceName, camelizedClass, handlerClass, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); - zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_LEFT"), "LEFT"); + ZVAL_UNDEF(&handlerSuffix); + ZVAL_UNDEF(&handlerName); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&camelizedClass); + ZVAL_UNDEF(&handlerClass); + ZVAL_UNDEF(&_0); - zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_NATURAL"), "NATURAL"); - zephir_declare_class_constant_string(phalcon_datamapper_query_select_ce, SL("JOIN_RIGHT"), "RIGHT"); + ZEPHIR_MM_GROW(); - return SUCCESS; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "resolveemptyproperties", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("handlerSuffix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&handlerSuffix, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("handlerName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&handlerName, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("namespaceName"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&namespaceName, &_0); + if (!(zephir_memnstr_str(&handlerName, SL("\\"), "phalcon/Dispatcher/AbstractDispatcher.zep", 938))) { + ZEPHIR_CALL_METHOD(&camelizedClass, this_ptr, "tocamelcase", NULL, 0, &handlerName); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&camelizedClass, &handlerName); + } + ZEPHIR_INIT_VAR(&handlerClass); + if (zephir_is_true(&namespaceName)) { + if (!(zephir_end_with_str(&namespaceName, SL("\\")))) { + zephir_concat_self_str(&namespaceName, SL("\\")); + } + ZEPHIR_CONCAT_VVV(&handlerClass, &namespaceName, &camelizedClass, &handlerSuffix); + } else { + ZEPHIR_CONCAT_VV(&handlerClass, &camelizedClass, &handlerSuffix); + } + RETURN_CCTOR(&handlerClass); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, __call) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setParam) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval params, proxied, _0$$3, _3$$3; - zval *method_param = NULL, *params_param = NULL, __$true, _5, _1$$3, _2$$3, _4$$3; - zval method, _6; + zval *param, param_sub, *value, value_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&_6); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&proxied); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(¶m_sub); + ZVAL_UNDEF(&value_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(method) - Z_PARAM_ARRAY(params) + Z_PARAM_ZVAL(param) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &method_param, ¶ms_param); - zephir_get_strval(&method, method_param); - zephir_get_arrval(¶ms, params_param); + zephir_fetch_params(1, 2, 0, ¶m, &value); - ZEPHIR_INIT_VAR(&proxied); - zephir_create_array(&proxied, 10, 0); - zephir_array_update_string(&proxied, SL("fetchAffected"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchAll"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchAssoc"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchCol"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchGroup"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchObject"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchObjects"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchOne"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchPairs"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&proxied, SL("fetchValue"), &__$true, PH_COPY | PH_SEPARATE); - if (EXPECTED(zephir_array_isset(&proxied, &method))) { - ZEPHIR_INIT_VAR(&_0$$3); - zephir_create_array(&_0$$3, 2, 0); - ZEPHIR_OBS_VAR(&_1$$3); - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC); - zephir_array_fast_append(&_0$$3, &_1$$3); - zephir_array_fast_append(&_0$$3, &method); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_INIT_VAR(&_3$$3); - zephir_create_array(&_3$$3, 2, 0); - ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "getstatement", NULL, 0); - zephir_check_call_status(); - zephir_array_fast_append(&_3$$3, &_4$$3); - ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "getbindvalues", NULL, 0); - zephir_check_call_status(); - zephir_array_fast_append(&_3$$3, &_4$$3); - zephir_fast_array_merge(&_2$$3, &_3$$3, ¶ms); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_0$$3, &_2$$3); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&_5); - object_init_ex(&_5, spl_ce_BadMethodCallException); - ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CONCAT_SVS(&_6, "Unknown method: [", &method, "]"); - ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 72, &_6); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setparameter", NULL, 0, param, value); zephir_check_call_status(); - zephir_throw_exception_debug(&_5, "phalcon/DataMapper/Query/Select.zep", 83); ZEPHIR_MM_RESTORE(); - return; } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, andHaving) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setParameter) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0; - zval condition; + zval *param, param_sub, *value, value_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); + ZVAL_UNDEF(¶m_sub); ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(param) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params_without_memory_grow(2, 0, ¶m, &value); - ZVAL_LONG(&_0, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "having", NULL, 0, &condition, value, &_0); - zephir_check_call_status(); - RETURN_THIS(); + zephir_update_property_array(this_ptr, SL("params"), param, value); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, asAlias) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *asAlias_param = NULL; - zval asAlias; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *params_param = NULL; + zval params; zval *this_ptr = getThis(); - ZVAL_UNDEF(&asAlias); + ZVAL_UNDEF(¶ms); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(asAlias) + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &asAlias_param); - zephir_get_strval(&asAlias, asAlias_param); + zephir_fetch_params(1, 1, 0, ¶ms_param); + zephir_get_arrval(¶ms, params_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("asAlias"), &asAlias); - RETURN_THIS(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setparameters", NULL, 0, ¶ms); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, appendHaving) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setParameters) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1; - zval condition; + zval *params_param = NULL; + zval params; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(¶ms); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params(1, 1, 0, ¶ms_param); + zephir_get_arrval(¶ms, params_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "HAVING"); - ZVAL_LONG(&_1, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendcondition", NULL, 0, &_0, &condition, value, &_1); - zephir_check_call_status(); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), ¶ms); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, appendJoin) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setReturnedValue) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, end, key, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _0$$3, _1$$3, _2$$3; - zval condition; + zval *value, value_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&end); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &value); - if (!(ZEPHIR_IS_EMPTY(value))) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_2$$3, type); - ZEPHIR_CALL_METHOD(&_1$$3, &_0$$3, "bindinline", NULL, 0, value, &_2$$3); - zephir_check_call_status(); - zephir_concat_self(&condition, &_1$$3); - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_4, &_3, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 158); - ZEPHIR_CALL_FUNCTION(&end, "array_key_last", NULL, 36, &_4); - zephir_check_call_status(); - zephir_read_property(&_5, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_6, &_5, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); - zephir_array_fetch(&_7, &_6, &end, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 159); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_7); - zephir_check_call_status(); - zephir_read_property(&_8, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_9, &_8, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); - zephir_array_fetch(&_10, &_9, &end, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); - zephir_array_fetch(&_11, &_10, &key, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 161); - ZEPHIR_INIT_VAR(&_12); - ZEPHIR_CONCAT_VV(&_12, &_11, &condition); - zephir_update_property_array_multi(this_ptr, SL("store"), &_12, SL("szz"), 4, SL("FROM"), &end, &key); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("returnedValue"), value); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, columns) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setActionSuffix) { - zval _0, _1, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *actionSuffix_param = NULL; + zval actionSuffix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&actionSuffix); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(actionSuffix) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &actionSuffix_param); + zephir_get_strval(&actionSuffix, actionSuffix_param); - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 177); - ZEPHIR_INIT_VAR(&_3); - zephir_get_args(&_3); - zephir_fast_array_merge(&_0, &_2, &_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "COLUMNS"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_0); - RETURN_THIS(); + + zephir_update_property_zval(this_ptr, ZEND_STRL("actionSuffix"), &actionSuffix); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, distinct) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setEventsManager) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *enable_param = NULL, _0, _1; - zend_bool enable; + zval *eventsManager, eventsManager_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&eventsManager_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(enable) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &enable_param); - if (!enable_param) { - enable = 1; - } else { - enable = zephir_get_boolval(enable_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "DISTINCT"); - if (enable) { - ZVAL_BOOL(&_1, 1); - } else { - ZVAL_BOOL(&_1, 0); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setflag", NULL, 0, &_0, &_1); - zephir_check_call_status(); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, from) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setHandlerSuffix) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL; - zval table; + zval *handlerSuffix_param = NULL; + zval handlerSuffix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&handlerSuffix); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(table) + Z_PARAM_STR(handlerSuffix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &table_param); - zephir_get_strval(&table, table_param); + zephir_fetch_params(1, 1, 0, &handlerSuffix_param); + zephir_get_strval(&handlerSuffix, handlerSuffix_param); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - zephir_array_fast_append(&_0, &table); - zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("FROM")); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerSuffix"), &handlerSuffix); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, forUpdate) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setModelBinder) { - zval *enable_param = NULL, __$true, __$false; - zend_bool enable; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *modelBinder, modelBinder_sub, *cache = NULL, cache_sub, __$true, __$false, __$null, container, _0$$3, _1$$3; zval *this_ptr = getThis(); + ZVAL_UNDEF(&modelBinder_sub); + ZVAL_UNDEF(&cache_sub); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_OBJECT_OF_CLASS(modelBinder, phalcon_mvc_model_binderinterface_ce) Z_PARAM_OPTIONAL - Z_PARAM_BOOL(enable) + Z_PARAM_ZVAL_OR_NULL(cache) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(0, 1, &enable_param); - if (!enable_param) { - enable = 1; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &modelBinder, &cache); + if (!cache) { + cache = &cache_sub; + ZEPHIR_CPY_WRT(cache, &__$null); } else { - enable = zephir_get_boolval(enable_param); + ZEPHIR_SEPARATE_PARAM(cache); } - if (enable) { - zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$true); + if (Z_TYPE_P(cache) == IS_STRING) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0$$3); + ZEPHIR_CALL_METHOD(&_1$$3, &container, "get", NULL, 0, cache); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(cache, &_1$$3); + } + if (Z_TYPE_P(cache) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, modelBinder, "setcache", NULL, 0, cache); + zephir_check_call_status(); + } + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("modelBinding"), &__$true); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$false); + zephir_update_property_zval(this_ptr, ZEND_STRL("modelBinding"), &__$false); } - RETURN_THISW(); + zephir_update_property_zval(this_ptr, ZEND_STRL("modelBinder"), modelBinder); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, getStatement) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setModuleName) { - zval _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *moduleName_param = NULL; + zval moduleName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&moduleName); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(moduleName) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &moduleName_param); + if (!moduleName_param) { + ZEPHIR_INIT_VAR(&moduleName); + } else { + zephir_get_strval(&moduleName, moduleName_param); + } - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("UNION"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 231); - zephir_fast_join_str(&_0, SL(""), &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getcurrentstatement", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_VV(return_value, &_0, &_3); - RETURN_MM(); + + zephir_update_property_zval(this_ptr, ZEND_STRL("moduleName"), &moduleName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, groupBy) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, setNamespaceName) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *groupBy, groupBy_sub, _0; + zval *namespaceName_param = NULL; + zval namespaceName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&groupBy_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&namespaceName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(groupBy) + Z_PARAM_STR(namespaceName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &groupBy); + zephir_fetch_params(1, 1, 0, &namespaceName_param); + zephir_get_strval(&namespaceName, namespaceName_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "GROUP"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "processvalue", NULL, 0, &_0, groupBy); - zephir_check_call_status(); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("namespaceName"), &namespaceName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, hasColumns) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, getReturnedValue) { - zval _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + RETURN_MEMBER(getThis(), "returnedValue"); +} - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 255); - RETURN_BOOL(zephir_fast_count_int(&_1) > 0); +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, wasForwarded) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "forwarded"); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, having) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, resolveEmptyProperties) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; - zval condition; + zval _0, _2, _4, _1$$3, _3$$4, _5$$5; zval *this_ptr = getThis(); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; + + zephir_read_property(&_0, this_ptr, ZEND_STRL("namespaceName"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_0))) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("defaultNamespace"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("namespaceName"), &_1$$3); } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); + zephir_read_property(&_2, this_ptr, ZEND_STRL("handlerName"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_2))) { + zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("defaultHandler"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerName"), &_3$$4); + } + zephir_read_property(&_4, this_ptr, ZEND_STRL("actionName"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_4))) { + zephir_read_property(&_5$$5, this_ptr, ZEND_STRL("defaultAction"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("actionName"), &_5$$5); } - - - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "HAVING"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "AND "); - ZVAL_LONG(&_2, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); - zephir_check_call_status(); - RETURN_THIS(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, join) +static PHP_METHOD(Phalcon_Dispatcher_AbstractDispatcher, toCamelCase) { - zend_bool _5, _10; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *join_param = NULL, *table_param = NULL, *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, key, _0, _1, _2, _3, _4, _6, _7, _8, _9, _11, _12, _13, _14, _19, _20, _16$$5, _17$$5, _18$$5; - zval join, table, condition, _21, _15$$4; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *input_param = NULL, camelCaseInput, _0, _1$$3, _2$$3, _3$$3; + zval input; zval *this_ptr = getThis(); - ZVAL_UNDEF(&join); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&_21); - ZVAL_UNDEF(&_15$$4); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&input); + ZVAL_UNDEF(&camelCaseInput); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_19); - ZVAL_UNDEF(&_20); - ZVAL_UNDEF(&_16$$5); - ZVAL_UNDEF(&_17$$5); - ZVAL_UNDEF(&_18$$5); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STR(join) - Z_PARAM_STR(table) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(input) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &join_param, &table_param, &condition_param, &value, &type_param); - zephir_get_strval(&join, join_param); - zephir_get_strval(&table, table_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params(1, 1, 0, &input_param); + zephir_get_strval(&input, input_param); - ZEPHIR_INIT_VAR(&_0); - zephir_fast_trim(&_0, &join, NULL , ZEPHIR_TRIM_BOTH); - ZEPHIR_INIT_NVAR(&join); - zephir_fast_strtoupper(&join, &_0); - ZVAL_LONG(&_1, -4); - ZEPHIR_INIT_VAR(&_2); - zephir_substr(&_2, &join, -4 , 0, ZEPHIR_SUBSTR_NO_LENGTH); - if (!ZEPHIR_IS_STRING_IDENTICAL(&_2, "JOIN")) { - zephir_concat_self_str(&join, " JOIN", sizeof(" JOIN") - 1); + ZEPHIR_OBS_VAR(&camelCaseInput); + zephir_read_property(&_0, this_ptr, ZEND_STRL("camelCaseMap"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&camelCaseInput, &_0, &input, 0))) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "/[_-]+/"); + ZEPHIR_CALL_FUNCTION(&_2$$3, "preg_split", NULL, 70, &_1$$3, &input); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_1$$3); + ZVAL_STRING(&_1$$3, "ucfirst"); + ZEPHIR_CALL_FUNCTION(&_3$$3, "array_map", NULL, 69, &_1$$3, &_2$$3); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&camelCaseInput); + zephir_fast_join_str(&camelCaseInput, SL(""), &_3$$3); + zephir_update_property_array(this_ptr, SL("camelCaseMap"), &input, &camelCaseInput); } - ZEPHIR_INIT_VAR(&_3); - zephir_fast_trim(&_3, &condition, NULL , ZEPHIR_TRIM_LEFT); - zephir_get_strval(&condition, &_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, ""); - _5 = !ZEPHIR_IS_IDENTICAL(&_4, &condition); - if (_5) { - ZEPHIR_INIT_VAR(&_6); - ZVAL_LONG(&_7, 0); - ZVAL_LONG(&_8, 3); - ZEPHIR_INIT_VAR(&_9); - zephir_substr(&_9, &condition, 0 , 3 , 0); - zephir_fast_strtoupper(&_6, &_9); - _5 = !ZEPHIR_IS_STRING_IDENTICAL(&_6, "ON "); - } - _10 = _5; - if (_10) { - ZEPHIR_INIT_VAR(&_11); - ZVAL_LONG(&_12, 0); - ZVAL_LONG(&_13, 6); - ZEPHIR_INIT_VAR(&_14); - zephir_substr(&_14, &condition, 0 , 6 , 0); - zephir_fast_strtoupper(&_11, &_14); - _10 = !ZEPHIR_IS_STRING_IDENTICAL(&_11, "USING "); - } - if (_10) { - ZEPHIR_INIT_VAR(&_15$$4); - ZEPHIR_CONCAT_SV(&_15$$4, "ON ", &condition); - ZEPHIR_CPY_WRT(&condition, &_15$$4); - } - if (!(ZEPHIR_IS_EMPTY(value))) { - zephir_read_property(&_16$$5, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_18$$5, type); - ZEPHIR_CALL_METHOD(&_17$$5, &_16$$5, "bindinline", NULL, 0, value, &_18$$5); - zephir_check_call_status(); - zephir_concat_self(&condition, &_17$$5); - } - zephir_read_property(&_19, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_20, &_19, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 316); - ZEPHIR_CALL_FUNCTION(&key, "array_key_last", NULL, 36, &_20); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_21); - ZEPHIR_CONCAT_VSVSV(&_21, &join, " ", &table, " ", &condition); - zephir_update_property_array_multi(this_ptr, SL("store"), &_21, SL("sza"), 4, SL("FROM"), &key); - RETURN_THIS(); + RETURN_CCTOR(&camelCaseInput); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, orHaving) +zend_object *zephir_init_properties_Phalcon_Dispatcher_AbstractDispatcher(zend_class_entry *class_type) { + zval _0, _2, _4, _6, _1$$3, _3$$4, _5$$5, _7$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *condition_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _0, _1, _2; - zval condition; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(condition) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("handlerHashes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("handlerHashes"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("camelCaseMap"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("camelCaseMap"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("activeMethodMap"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("activeMethodMap"), &_7$$6); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &condition_param, &value, &type_param); - zephir_get_strval(&condition, condition_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "HAVING"); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "OR "); - ZVAL_LONG(&_2, type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "addcondition", NULL, 0, &_0, &_1, &condition, value, &_2); - zephir_check_call_status(); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Select, reset) +ZEPHIR_INIT_CLASS(Phalcon_Dispatcher_DispatcherInterface) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, _1; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Dispatcher, DispatcherInterface, phalcon, dispatcher_dispatcherinterface, phalcon_dispatcher_dispatcherinterface_method_entry); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&_1); + return SUCCESS; +} +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, dispatch); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, forward); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getActionName); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getActionSuffix); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getHandlerSuffix); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getParam); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getParameter); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getParams); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getParameters); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, getReturnedValue); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, hasParam); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, isFinished); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setActionName); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setActionSuffix); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setDefaultAction); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setDefaultNamespace); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setHandlerSuffix); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setModuleName); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setNamespaceName); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setParam); +ZEPHIR_DOC_METHOD(Phalcon_Dispatcher_DispatcherInterface, setParams); - ZEPHIR_MM_GROW(); - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_select_ce, getThis(), "reset", &_0, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, ""); - zephir_update_property_zval(this_ptr, ZEND_STRL("asAlias"), &_1); - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("forUpdate"), &__$false); - } - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Select, subSelect) -{ - zval _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); +#ifdef HAVE_CONFIG_H +#endif - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZEPHIR_MM_GROW(); - object_init_ex(return_value, phalcon_datamapper_query_select_ce); - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 208, &_0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Select, union) +ZEPHIR_INIT_CLASS(Phalcon_Dispatcher_Exception) { - zval _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Dispatcher, Exception, phalcon, dispatcher_exception, zend_ce_exception, NULL, 0); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_ACTION_NOT_FOUND"), 5); + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_CYCLIC_ROUTING"), 1); - ZEPHIR_MM_GROW(); + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_HANDLER_NOT_FOUND"), 2); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, " UNION "); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcurrentstatement", NULL, 0, &_1); - zephir_check_call_status(); - zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("UNION")); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); - zephir_check_call_status(); - RETURN_THIS(); + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_INVALID_HANDLER"), 3); + + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_INVALID_PARAMS"), 4); + + zephir_declare_class_constant_long(phalcon_dispatcher_exception_ce, SL("EXCEPTION_NO_DI"), 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, unionAll) -{ - zval _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, " UNION ALL "); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcurrentstatement", NULL, 0, &_1); - zephir_check_call_status(); - zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sa"), 3, SL("UNION")); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reset", NULL, 0); - zephir_check_call_status(); - RETURN_THIS(); + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Application) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Application, phalcon, mvc_application, phalcon_application_abstractapplication_ce, phalcon_mvc_application_method_entry, 0); + + zend_declare_property_bool(phalcon_mvc_application_ce, SL("implicitView"), 1, ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_application_ce, SL("sendCookies"), 1, ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_application_ce, SL("sendHeaders"), 1, ZEND_ACC_PROTECTED); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, getCurrentStatement) +static PHP_METHOD(Phalcon_Mvc_Application, handle) { + zval _17$$20; + zend_class_entry *_6$$7; + zend_bool returnedResponse = 0, _1, _10$$6, _13$$11, _31$$30, _33$$30; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *suffix_param = NULL, statement, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13$$4, _14$$4; - zval suffix, forUpdate; + zval *uri_param = NULL, __$false, container, eventsManager, router, dispatcher, response, view, module, moduleObject, moduleName, className, path, implicitView, controller, possibleResponse, renderStatus, matchedRoute, match, _0, _2, _3, _4, _21, _22, _23, _24, _41, _5$$7, _7$$6, _8$$8, _9$$8, _11$$12, _12$$12, _14$$18, _15$$18, _16$$15, _18$$22, _19$$23, _20$$23, _25$$25, _26$$25, _27$$27, _28$$27, _29$$29, _30$$29, _32$$31, _34$$34, _35$$35, _36$$35, _37$$38, _38$$38, _39$$39, _40$$40; + zval uri; zval *this_ptr = getThis(); - ZVAL_UNDEF(&suffix); - ZVAL_UNDEF(&forUpdate); - ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&uri); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&dispatcher); + ZVAL_UNDEF(&response); + ZVAL_UNDEF(&view); + ZVAL_UNDEF(&module); + ZVAL_UNDEF(&moduleObject); + ZVAL_UNDEF(&moduleName); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&path); + ZVAL_UNDEF(&implicitView); + ZVAL_UNDEF(&controller); + ZVAL_UNDEF(&possibleResponse); + ZVAL_UNDEF(&renderStatus); + ZVAL_UNDEF(&matchedRoute); + ZVAL_UNDEF(&match); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13$$4); - ZVAL_UNDEF(&_14$$4); + ZVAL_UNDEF(&_21); + ZVAL_UNDEF(&_22); + ZVAL_UNDEF(&_23); + ZVAL_UNDEF(&_24); + ZVAL_UNDEF(&_41); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_9$$8); + ZVAL_UNDEF(&_11$$12); + ZVAL_UNDEF(&_12$$12); + ZVAL_UNDEF(&_14$$18); + ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&_16$$15); + ZVAL_UNDEF(&_18$$22); + ZVAL_UNDEF(&_19$$23); + ZVAL_UNDEF(&_20$$23); + ZVAL_UNDEF(&_25$$25); + ZVAL_UNDEF(&_26$$25); + ZVAL_UNDEF(&_27$$27); + ZVAL_UNDEF(&_28$$27); + ZVAL_UNDEF(&_29$$29); + ZVAL_UNDEF(&_30$$29); + ZVAL_UNDEF(&_32$$31); + ZVAL_UNDEF(&_34$$34); + ZVAL_UNDEF(&_35$$35); + ZVAL_UNDEF(&_36$$35); + ZVAL_UNDEF(&_37$$38); + ZVAL_UNDEF(&_38$$38); + ZVAL_UNDEF(&_39$$39); + ZVAL_UNDEF(&_40$$40); + ZVAL_UNDEF(&_17$$20); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(suffix) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(uri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &suffix_param); - if (!suffix_param) { - ZEPHIR_INIT_VAR(&suffix); - ZVAL_STRING(&suffix, ""); + zephir_fetch_params(1, 1, 0, &uri_param); + if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(&uri, uri_param); } else { - zephir_get_strval(&suffix, suffix_param); + ZEPHIR_INIT_VAR(&uri); } - ZEPHIR_INIT_VAR(&forUpdate); - zephir_read_property(&_0, this_ptr, ZEND_STRL("forUpdate"), PH_NOISY_CC | PH_READONLY); - if (zephir_is_true(&_0)) { - ZEPHIR_INIT_NVAR(&forUpdate); - ZVAL_STRING(&forUpdate, " FOR UPDATE"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_application_exception_ce, "A dependency injection container is required to access internal services", "phalcon/Mvc/Application.zep", 100); + return; } - ZEPHIR_CALL_METHOD(&_1, this_ptr, "buildflags", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + _1 = Z_TYPE_P(&eventsManager) != IS_NULL; + if (_1) { + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "application:boot"); + ZEPHIR_CALL_METHOD(&_2, &eventsManager, "fire", NULL, 0, &_3, this_ptr); + zephir_check_call_status(); + _1 = ZEPHIR_IS_FALSE_IDENTICAL(&_2); + } + if (_1) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "router"); + ZEPHIR_CALL_METHOD(&_4, &container, "getshared", NULL, 0, &_3); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "buildlimitearly", NULL, 0); + ZEPHIR_CPY_WRT(&router, &_4); + ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &uri); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 209); + ZEPHIR_CALL_METHOD(&matchedRoute, &router, "getmatchedroute", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildfrom", NULL, 210); + if (Z_TYPE_P(&matchedRoute) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&match, &matchedRoute, "getmatch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&match) != IS_NULL) { + if (zephir_is_instance_of(&match, SL("Closure"))) { + _6$$7 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_CALL_CE_STATIC(&_5$$7, _6$$7, "bind", NULL, 0, &match, &container); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&match, &_5$$7); + } + ZEPHIR_CALL_METHOD(&_7$$6, &router, "getparams", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&possibleResponse); + ZEPHIR_CALL_USER_FUNC_ARRAY(&possibleResponse, &match, &_7$$6); + zephir_check_call_status(); + if (Z_TYPE_P(&possibleResponse) == IS_STRING) { + ZEPHIR_INIT_VAR(&_9$$8); + ZVAL_STRING(&_9$$8, "response"); + ZEPHIR_CALL_METHOD(&_8$$8, &container, "getshared", NULL, 0, &_9$$8); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_8$$8); + ZEPHIR_CALL_METHOD(NULL, &response, "setcontent", NULL, 0, &possibleResponse); + zephir_check_call_status(); + RETURN_CCTOR(&response); + } + _10$$6 = Z_TYPE_P(&possibleResponse) == IS_OBJECT; + if (_10$$6) { + _10$$6 = zephir_instance_of_ev(&possibleResponse, phalcon_http_responseinterface_ce); + } + if (_10$$6) { + ZEPHIR_CALL_METHOD(NULL, &possibleResponse, "sendheaders", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &possibleResponse, "sendcookies", NULL, 0); + zephir_check_call_status(); + RETURN_CCTOR(&possibleResponse); + } + } + } + ZEPHIR_CALL_METHOD(&moduleName, &router, "getmodulename", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6); - ZVAL_STRING(&_6, "WHERE"); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "buildcondition", NULL, 0, &_6); + if (!(zephir_is_true(&moduleName))) { + ZEPHIR_OBS_NVAR(&moduleName); + zephir_read_property(&moduleName, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC); + } + ZEPHIR_INIT_VAR(&moduleObject); + ZVAL_NULL(&moduleObject); + if (zephir_is_true(&moduleName)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_12$$12); + ZVAL_STRING(&_12$$12, "application:beforeStartModule"); + ZEPHIR_CALL_METHOD(&_11$$12, &eventsManager, "fire", NULL, 0, &_12$$12, this_ptr, &moduleName); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_11$$12)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_CALL_METHOD(&module, this_ptr, "getmodule", NULL, 0, &moduleName); + zephir_check_call_status(); + _13$$11 = Z_TYPE_P(&module) != IS_ARRAY; + if (_13$$11) { + _13$$11 = Z_TYPE_P(&module) != IS_OBJECT; + } + if (UNEXPECTED(_13$$11)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_application_exception_ce, "Invalid module definition", "phalcon/Mvc/Application.zep", 196); + return; + } + if (Z_TYPE_P(&module) == IS_ARRAY) { + ZEPHIR_OBS_VAR(&className); + if (!(zephir_array_isset_string_fetch(&className, &module, SL("className"), 0))) { + ZEPHIR_INIT_NVAR(&className); + ZVAL_STRING(&className, "Module"); + } + ZEPHIR_OBS_VAR(&path); + if (zephir_array_isset_string_fetch(&path, &module, SL("path"), 0)) { + if (UNEXPECTED(!((zephir_file_exists(&path) == SUCCESS)))) { + ZEPHIR_INIT_VAR(&_14$$18); + object_init_ex(&_14$$18, phalcon_mvc_application_exception_ce); + ZEPHIR_INIT_VAR(&_15$$18); + ZEPHIR_CONCAT_SVS(&_15$$18, "Module definition path '", &path, "' doesn't exist"); + ZEPHIR_CALL_METHOD(NULL, &_14$$18, "__construct", NULL, 32, &_15$$18); + zephir_check_call_status(); + zephir_throw_exception_debug(&_14$$18, "phalcon/Mvc/Application.zep", 218); + ZEPHIR_MM_RESTORE(); + return; + } + if (!(zephir_class_exists(&className, zephir_is_true(&__$false) ))) { + if (zephir_require_once_zval(&path) == FAILURE) { + RETURN_MM_NULL(); + } + } + } + ZEPHIR_CALL_METHOD(&_16$$15, &container, "get", NULL, 0, &className); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&moduleObject, &_16$$15); + ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerautoloaders", NULL, 0, &container); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &moduleObject, "registerservices", NULL, 0, &container); + zephir_check_call_status(); + } else { + if (UNEXPECTED(!((zephir_is_instance_of(&module, SL("Closure")))))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_application_exception_ce, "Invalid module definition", "phalcon/Mvc/Application.zep", 239); + return; + } + ZEPHIR_INIT_VAR(&_17$$20); + zephir_create_array(&_17$$20, 1, 0); + zephir_array_fast_append(&_17$$20, &container); + ZEPHIR_INIT_NVAR(&moduleObject); + ZEPHIR_CALL_USER_FUNC_ARRAY(&moduleObject, &module, &_17$$20); + zephir_check_call_status(); + } + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_18$$22); + ZVAL_STRING(&_18$$22, "application:afterStartModule"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_18$$22, this_ptr, &moduleObject); + zephir_check_call_status(); + } + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("implicitView"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&implicitView, &_0); + if (ZEPHIR_IS_TRUE_IDENTICAL(&implicitView)) { + ZEPHIR_INIT_VAR(&_20$$23); + ZVAL_STRING(&_20$$23, "view"); + ZEPHIR_CALL_METHOD(&_19$$23, &container, "getshared", NULL, 0, &_20$$23); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&view, &_19$$23); + } + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "dispatcher"); + ZEPHIR_CALL_METHOD(&_4, &container, "getshared", NULL, 0, &_3); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6); - ZVAL_STRING(&_6, "GROUP"); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "buildby", NULL, 0, &_6); + ZEPHIR_CPY_WRT(&dispatcher, &_4); + ZEPHIR_CALL_METHOD(&_4, &router, "getmodulename", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6); - ZVAL_STRING(&_6, "HAVING"); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "buildcondition", NULL, 0, &_6); + ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setmodulename", NULL, 0, &_4); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6); - ZVAL_STRING(&_6, "ORDER"); - ZEPHIR_CALL_METHOD(&_9, this_ptr, "buildby", NULL, 0, &_6); + ZEPHIR_CALL_METHOD(&_21, &router, "getnamespacename", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "buildlimit", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setnamespacename", NULL, 0, &_21); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&statement); - ZEPHIR_CONCAT_SVVVVVVVVVV(&statement, "SELECT", &_1, &_2, &_3, &_4, &_5, &_7, &_8, &_9, &_10, &forUpdate); - zephir_read_property(&_11, this_ptr, ZEND_STRL("asAlias"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_12); - ZVAL_STRING(&_12, ""); - if (UNEXPECTED(!ZEPHIR_IS_IDENTICAL(&_12, &_11))) { - zephir_read_property(&_13$$4, this_ptr, ZEND_STRL("asAlias"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_14$$4); - ZEPHIR_CONCAT_SVSV(&_14$$4, "(", &statement, ") AS ", &_13$$4); - ZEPHIR_CPY_WRT(&statement, &_14$$4); + ZEPHIR_CALL_METHOD(&_22, &router, "getcontrollername", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setcontrollername", NULL, 0, &_22); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_23, &router, "getactionname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setactionname", NULL, 0, &_23); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_24, &router, "getparams", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &dispatcher, "setparams", NULL, 0, &_24); + zephir_check_call_status(); + if (ZEPHIR_IS_TRUE_IDENTICAL(&implicitView)) { + ZEPHIR_CALL_METHOD(NULL, &view, "start", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_CONCAT_VV(return_value, &statement, &suffix); - RETURN_MM(); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_26$$25); + ZVAL_STRING(&_26$$25, "application:beforeHandleRequest"); + ZEPHIR_CALL_METHOD(&_25$$25, &eventsManager, "fire", NULL, 0, &_26$$25, this_ptr, &dispatcher); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_25$$25)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_CALL_METHOD(&controller, &dispatcher, "dispatch", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&possibleResponse, &dispatcher, "getreturnedvalue", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&possibleResponse)) { + ZEPHIR_INIT_VAR(&_28$$27); + ZVAL_STRING(&_28$$27, "response"); + ZEPHIR_CALL_METHOD(&_27$$27, &container, "getshared", NULL, 0, &_28$$27); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_27$$27); + } else { + if (Z_TYPE_P(&possibleResponse) == IS_STRING) { + ZEPHIR_INIT_VAR(&_30$$29); + ZVAL_STRING(&_30$$29, "response"); + ZEPHIR_CALL_METHOD(&_29$$29, &container, "getshared", NULL, 0, &_30$$29); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_29$$29); + ZEPHIR_CALL_METHOD(NULL, &response, "setcontent", NULL, 0, &possibleResponse); + zephir_check_call_status(); + } else { + _31$$30 = (Z_TYPE_P(&possibleResponse) == IS_OBJECT); + if (_31$$30) { + _31$$30 = (zephir_instance_of_ev(&possibleResponse, phalcon_http_responseinterface_ce)); + } + returnedResponse = _31$$30; + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_32$$31); + ZVAL_STRING(&_32$$31, "application:afterHandleRequest"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_32$$31, this_ptr, &controller); + zephir_check_call_status(); + } + _33$$30 = returnedResponse == 0; + if (_33$$30) { + _33$$30 = ZEPHIR_IS_TRUE_IDENTICAL(&implicitView); + } + if (_33$$30) { + if (Z_TYPE_P(&controller) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&renderStatus); + ZVAL_BOOL(&renderStatus, 1); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_34$$34); + ZVAL_STRING(&_34$$34, "application:viewRender"); + ZEPHIR_CALL_METHOD(&renderStatus, &eventsManager, "fire", NULL, 0, &_34$$34, this_ptr, &view); + zephir_check_call_status(); + } + if (!ZEPHIR_IS_FALSE_IDENTICAL(&renderStatus)) { + ZEPHIR_CALL_METHOD(&_35$$35, &dispatcher, "getcontrollername", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_36$$35, &dispatcher, "getactionname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &view, "render", NULL, 0, &_35$$35, &_36$$35); + zephir_check_call_status(); + } + } + } + if (ZEPHIR_IS_TRUE_IDENTICAL(&implicitView)) { + ZEPHIR_CALL_METHOD(NULL, &view, "finish", NULL, 0); + zephir_check_call_status(); + } + if (returnedResponse == 1) { + ZEPHIR_CPY_WRT(&response, &possibleResponse); + } else { + ZEPHIR_INIT_VAR(&_38$$38); + ZVAL_STRING(&_38$$38, "response"); + ZEPHIR_CALL_METHOD(&_37$$38, &container, "getshared", NULL, 0, &_38$$38); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_37$$38); + if (ZEPHIR_IS_TRUE_IDENTICAL(&implicitView)) { + ZEPHIR_CALL_METHOD(&_39$$39, &view, "getcontent", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &response, "setcontent", NULL, 0, &_39$$39); + zephir_check_call_status(); + } + } + } + } + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_40$$40); + ZVAL_STRING(&_40$$40, "application:beforeSendResponse"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_40$$40, this_ptr, &response); + zephir_check_call_status(); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("sendHeaders"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_0)) { + ZEPHIR_CALL_METHOD(NULL, &response, "sendheaders", NULL, 0); + zephir_check_call_status(); + } + zephir_read_property(&_41, this_ptr, ZEND_STRL("sendCookies"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_41)) { + ZEPHIR_CALL_METHOD(NULL, &response, "sendcookies", NULL, 0); + zephir_check_call_status(); + } + RETURN_CCTOR(&response); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, buildColumns) +static PHP_METHOD(Phalcon_Mvc_Application, sendCookiesOnHandleRequest) { - zval columns, _0, _3, _1$$3, _2$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *sendCookies_param = NULL, __$true, __$false; + zend_bool sendCookies; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(sendCookies) + ZEND_PARSE_PARAMETERS_END(); +#endif - ZEPHIR_MM_GROW(); + zephir_fetch_params_without_memory_grow(1, 0, &sendCookies_param); + sendCookies = zephir_get_boolval(sendCookies_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "hascolumns", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(&_0))) { - ZEPHIR_INIT_VAR(&columns); - zephir_create_array(&columns, 1, 0); - ZEPHIR_INIT_VAR(&_1$$3); - ZVAL_STRING(&_1$$3, "*"); - zephir_array_fast_append(&columns, &_1$$3); + + if (sendCookies) { + zephir_update_property_zval(this_ptr, ZEND_STRL("sendCookies"), &__$true); } else { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_2$$4, SL("COLUMNS"), PH_NOISY, "phalcon/DataMapper/Query/Select.zep", 442); + zephir_update_property_zval(this_ptr, ZEND_STRL("sendCookies"), &__$false); } - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, ","); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "indent", NULL, 0, &columns, &_3); - zephir_check_call_status(); - RETURN_MM(); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Select, buildFrom) +static PHP_METHOD(Phalcon_Mvc_Application, sendHeadersOnHandleRequest) { - zval from; - zval table, _0, _1, _2, _3, *_4, _5, _14, _15, _6$$4, _8$$4, _10$$4, _11$$5, _12$$5, _13$$5; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *sendHeaders_param = NULL, __$true, __$false; + zend_bool sendHeaders; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_15); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_10$$4); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&_12$$5); - ZVAL_UNDEF(&_13$$5); - ZVAL_UNDEF(&from); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(sendHeaders) + ZEND_PARSE_PARAMETERS_END(); +#endif - ZEPHIR_MM_GROW(); + zephir_fetch_params_without_memory_grow(1, 0, &sendHeaders_param); + sendHeaders = zephir_get_boolval(sendHeaders_param); - ZEPHIR_INIT_VAR(&from); - array_init(&from); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 458); - if (ZEPHIR_IS_EMPTY(&_1)) { - RETURN_MM_STRING(""); + + if (sendHeaders) { + zephir_update_property_zval(this_ptr, ZEND_STRL("sendHeaders"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("sendHeaders"), &__$false); } - zephir_read_property(&_2, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_3, &_2, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Select.zep", 462); - zephir_is_iterable(&_3, 0, "phalcon/DataMapper/Query/Select.zep", 466); - if (Z_TYPE_P(&_3) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_3), _4) - { - ZEPHIR_INIT_NVAR(&table); - ZVAL_COPY(&table, _4); - ZEPHIR_MAKE_REF(&table); - ZEPHIR_CALL_FUNCTION(&_6$$4, "array_shift", &_7, 21, &table); - ZEPHIR_UNREF(&table); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$4, this_ptr, "indent", &_9, 0, &table); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$4); - ZEPHIR_CONCAT_VV(&_10$$4, &_6$$4, &_8$$4); - zephir_array_append(&from, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Select.zep", 463); - } ZEND_HASH_FOREACH_END(); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_Application, useImplicitView) +{ + zval *implicitView_param = NULL, __$true, __$false; + zend_bool implicitView; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(implicitView) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &implicitView_param); + implicitView = zephir_get_boolval(implicitView_param); + + + if (implicitView) { + zephir_update_property_zval(this_ptr, ZEND_STRL("implicitView"), &__$true); } else { - ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&table, &_3, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MAKE_REF(&table); - ZEPHIR_CALL_FUNCTION(&_11$$5, "array_shift", &_7, 21, &table); - ZEPHIR_UNREF(&table); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "indent", &_9, 0, &table); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_13$$5); - ZEPHIR_CONCAT_VV(&_13$$5, &_11$$5, &_12$$5); - zephir_array_append(&from, &_13$$5, PH_SEPARATE, "phalcon/DataMapper/Query/Select.zep", 463); - ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); - zephir_check_call_status(); - } + zephir_update_property_zval(this_ptr, ZEND_STRL("implicitView"), &__$false); } - ZEPHIR_INIT_NVAR(&table); - ZEPHIR_INIT_VAR(&_15); - ZVAL_STRING(&_15, ","); - ZEPHIR_CALL_METHOD(&_14, this_ptr, "indent", &_9, 0, &from, &_15); - zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, " FROM", &_14); - RETURN_MM(); + RETURN_THISW(); } @@ -40238,770 +40853,442 @@ static PHP_METHOD(Phalcon_DataMapper_Query_Select, buildFrom) -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Query_Update) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Controller) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Query, Update, phalcon, datamapper_query_update, phalcon_datamapper_query_abstractconditions_ce, phalcon_datamapper_query_update_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Controller, phalcon, mvc_controller, phalcon_di_injectable_ce, phalcon_mvc_controller_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_class_implements(phalcon_mvc_controller_ce, 1, phalcon_mvc_controllerinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, __construct) +static PHP_METHOD(Phalcon_Mvc_Controller, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *connection, connection_sub, *bind, bind_sub, _1, _2, _3, _4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&bind_sub); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_datamapper_pdo_connection_ce) - Z_PARAM_OBJECT_OF_CLASS(bind, phalcon_datamapper_query_bind_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &connection, &bind); - - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_update_ce, getThis(), "__construct", &_0, 0, connection, bind); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("onconstruct")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "onconstruct", NULL, 0); + zephir_check_call_status(); + } ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, column) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *value = NULL, value_sub, *type_param = NULL, __$null, _1$$3, _2$$3; - zval column, _0; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(column) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) - Z_PARAM_LONG(type) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column_param, &value, &type_param); - zephir_get_strval(&column, column_param); - if (!value) { - value = &value_sub; - value = &__$null; - } - if (!type_param) { - type = -1; - } else { - type = zephir_get_intval(type_param); - } - ZEPHIR_INIT_VAR(&_0); - ZEPHIR_CONCAT_SV(&_0, ":", &column); - zephir_update_property_array_multi(this_ptr, SL("store"), &_0, SL("sz"), 3, SL("COLUMNS"), &column); - if (Z_TYPE_P(value) != IS_NULL) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_2$$3, type); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "setvalue", NULL, 0, &column, value, &_2$$3); - zephir_check_call_status(); - } - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_DataMapper_Query_Update, columns) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_ControllerInterface) { - zend_string *_3; - zend_ulong _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *columns_param = NULL, column, value, *_0, _1; - zval columns; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ControllerInterface, phalcon, mvc_controllerinterface, NULL); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columns) - ZEND_PARSE_PARAMETERS_END(); + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columns_param); - zephir_get_arrval(&columns, columns_param); - zephir_is_iterable(&columns, 0, "phalcon/DataMapper/Query/Update.zep", 76); - if (Z_TYPE_P(&columns) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&columns), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&column); - if (_3 != NULL) { - ZVAL_STR_COPY(&column, _3); - } else { - ZVAL_LONG(&column, _2); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - if (Z_TYPE_P(&column) == IS_LONG) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); - zephir_check_call_status(); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &columns, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &columns, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &columns, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&column) == IS_LONG) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &value); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "column", &_4, 0, &column, &value); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&column); - RETURN_THIS(); + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Dispatcher) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Dispatcher, phalcon, mvc_dispatcher, phalcon_dispatcher_abstractdispatcher_ce, phalcon_mvc_dispatcher_method_entry, 0); + + zend_declare_property_string(phalcon_mvc_dispatcher_ce, SL("defaultAction"), "index", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_dispatcher_ce, SL("defaultHandler"), "index", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_dispatcher_ce, SL("handlerSuffix"), "Controller", ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_mvc_dispatcher_ce, 1, phalcon_mvc_dispatcherinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, from) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, forward) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, _0; - zval table; + zephir_fcall_cache_entry *_2 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *forward_param = NULL, eventsManager, _0, _1$$3; + zval forward; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&forward); + ZVAL_UNDEF(&eventsManager); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(table) + Z_PARAM_ARRAY(forward) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &table_param); - zephir_get_strval(&table, table_param); + zephir_fetch_params(1, 1, 0, &forward_param); + zephir_get_arrval(&forward, forward_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "FROM"); - zephir_update_property_array(this_ptr, SL("store"), &_0, &table); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "dispatch:beforeForward"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_1$$3, this_ptr, &forward); + zephir_check_call_status(); + } + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_dispatcher_ce, getThis(), "forward", &_2, 0, &forward); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, getStatement) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getActiveController) { - zval _0, _1, _2, _3, _4, _5, _6; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); + + + RETURN_MEMBER(getThis(), "activeHandler"); +} + +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getControllerClass) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "buildflags", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("FROM"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 101); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "buildcolumns", NULL, 211); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, "WHERE"); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "buildcondition", NULL, 0, &_5); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6, this_ptr, "buildreturning", NULL, 0); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "gethandlerclass", NULL, 0); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVVVV(return_value, "UPDATE", &_0, " ", &_2, &_3, &_4, &_6); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, hasColumns) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getControllerName) { - zval _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + RETURN_MEMBER(getThis(), "handlerName"); +} - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 113); - RETURN_BOOL(zephir_fast_count_int(&_1) > 0); +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getLastController) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "lastHandler"); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, returning) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getPreviousActionName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "previousActionName"); +} + +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getPreviousControllerName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "previousHandlerName"); +} + +static PHP_METHOD(Phalcon_Mvc_Dispatcher, getPreviousNamespaceName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "previousNamespaceName"); +} + +static PHP_METHOD(Phalcon_Mvc_Dispatcher, setControllerName) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *columns_param = NULL, _0, _1, _2, _3; - zval columns; + zval *controllerName_param = NULL; + zval controllerName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&controllerName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(columns) + Z_PARAM_STR(controllerName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columns_param); - zephir_get_arrval(&columns, columns_param); + zephir_fetch_params(1, 1, 0, &controllerName_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); + } else { + ZEPHIR_INIT_VAR(&controllerName); + } - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_2, &_1, SL("RETURNING"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 126); - zephir_fast_array_merge(&_0, &_2, &columns); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_3, &_0); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerName"), &controllerName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, reset) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, setControllerSuffix) { - zval _1, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; + zval *controllerSuffix_param = NULL; + zval controllerSuffix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&controllerSuffix); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(controllerSuffix) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &controllerSuffix_param); + if (UNEXPECTED(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { + zephir_get_strval(&controllerSuffix, controllerSuffix_param); + } else { + ZEPHIR_INIT_VAR(&controllerSuffix); + } - ZEPHIR_CALL_PARENT(NULL, phalcon_datamapper_query_update_ce, getThis(), "reset", &_0, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "FROM"); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, ""); - zephir_update_property_array(this_ptr, SL("store"), &_1, &_2); - ZEPHIR_INIT_VAR(&_3); - array_init(&_3); - ZEPHIR_INIT_VAR(&_4); - ZVAL_STRING(&_4, "RETURNING"); - zephir_update_property_array(this_ptr, SL("store"), &_4, &_3); + + zephir_update_property_zval(this_ptr, ZEND_STRL("handlerSuffix"), &controllerSuffix); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, set) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, setDefaultController) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *value = NULL, value_sub, __$null, _0; - zval column; + zval *controllerName_param = NULL; + zval controllerName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&value_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&controllerName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(column) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(value) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(controllerName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &column_param, &value); - zephir_get_strval(&column, column_param); - if (!value) { - value = &value_sub; - ZEPHIR_CPY_WRT(value, &__$null); + zephir_fetch_params(1, 1, 0, &controllerName_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_SEPARATE_PARAM(value); + ZEPHIR_INIT_VAR(&controllerName); } - if (Z_TYPE_P(value) == IS_NULL) { - ZEPHIR_INIT_NVAR(value); - ZVAL_STRING(value, "NULL"); - } - zephir_update_property_array_multi(this_ptr, SL("store"), value, SL("sz"), 3, SL("COLUMNS"), &column); - zephir_read_property(&_0, this_ptr, ZEND_STRL("bind"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_0, "remove", NULL, 0, &column); - zephir_check_call_status(); - RETURN_THIS(); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultHandler"), &controllerName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Query_Update, buildColumns) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, handleException) { - zend_string *_5; - zend_ulong _4; - zval assignments; - zval column, value, _0, _1, *_2, _3, _11, _12, _6$$3, _8$$3, _9$$4, _10$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *exception, exception_sub, eventsManager, _0, _1$$3, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&value); + ZVAL_UNDEF(&exception_sub); + ZVAL_UNDEF(&eventsManager); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); - ZVAL_UNDEF(&assignments); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(exception, zend_ce_exception) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &exception); - ZEPHIR_INIT_VAR(&assignments); - array_init(&assignments); - zephir_read_property(&_0, this_ptr, ZEND_STRL("store"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_1, &_0, SL("COLUMNS"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Query/Update.zep", 175); - zephir_is_iterable(&_1, 0, "phalcon/DataMapper/Query/Update.zep", 179); - if (Z_TYPE_P(&_1) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_1), _4, _5, _2) - { - ZEPHIR_INIT_NVAR(&column); - if (_5 != NULL) { - ZVAL_STR_COPY(&column, _5); - } else { - ZVAL_LONG(&column, _4); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _2); - ZEPHIR_CALL_METHOD(&_6$$3, this_ptr, "quoteidentifier", &_7, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$3); - ZEPHIR_CONCAT_VSV(&_8$$3, &_6$$3, " = ", &value); - zephir_array_append(&assignments, &_8$$3, PH_SEPARATE, "phalcon/DataMapper/Query/Update.zep", 176); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "dispatch:beforeException"); + ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr, exception); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &_1, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &_1, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &_1, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "quoteidentifier", &_7, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$4); - ZEPHIR_CONCAT_VSV(&_10$$4, &_9$$4, " = ", &value); - zephir_array_append(&assignments, &_10$$4, PH_SEPARATE, "phalcon/DataMapper/Query/Update.zep", 176); - ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); - zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { + RETURN_MM_BOOL(0); } } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&column); - ZEPHIR_INIT_VAR(&_12); - ZVAL_STRING(&_12, ","); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "indent", NULL, 0, &assignments, &_12); - zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, " SET", &_11); - RETURN_MM(); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo, Connection, phalcon, datamapper_pdo_connection, phalcon_datamapper_pdo_connection_abstractconnection_ce, phalcon_datamapper_pdo_connection_method_entry, 0); - - zend_declare_property_null(phalcon_datamapper_pdo_connection_ce, SL("arguments"), ZEND_ACC_PROTECTED); - phalcon_datamapper_pdo_connection_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Connection; - - return SUCCESS; + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __construct) +static PHP_METHOD(Phalcon_Mvc_Dispatcher, throwDispatchException) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options, queries, available, _5; - zval *dsn_param = NULL, *username_param = NULL, *password_param = NULL, *options_param = NULL, *queries_param = NULL, *profiler = NULL, profiler_sub, __$true, __$null, parts, _0, _1$$3, _2$$3, _3$$3, _4$$4; - zval dsn, username, password; + zend_long exceptionCode, ZEPHIR_LAST_CALL_STATUS; + zval *message_param = NULL, *exceptionCode_param = NULL, container, response, exception, _0, _4, _5, _1$$3, _2$$3, _3$$3; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&dsn); - ZVAL_UNDEF(&username); - ZVAL_UNDEF(&password); - ZVAL_UNDEF(&profiler_sub); - ZVAL_BOOL(&__$true, 1); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&parts); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&response); + ZVAL_UNDEF(&exception); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&queries); - ZVAL_UNDEF(&available); - ZVAL_UNDEF(&_5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 6) - Z_PARAM_STR(dsn) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(message) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(username) - Z_PARAM_STR_OR_NULL(password) - Z_PARAM_ARRAY(options) - Z_PARAM_ARRAY(queries) - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) + Z_PARAM_LONG(exceptionCode) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 5, &dsn_param, &username_param, &password_param, &options_param, &queries_param, &profiler); - zephir_get_strval(&dsn, dsn_param); - if (!username_param) { - ZEPHIR_INIT_VAR(&username); - } else { - zephir_get_strval(&username, username_param); - } - if (!password_param) { - ZEPHIR_INIT_VAR(&password); - } else { - zephir_get_strval(&password, password_param); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); + zephir_fetch_params(1, 1, 1, &message_param, &exceptionCode_param); + if (UNEXPECTED(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be of the type string")); + RETURN_MM_NULL(); } - if (!queries_param) { - ZEPHIR_INIT_VAR(&queries); - array_init(&queries); + if (EXPECTED(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(&message, message_param); } else { - zephir_get_arrval(&queries, queries_param); + ZEPHIR_INIT_VAR(&message); } - if (!profiler) { - profiler = &profiler_sub; - ZEPHIR_CPY_WRT(profiler, &__$null); + if (!exceptionCode_param) { + exceptionCode = 0; } else { - ZEPHIR_SEPARATE_PARAM(profiler); + exceptionCode = zephir_get_intval(exceptionCode_param); } - ZEPHIR_INIT_VAR(&parts); - zephir_fast_explode_str(&parts, SL(":"), &dsn, LONG_MAX); - ZEPHIR_INIT_VAR(&available); - zephir_create_array(&available, 4, 0); - zephir_array_update_string(&available, SL("mysql"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&available, SL("pgsql"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&available, SL("sqlite"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&available, SL("mssql"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_fetch_long(&_0, &parts, 0, PH_READONLY, "phalcon/DataMapper/Pdo/Connection.zep", 65); - if (!(zephir_array_isset(&available, &_0))) { + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (Z_TYPE_P(&container) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, spl_ce_InvalidArgumentException); - zephir_array_fetch_long(&_2$$3, &parts, 0, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection.zep", 67); - ZEPHIR_INIT_VAR(&_3$$3); - ZEPHIR_CONCAT_SVS(&_3$$3, "Driver not supported [", &_2$$3, "]"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 195, &_3$$3); + object_init_ex(&_1$$3, phalcon_mvc_dispatcher_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "A dependency injection container is required to access the 'response' service"); + ZVAL_LONG(&_3$$3, 0); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_2$$3, &_3$$3); zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection.zep", 68); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Dispatcher.zep", 228); ZEPHIR_MM_RESTORE(); return; } - if (!(zephir_array_isset_long(&options, 3))) { - ZEPHIR_INIT_VAR(&_4$$4); - ZVAL_LONG(&_4$$4, 2); - zephir_array_update_long(&options, 3, &_4$$4, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - } ZEPHIR_INIT_VAR(&_5); - zephir_create_array(&_5, 5, 0); - zephir_array_fast_append(&_5, &dsn); - zephir_array_fast_append(&_5, &username); - zephir_array_fast_append(&_5, &password); - zephir_array_fast_append(&_5, &options); - zephir_array_fast_append(&_5, &queries); - zephir_update_property_zval(this_ptr, ZEND_STRL("arguments"), &_5); - if (Z_TYPE_P(profiler) == IS_NULL) { - ZEPHIR_INIT_NVAR(profiler); - object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); - ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 199); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); + ZVAL_STRING(&_5, "response"); + ZEPHIR_CALL_METHOD(&_4, &container, "getshared", NULL, 0, &_5); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_4); + ZVAL_LONG(&_0, 404); + ZEPHIR_INIT_NVAR(&_5); + ZVAL_STRING(&_5, "Not Found"); + ZEPHIR_CALL_METHOD(NULL, &response, "setstatuscode", NULL, 0, &_0, &_5); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&exception); + object_init_ex(&exception, phalcon_mvc_dispatcher_exception_ce); + ZVAL_LONG(&_0, exceptionCode); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 32, &message, &_0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "handleexception", NULL, 0, &exception); zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_4)) { + RETURN_MM_BOOL(0); + } + zephir_throw_exception_debug(&exception, "phalcon/Mvc/Dispatcher.zep", 250); ZEPHIR_MM_RESTORE(); + return; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, __debugInfo) -{ - zval _1, _2, _3, _4, _5; - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - zephir_create_array(return_value, 1, 0); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 5, 0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_2); - zephir_array_fetch_long(&_2, &_1, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 102); - zephir_array_fast_append(&_0, &_2); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "****"); - zephir_array_fast_append(&_0, &_3); - ZEPHIR_INIT_NVAR(&_3); - ZVAL_STRING(&_3, "****"); - zephir_array_fast_append(&_0, &_3); - zephir_read_property(&_4, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_NVAR(&_2); - zephir_array_fetch_long(&_2, &_4, 3, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 105); - zephir_array_fast_append(&_0, &_2); - zephir_read_property(&_5, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_NVAR(&_2); - zephir_array_fetch_long(&_2, &_5, 4, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 107); - zephir_array_fast_append(&_0, &_2); - zephir_array_update_string(return_value, SL("arguments"), &_0, PH_COPY | PH_SEPARATE); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, connect) -{ - zval dsn, options, password, query, queries, username, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3, *_9$$3, _10$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_11 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&dsn); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&password); - ZVAL_UNDEF(&query); - ZVAL_UNDEF(&queries); - ZVAL_UNDEF(&username); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_10$$3); - ZEPHIR_MM_GROW(); +ZEPHIR_INIT_CLASS(Phalcon_Mvc_DispatcherInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, DispatcherInterface, phalcon, mvc_dispatcherinterface, phalcon_mvc_dispatcherinterface_method_entry); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_is_true(&_0))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "connect"); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "start", NULL, 0, &_2$$3); - zephir_check_call_status(); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&dsn); - zephir_array_fetch_long(&dsn, &_3$$3, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 122); - zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&username); - zephir_array_fetch_long(&username, &_4$$3, 1, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 123); - zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&password); - zephir_array_fetch_long(&password, &_5$$3, 2, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 124); - zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&options); - zephir_array_fetch_long(&options, &_6$$3, 3, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 125); - zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&queries); - zephir_array_fetch_long(&queries, &_7$$3, 4, PH_NOISY, "phalcon/DataMapper/Pdo/Connection.zep", 126); - ZEPHIR_INIT_NVAR(&_2$$3); - object_init_ex(&_2$$3, php_pdo_get_dbh_ce()); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 0, &dsn, &username, &password, &options); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &_2$$3); - zephir_read_property(&_8$$3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_8$$3, "finish", NULL, 0); - zephir_check_call_status(); - zephir_is_iterable(&queries, 0, "phalcon/DataMapper/Pdo/Connection.zep", 136); - if (Z_TYPE_P(&queries) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&queries), _9$$3) - { - ZEPHIR_INIT_NVAR(&query); - ZVAL_COPY(&query, _9$$3); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "exec", &_11, 0, &query); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &queries, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_10$$3, &queries, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_10$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&query, &queries, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "exec", &_11, 0, &query); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &queries, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&query); - } - ZEPHIR_MM_RESTORE(); + zend_class_implements(phalcon_mvc_dispatcherinterface_ce, 1, phalcon_dispatcher_dispatcherinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection, disconnect) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$null, _0, _1, _2; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, getActiveController); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, getControllerName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, getLastController); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, setControllerSuffix); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, setControllerName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_DispatcherInterface, setDefaultController); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "disconnect"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &__$null); - zephir_read_property(&_2, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_2, "finish", NULL, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} -zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Connection(zend_class_entry *class_type) + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_EntityInterface) { - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, EntityInterface, phalcon, mvc_entityinterface, phalcon_mvc_entityinterface_method_entry); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("arguments"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("arguments"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } + return SUCCESS; } +ZEPHIR_DOC_METHOD(Phalcon_Mvc_EntityInterface, readAttribute); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_EntityInterface, writeAttribute); @@ -41012,2170 +41299,2123 @@ zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Connection(zend_class -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_ConnectionLocator) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro) { - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo, ConnectionLocator, phalcon, datamapper_pdo_connectionlocator, phalcon_datamapper_pdo_connectionlocator_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Micro, phalcon, mvc_micro, phalcon_di_injectable_ce, phalcon_mvc_micro_method_entry, 0); - zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("master"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("read"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("write"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_connectionlocator_ce, SL("instances"), ZEND_ACC_PRIVATE); - phalcon_datamapper_pdo_connectionlocator_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_ConnectionLocator; + zend_declare_property_null(phalcon_mvc_micro_ce, SL("activeHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("afterBindingHandlers"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("afterHandlers"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("beforeHandlers"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("container"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("errorHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("finishHandlers"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("handlers"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("modelBinder"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("notFoundHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("responseHandler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("returnedValue"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_ce, SL("router"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_micro_ce, SL("stopped"), 0, ZEND_ACC_PROTECTED); + phalcon_mvc_micro_ce->create_object = zephir_init_properties_Phalcon_Mvc_Micro; - zend_class_implements(phalcon_datamapper_pdo_connectionlocator_ce, 1, phalcon_datamapper_pdo_connectionlocatorinterface_ce); + zend_class_implements(phalcon_mvc_micro_ce, 1, zend_ce_arrayaccess); + zend_class_implements(phalcon_mvc_micro_ce, 1, phalcon_events_eventsawareinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, __construct) +static PHP_METHOD(Phalcon_Mvc_Micro, __construct) { - zend_string *_3, *_8; - zend_ulong _2, _7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval read, write; - zval *master, master_sub, *read_param = NULL, *write_param = NULL, name, callableObject, *_0, _1, *_5, _6; + zval *container = NULL, container_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&master_sub); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&callableObject); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&read); - ZVAL_UNDEF(&write); + ZVAL_UNDEF(&container_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_OBJECT_OF_CLASS(master, phalcon_datamapper_pdo_connection_connectioninterface_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(read) - Z_PARAM_ARRAY(write) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(container, phalcon_di_diinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &master, &read_param, &write_param); - if (!read_param) { - ZEPHIR_INIT_VAR(&read); - array_init(&read); - } else { - zephir_get_arrval(&read, read_param); - } - if (!write_param) { - ZEPHIR_INIT_VAR(&write); - array_init(&write); - } else { - zephir_get_arrval(&write, write_param); + zephir_fetch_params(1, 0, 1, &container); + if (!container) { + container = &container_sub; + container = &__$null; } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setmaster", NULL, 0, master); - zephir_check_call_status(); - zephir_is_iterable(&read, 0, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 74); - if (Z_TYPE_P(&read) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&read), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&name); - if (_3 != NULL) { - ZVAL_STR_COPY(&name, _3); - } else { - ZVAL_LONG(&name, _2); - } - ZEPHIR_INIT_NVAR(&callableObject); - ZVAL_COPY(&callableObject, _0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setread", &_4, 0, &name, &callableObject); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &read, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &read, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &read, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&callableObject, &read, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setread", &_4, 0, &name, &callableObject); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &read, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&callableObject); - ZEPHIR_INIT_NVAR(&name); - zephir_is_iterable(&write, 0, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 77); - if (Z_TYPE_P(&write) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&write), _7, _8, _5) - { - ZEPHIR_INIT_NVAR(&name); - if (_8 != NULL) { - ZVAL_STR_COPY(&name, _8); - } else { - ZVAL_LONG(&name, _7); - } - ZEPHIR_INIT_NVAR(&callableObject); - ZVAL_COPY(&callableObject, _5); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setwrite", &_9, 0, &name, &callableObject); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &write, "rewind", NULL, 0); + if (Z_TYPE_P(container) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setdi", NULL, 0, container); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_6, &write, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_6)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &write, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&callableObject, &write, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setwrite", &_9, 0, &name, &callableObject); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &write, "next", NULL, 0); - zephir_check_call_status(); - } } - ZEPHIR_INIT_NVAR(&callableObject); - ZEPHIR_INIT_NVAR(&name); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getMaster) +static PHP_METHOD(Phalcon_Mvc_Micro, after) +{ + zval *handler, handler_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&handler_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &handler); + + + zephir_update_property_array_append(this_ptr, SL("afterHandlers"), handler); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_Micro, afterBinding) { + zval *handler, handler_sub; zval *this_ptr = getThis(); + ZVAL_UNDEF(&handler_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &handler); - RETURN_MEMBER(getThis(), "master"); + zephir_update_property_array_append(this_ptr, SL("afterBindingHandlers"), handler); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getRead) +static PHP_METHOD(Phalcon_Mvc_Micro, before) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0; - zval name; + zval *handler, handler_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&handler_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &name_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); - ZVAL_STRING(&name, ""); - } else { - zephir_get_strval(&name, name_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &handler); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "read"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getconnection", NULL, 0, &_0, &name); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_array_append(this_ptr, SL("beforeHandlers"), handler); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getWrite) +static PHP_METHOD(Phalcon_Mvc_Micro, delete) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0; - zval name; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &name_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); - ZVAL_STRING(&name, ""); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - zephir_get_strval(&name, name_param); + ZEPHIR_INIT_VAR(&routePattern); } - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "write"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getconnection", NULL, 0, &_0, &name); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_CALL_METHOD(&route, &router, "adddelete", NULL, 0, &routePattern); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setMaster) +static PHP_METHOD(Phalcon_Mvc_Micro, error) { - zval *callableObject, callableObject_sub; + zval *handler, handler_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&callableObject_sub); + ZVAL_UNDEF(&handler_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(callableObject, phalcon_datamapper_pdo_connection_connectioninterface_ce) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &callableObject); + zephir_fetch_params_without_memory_grow(1, 0, &handler); - zephir_update_property_zval(this_ptr, ZEND_STRL("master"), callableObject); + zephir_update_property_zval(this_ptr, ZEND_STRL("errorHandler"), handler); RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setRead) +static PHP_METHOD(Phalcon_Mvc_Micro, finish) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *callableObject, callableObject_sub; - zval name; + zval *handler, handler_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&callableObject_sub); + ZVAL_UNDEF(&handler_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(callableObject) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &callableObject); - zephir_get_strval(&name, name_param); + zephir_fetch_params_without_memory_grow(1, 0, &handler); - zephir_update_property_array(this_ptr, SL("read"), &name, callableObject); - RETURN_THIS(); + zephir_update_property_array_append(this_ptr, SL("finishHandlers"), handler); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, setWrite) +static PHP_METHOD(Phalcon_Mvc_Micro, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *callableObject, callableObject_sub; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&callableObject_sub); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(callableObject) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &callableObject); - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); + } else { + ZEPHIR_INIT_VAR(&routePattern); + } - zephir_update_property_array(this_ptr, SL("write"), &name, callableObject); - RETURN_THIS(); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&route, &router, "addget", NULL, 0, &routePattern); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocator, getConnection) +static PHP_METHOD(Phalcon_Mvc_Micro, getActiveHandler) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "activeHandler"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro, getBoundModels) { + zval modelBinder, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, *name_param = NULL, collection, instanceName, instances, requested, _0, _1, _6, _2$$5, _3$$5, _4$$6, _5$$6; - zval type, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&collection); - ZVAL_UNDEF(&instanceName); - ZVAL_UNDEF(&instances); - ZVAL_UNDEF(&requested); + ZVAL_UNDEF(&modelBinder); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&_5$$6); + + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelBinder"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&modelBinder, &_0); + if (Z_TYPE_P(&modelBinder) == IS_NULL) { + array_init(return_value); + RETURN_MM(); + } + ZEPHIR_RETURN_CALL_METHOD(&modelBinder, "getboundmodels", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Micro, getEventsManager) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "eventsManager"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro, setEventsManager) +{ + zval *eventsManager, eventsManager_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&eventsManager_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(type) - Z_PARAM_OPTIONAL - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &type_param, &name_param); - zephir_get_strval(&type, type_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); - ZVAL_STRING(&name, ""); - } else { - zephir_get_strval(&name, name_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); - ZEPHIR_OBS_VAR(&collection); - zephir_read_property_zval(&collection, this_ptr, &type, PH_NOISY_CC); - ZEPHIR_CPY_WRT(&requested, &name); - zephir_read_property(&_0, this_ptr, ZEND_STRL("instances"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&instances, &_0); - if (ZEPHIR_IS_EMPTY(&collection)) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getmaster", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, ""); - if (ZEPHIR_IS_IDENTICAL(&_1, &requested)) { - ZEPHIR_CALL_FUNCTION(&requested, "array_rand", NULL, 200, &collection); - zephir_check_call_status(); - } - if (!(zephir_array_isset(&collection, &requested))) { - ZEPHIR_INIT_VAR(&_2$$5); - object_init_ex(&_2$$5, phalcon_datamapper_pdo_exception_connectionnotfound_ce); - ZEPHIR_INIT_VAR(&_3$$5); - ZEPHIR_CONCAT_SVSV(&_3$$5, "Connection not found: ", &type, ":", &requested); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 29, &_3$$5); - zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$5, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 206); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(&instanceName); - ZEPHIR_CONCAT_VSV(&instanceName, &type, "-", &requested); - if (!(zephir_array_isset(&instances, &instanceName))) { - ZEPHIR_INIT_VAR(&_4$$6); - zephir_array_fetch(&_5$$6, &collection, &requested, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 217); - ZEPHIR_CALL_USER_FUNC(&_4$$6, &_5$$6); - zephir_check_call_status(); - zephir_array_update_zval(&instances, &instanceName, &_4$$6, PH_COPY | PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("instances"), &instances); - } - zephir_array_fetch(&_6, &instances, &instanceName, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/ConnectionLocator.zep", 221); - RETURN_CTOR(&_6); -} - -zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_ConnectionLocator(zend_class_entry *class_type) -{ - zval _0, _2, _4, _1$$3, _3$$4, _5$$5; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$5); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("instances"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("instances"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("write"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("write"), &_3$$4); - } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("read"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_4) == IS_NULL) { - ZEPHIR_INIT_VAR(&_5$$5); - array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("read"), &_5$$5); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo, ConnectionLocatorInterface, phalcon, datamapper_pdo_connectionlocatorinterface, phalcon_datamapper_pdo_connectionlocatorinterface_method_entry); - - return SUCCESS; -} - -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getMaster); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getRead); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, getWrite); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setMaster); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setRead); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_ConnectionLocatorInterface, setWrite); - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_AbstractConnection) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Connection, AbstractConnection, phalcon, datamapper_pdo_connection_abstractconnection, phalcon_datamapper_pdo_connection_abstractconnection_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_datamapper_pdo_connection_abstractconnection_ce, SL("pdo"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_connection_abstractconnection_ce, SL("profiler"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_datamapper_pdo_connection_abstractconnection_ce, 1, phalcon_datamapper_pdo_connection_connectioninterface_ce); - return SUCCESS; -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, __call) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval arguments, _2; - zval *name, name_sub, *arguments_param = NULL, className, message, _0, _3, _1$$3; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name_sub); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_ZVAL(name) - Z_PARAM_ARRAY(arguments) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name, &arguments_param); - zephir_get_arrval(&arguments, arguments_param); - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - if (!((zephir_method_exists(&_0, name) == SUCCESS))) { - ZEPHIR_INIT_VAR(&className); - zephir_get_class(&className, this_ptr, 0); - ZEPHIR_INIT_VAR(&message); - ZEPHIR_CONCAT_SVSVS(&message, "Class '", &className, "' does not have a method '", name, "'"); - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, spl_ce_BadMethodCallException); - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 72, &message); - zephir_check_call_status(); - zephir_throw_exception_debug(&_1$$3, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 59); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(&_2); - zephir_create_array(&_2, 2, 0); - ZEPHIR_OBS_VAR(&_3); - zephir_read_property(&_3, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); - zephir_array_fast_append(&_2, &_3); - zephir_array_fast_append(&_2, name); - ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_2, &arguments); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, beginTransaction) -{ - zval result, _0, _1, _2, _3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "beginTransaction"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &_2, "begintransaction", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); - zephir_check_call_status(); - RETURN_CCTOR(&result); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, commit) -{ - zval result, _0, _1, _2, _3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "commit"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &_2, "commit", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); - zephir_check_call_status(); - RETURN_CCTOR(&result); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, connect) -{ -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, disconnect) -{ -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, errorCode) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "errorcode", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, errorInfo) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "errorinfo", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, exec) +static PHP_METHOD(Phalcon_Mvc_Micro, getHandlers) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, affectedRows, _0, _1, _2, _3; - zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&affectedRows); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(statement) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - zephir_get_strval(&statement, statement_param); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "exec"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&affectedRows, &_2, "exec", NULL, 0, &statement); - zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0, &statement); - zephir_check_call_status(); - RETURN_CCTOR(&affectedRows); + RETURN_MEMBER(getThis(), "handlers"); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAffected) +static PHP_METHOD(Phalcon_Mvc_Micro, getModelBinder) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *statement_param = NULL, *values_param = NULL, sth; - zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&values); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&sth, "rowcount", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "modelBinder"); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAll) +static PHP_METHOD(Phalcon_Mvc_Micro, getReturnedValue) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values, _0; - zval *statement_param = NULL, *values_param = NULL, _1; - zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, 2); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "fetchAll"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "returnedValue"); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchAssoc) +static PHP_METHOD(Phalcon_Mvc_Micro, getRouter) { + zval _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_2 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *statement_param = NULL, *values_param = NULL, data, row, sth, _0, _1$$3, _3$$3; - zval statement; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&row); - ZVAL_UNDEF(&sth); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&values); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - - ZEPHIR_INIT_VAR(&data); - array_init(&data); - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); - zephir_check_call_status(); - ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_METHOD(&row, &sth, "fetch", NULL, 0, &_0); - zephir_check_call_status(); - while (1) { - if (!(zephir_is_true(&row))) { - break; - } - ZEPHIR_CALL_FUNCTION(&_1$$3, "current", &_2, 4, &row); + zephir_read_property(&_0, this_ptr, ZEND_STRL("router"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "router"); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "getsharedservice", NULL, 0, &_2$$3); zephir_check_call_status(); - zephir_array_update_zval(&data, &_1$$3, &row, PH_COPY | PH_SEPARATE); - ZVAL_LONG(&_3$$3, 2); - ZEPHIR_CALL_METHOD(&row, &sth, "fetch", NULL, 0, &_3$$3); + zephir_update_property_zval(this_ptr, ZEND_STRL("router"), &_1$$3); + zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("router"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "clear", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("router"), PH_NOISY_CC | PH_READONLY); + ZVAL_BOOL(&_5$$3, 1); + ZEPHIR_CALL_METHOD(NULL, &_4$$3, "removeextraslashes", NULL, 0, &_5$$3); zephir_check_call_status(); } - RETURN_CCTOR(&data); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchColumn) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long column, ZEPHIR_LAST_CALL_STATUS; - zval values, _0; - zval *statement_param = NULL, *values_param = NULL, *column_param = NULL, _1; - zval statement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - Z_PARAM_LONG(column) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &statement_param, &values_param, &column_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - if (!column_param) { - column = 0; - } else { - column = zephir_get_intval(column_param); - } - - - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, 7); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_LONG(&_1, column); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "fetchAll"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MM_MEMBER(getThis(), "router"); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchGroup) +static PHP_METHOD(Phalcon_Mvc_Micro, getService) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long flags, ZEPHIR_LAST_CALL_STATUS; - zval values, _0; - zval *statement_param = NULL, *values_param = NULL, *flags_param = NULL, _1; - zval statement; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *serviceName_param = NULL, _0, _2, _1$$3; + zval serviceName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&serviceName); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - Z_PARAM_LONG(flags) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(serviceName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &statement_param, &values_param, &flags_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); + zephir_fetch_params(1, 1, 0, &serviceName_param); + if (UNEXPECTED(Z_TYPE_P(serviceName_param) != IS_STRING && Z_TYPE_P(serviceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'serviceName' must be of the type string")); + RETURN_MM_NULL(); } - if (!flags_param) { - flags = 2; + if (EXPECTED(Z_TYPE_P(serviceName_param) == IS_STRING)) { + zephir_get_strval(&serviceName, serviceName_param); } else { - flags = zephir_get_intval(flags_param); + ZEPHIR_INIT_VAR(&serviceName); } - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, (65536 | flags)); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "fetchAll"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchObject) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values, arguments; - zval *statement_param = NULL, *values_param = NULL, *className_param = NULL, *arguments_param = NULL, sth; - zval statement, className; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&arguments); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - Z_PARAM_STR(className) - Z_PARAM_ARRAY(arguments) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &statement_param, &values_param, &className_param, &arguments_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - if (!className_param) { - ZEPHIR_INIT_VAR(&className); - ZVAL_STRING(&className, "stdClass"); - } else { - zephir_get_strval(&className, className_param); - } - if (!arguments_param) { - ZEPHIR_INIT_VAR(&arguments); - array_init(&arguments); - } else { - zephir_get_arrval(&arguments, arguments_param); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } - - - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchobject", NULL, 0, &className, &arguments); + zephir_read_property(&_2, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_2, "get", NULL, 0, &serviceName); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchObjects) +static PHP_METHOD(Phalcon_Mvc_Micro, getSharedService) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval values, arguments; - zval *statement_param = NULL, *values_param = NULL, *className_param = NULL, *arguments_param = NULL, sth, _0; - zval statement, className; + zval *serviceName_param = NULL, _0, _2, _1$$3; + zval serviceName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&sth); + ZVAL_UNDEF(&serviceName); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - Z_PARAM_STR(className) - Z_PARAM_ARRAY(arguments) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(serviceName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &statement_param, &values_param, &className_param, &arguments_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } - if (!className_param) { - ZEPHIR_INIT_VAR(&className); - ZVAL_STRING(&className, "stdClass"); - } else { - zephir_get_strval(&className, className_param); + zephir_fetch_params(1, 1, 0, &serviceName_param); + if (UNEXPECTED(Z_TYPE_P(serviceName_param) != IS_STRING && Z_TYPE_P(serviceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'serviceName' must be of the type string")); + RETURN_MM_NULL(); } - if (!arguments_param) { - ZEPHIR_INIT_VAR(&arguments); - array_init(&arguments); + if (EXPECTED(Z_TYPE_P(serviceName_param) == IS_STRING)) { + zephir_get_strval(&serviceName, serviceName_param); } else { - zephir_get_arrval(&arguments, arguments_param); + ZEPHIR_INIT_VAR(&serviceName); } - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); - zephir_check_call_status(); - ZVAL_LONG(&_0, 8); - ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchall", NULL, 0, &_0, &className, &arguments); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchOne) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values, _0; - zval *statement_param = NULL, *values_param = NULL, _1; - zval statement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } - - - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, 2); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "fetch"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); + zephir_read_property(&_2, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_2, "getshared", NULL, 0, &serviceName); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchPairs) +static PHP_METHOD(Phalcon_Mvc_Micro, handle) { + zval _81$$59, _86$$64, _95$$69; + zend_class_entry *_28$$21; + zend_bool _26$$7, _37$$7, _18$$11, _22$$16, _33$$25, _44$$31, _48$$36, _57$$42, _61$$47, _78$$57, _83$$62, _100$$79, _101$$79; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval values, _0; - zval *statement_param = NULL, *values_param = NULL, _1; - zval statement; + zval *uri_param = NULL, __$true, __$false, container, status, router, matchedRoute, handler, beforeHandlers, params, returnedValue, e, afterHandlers, notFoundHandler, finishHandlers, finish, before, after, response, modelBinder, routeName, realHandler, methodName, lazyReturned, afterBindingHandlers, afterBinding, _0, _88, _1$$4, _5$$4, _6$$4, _72$$4, _75$$4, *_76$$4, _77$$4, _2$$5, _3$$5, _4$$5, _7$$7, _8$$7, _11$$7, _15$$7, *_16$$7, _17$$7, _41$$7, *_42$$7, _43$$7, _54$$7, *_55$$7, _56$$7, _9$$8, _10$$8, _12$$9, _13$$9, _14$$9, _21$$11, _19$$14, _20$$14, _25$$16, _23$$19, _24$$19, _27$$21, _29$$23, _30$$24, _31$$24, _32$$22, _34$$26, _35$$26, _36$$26, _38$$29, _39$$29, _40$$29, _47$$31, _45$$34, _46$$34, _51$$36, _49$$39, _50$$39, _52$$41, _53$$41, _60$$42, _58$$45, _59$$45, _64$$47, _62$$50, _63$$50, _65$$52, _69$$52, _66$$53, _67$$53, _68$$53, _70$$55, _71$$55, _73$$56, _74$$56, _82$$57, _79$$60, _80$$60, _87$$62, _84$$65, _85$$65, _89$$67, _92$$67, _90$$68, _91$$68, _93$$69, _94$$69, _96$$77, _97$$77, _98$$80, _99$$80, _102$$79; + zval uri, bindCacheKey; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&uri); + ZVAL_UNDEF(&bindCacheKey); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&status); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&matchedRoute); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&beforeHandlers); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&returnedValue); + ZVAL_UNDEF(&e); + ZVAL_UNDEF(&afterHandlers); + ZVAL_UNDEF(¬FoundHandler); + ZVAL_UNDEF(&finishHandlers); + ZVAL_UNDEF(&finish); + ZVAL_UNDEF(&before); + ZVAL_UNDEF(&after); + ZVAL_UNDEF(&response); + ZVAL_UNDEF(&modelBinder); + ZVAL_UNDEF(&routeName); + ZVAL_UNDEF(&realHandler); + ZVAL_UNDEF(&methodName); + ZVAL_UNDEF(&lazyReturned); + ZVAL_UNDEF(&afterBindingHandlers); + ZVAL_UNDEF(&afterBinding); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_88); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_72$$4); + ZVAL_UNDEF(&_75$$4); + ZVAL_UNDEF(&_77$$4); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_15$$7); + ZVAL_UNDEF(&_17$$7); + ZVAL_UNDEF(&_41$$7); + ZVAL_UNDEF(&_43$$7); + ZVAL_UNDEF(&_54$$7); + ZVAL_UNDEF(&_56$$7); + ZVAL_UNDEF(&_9$$8); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_12$$9); + ZVAL_UNDEF(&_13$$9); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_21$$11); + ZVAL_UNDEF(&_19$$14); + ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_25$$16); + ZVAL_UNDEF(&_23$$19); + ZVAL_UNDEF(&_24$$19); + ZVAL_UNDEF(&_27$$21); + ZVAL_UNDEF(&_29$$23); + ZVAL_UNDEF(&_30$$24); + ZVAL_UNDEF(&_31$$24); + ZVAL_UNDEF(&_32$$22); + ZVAL_UNDEF(&_34$$26); + ZVAL_UNDEF(&_35$$26); + ZVAL_UNDEF(&_36$$26); + ZVAL_UNDEF(&_38$$29); + ZVAL_UNDEF(&_39$$29); + ZVAL_UNDEF(&_40$$29); + ZVAL_UNDEF(&_47$$31); + ZVAL_UNDEF(&_45$$34); + ZVAL_UNDEF(&_46$$34); + ZVAL_UNDEF(&_51$$36); + ZVAL_UNDEF(&_49$$39); + ZVAL_UNDEF(&_50$$39); + ZVAL_UNDEF(&_52$$41); + ZVAL_UNDEF(&_53$$41); + ZVAL_UNDEF(&_60$$42); + ZVAL_UNDEF(&_58$$45); + ZVAL_UNDEF(&_59$$45); + ZVAL_UNDEF(&_64$$47); + ZVAL_UNDEF(&_62$$50); + ZVAL_UNDEF(&_63$$50); + ZVAL_UNDEF(&_65$$52); + ZVAL_UNDEF(&_69$$52); + ZVAL_UNDEF(&_66$$53); + ZVAL_UNDEF(&_67$$53); + ZVAL_UNDEF(&_68$$53); + ZVAL_UNDEF(&_70$$55); + ZVAL_UNDEF(&_71$$55); + ZVAL_UNDEF(&_73$$56); + ZVAL_UNDEF(&_74$$56); + ZVAL_UNDEF(&_82$$57); + ZVAL_UNDEF(&_79$$60); + ZVAL_UNDEF(&_80$$60); + ZVAL_UNDEF(&_87$$62); + ZVAL_UNDEF(&_84$$65); + ZVAL_UNDEF(&_85$$65); + ZVAL_UNDEF(&_89$$67); + ZVAL_UNDEF(&_92$$67); + ZVAL_UNDEF(&_90$$68); + ZVAL_UNDEF(&_91$$68); + ZVAL_UNDEF(&_93$$69); + ZVAL_UNDEF(&_94$$69); + ZVAL_UNDEF(&_96$$77); + ZVAL_UNDEF(&_97$$77); + ZVAL_UNDEF(&_98$$80); + ZVAL_UNDEF(&_99$$80); + ZVAL_UNDEF(&_102$$79); + ZVAL_UNDEF(&_81$$59); + ZVAL_UNDEF(&_86$$64); + ZVAL_UNDEF(&_95$$69); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(uri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); + zephir_fetch_params(1, 1, 0, &uri_param); + if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be of the type string")); + RETURN_MM_NULL(); } - - - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_1, 12); - zephir_array_fast_append(&_0, &_1); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "fetchAll"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "fetchdata", NULL, 0, &_1, &_0, &statement, &values); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchValue) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *statement_param = NULL, *values_param = NULL, sth, _0; - zval statement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&values); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); + if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(&uri, uri_param); } else { - zephir_get_arrval(&values, values_param); + ZEPHIR_INIT_VAR(&uri); } - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); - zephir_check_call_status(); - ZVAL_LONG(&_0, 0); - ZEPHIR_RETURN_CALL_METHOD(&sth, "fetchcolumn", NULL, 0, &_0); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAdapter) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + ZEPHIR_INIT_VAR(&status); + ZVAL_NULL(&status); + ZEPHIR_INIT_VAR(&realHandler); + ZVAL_NULL(&realHandler); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "A dependency injection container is required to access micro services", "phalcon/Mvc/Micro.zep", 398); + return; + } + /* try_start_1: */ + ZEPHIR_INIT_VAR(&returnedValue); + ZVAL_NULL(&returnedValue); + zephir_read_property(&_1$$4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_1$$4) != IS_NULL) { + zephir_read_property(&_2$$5, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_4$$5); + ZVAL_STRING(&_4$$5, "micro:beforeHandleRoute"); + ZEPHIR_CALL_METHOD(&_3$$5, &_2$$5, "fire", NULL, 0, &_4$$5, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_3$$5)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_INIT_VAR(&_6$$4); + ZVAL_STRING(&_6$$4, "router"); + ZEPHIR_CALL_METHOD(&_5$$4, &container, "getshared", NULL, 0, &_6$$4); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_CPY_WRT(&router, &_5$$4); + ZEPHIR_CALL_METHOD(NULL, &router, "handle", NULL, 0, &uri); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_CALL_METHOD(&matchedRoute, &router, "getmatchedroute", NULL, 0); + zephir_check_call_status_or_jump(try_end_1); + if (Z_TYPE_P(&matchedRoute) != IS_NULL) { + ZEPHIR_OBS_VAR(&handler); + zephir_read_property(&_7$$7, this_ptr, ZEND_STRL("handlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&_8$$7, &matchedRoute, "getrouteid", NULL, 0); + zephir_check_call_status_or_jump(try_end_1); + if (UNEXPECTED(!(zephir_array_isset_fetch(&handler, &_7$$7, &_8$$7, 0)))) { + ZEPHIR_INIT_VAR(&_9$$8); + object_init_ex(&_9$$8, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_VAR(&_10$$8); + ZVAL_STRING(&_10$$8, "Matched route doesn't have an associated handler"); + ZEPHIR_CALL_METHOD(NULL, &_9$$8, "__construct", NULL, 32, &_10$$8); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_9$$8, "phalcon/Mvc/Micro.zep", 432); + goto try_end_1; - ZEPHIR_MM_GROW(); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("activeHandler"), &handler); + zephir_read_property(&_11$$7, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_11$$7) != IS_NULL) { + zephir_read_property(&_12$$9, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_14$$9); + ZVAL_STRING(&_14$$9, "micro:beforeExecuteRoute"); + ZEPHIR_CALL_METHOD(&_13$$9, &_12$$9, "fire", NULL, 0, &_14$$9, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_13$$9)) { + RETURN_MM_BOOL(0); + } + ZEPHIR_OBS_NVAR(&handler); + zephir_read_property(&handler, this_ptr, ZEND_STRL("activeHandler"), PH_NOISY_CC); + } + zephir_read_property(&_15$$7, this_ptr, ZEND_STRL("beforeHandlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&beforeHandlers, &_15$$7); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$false); + } + zephir_is_iterable(&beforeHandlers, 0, "phalcon/Mvc/Micro.zep", 484); + if (Z_TYPE_P(&beforeHandlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&beforeHandlers), _16$$7) + { + ZEPHIR_INIT_NVAR(&before); + ZVAL_COPY(&before, _16$$7); + _18$$11 = Z_TYPE_P(&before) == IS_OBJECT; + if (_18$$11) { + _18$$11 = zephir_instance_of_ev(&before, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_18$$11) { + ZEPHIR_CALL_METHOD(&status, &before, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&before)))) { + ZEPHIR_INIT_NVAR(&_19$$14); + object_init_ex(&_19$$14, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$14); + ZVAL_STRING(&_20$$14, "'before' handler is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_19$$14, "__construct", NULL, 32, &_20$$14); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_19$$14, "phalcon/Mvc/Micro.zep", 467); + goto try_end_1; - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - RETURN_MM_MEMBER(getThis(), "pdo"); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAttribute) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *attribute_param = NULL, _0, _1; - zend_long attribute, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &before); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_21$$11, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_21$$11)) { + RETURN_CCTOR(&status); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &beforeHandlers, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_17$$7, &beforeHandlers, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_17$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&before, &beforeHandlers, "current", NULL, 0); + zephir_check_call_status(); + _22$$16 = Z_TYPE_P(&before) == IS_OBJECT; + if (_22$$16) { + _22$$16 = zephir_instance_of_ev(&before, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_22$$16) { + ZEPHIR_CALL_METHOD(&status, &before, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&before)))) { + ZEPHIR_INIT_NVAR(&_23$$19); + object_init_ex(&_23$$19, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_24$$19); + ZVAL_STRING(&_24$$19, "'before' handler is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_23$$19, "__construct", NULL, 32, &_24$$19); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_23$$19, "phalcon/Mvc/Micro.zep", 467); + goto try_end_1; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(attribute) - ZEND_PARSE_PARAMETERS_END(); -#endif + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &before); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_25$$16, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_25$$16)) { + RETURN_CCTOR(&status); + } + ZEPHIR_CALL_METHOD(NULL, &beforeHandlers, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&before); + ZEPHIR_CALL_METHOD(¶ms, &router, "getparams", NULL, 0); + zephir_check_call_status_or_jump(try_end_1); + zephir_read_property(&_15$$7, this_ptr, ZEND_STRL("modelBinder"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&modelBinder, &_15$$7); + _26$$7 = Z_TYPE_P(&handler) == IS_OBJECT; + if (_26$$7) { + _26$$7 = zephir_is_instance_of(&handler, SL("Closure")); + } + if (_26$$7) { + _28$$21 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_CALL_CE_STATIC(&_27$$21, _28$$21, "bind", NULL, 0, &handler, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_CPY_WRT(&handler, &_27$$21); + if (Z_TYPE_P(&modelBinder) != IS_NULL) { + ZEPHIR_CALL_METHOD(&routeName, &matchedRoute, "getname", NULL, 0); + zephir_check_call_status_or_jump(try_end_1); + if (Z_TYPE_P(&routeName) != IS_NULL) { + ZEPHIR_INIT_VAR(&_29$$23); + ZEPHIR_CONCAT_SV(&_29$$23, "_PHMB_", &routeName); + zephir_get_strval(&bindCacheKey, &_29$$23); + } else { + ZEPHIR_CALL_METHOD(&_30$$24, &matchedRoute, "getpattern", NULL, 0); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_INIT_VAR(&_31$$24); + ZEPHIR_CONCAT_SV(&_31$$24, "_PHMB_", &_30$$24); + zephir_get_strval(&bindCacheKey, &_31$$24); + } + ZEPHIR_CALL_METHOD(&_32$$22, &modelBinder, "bindtohandler", NULL, 0, &handler, ¶ms, &bindCacheKey); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_CPY_WRT(¶ms, &_32$$22); + } + } + if (Z_TYPE_P(&handler) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&realHandler); + zephir_array_fetch_long(&realHandler, &handler, 0, PH_NOISY, "phalcon/Mvc/Micro.zep", 515); + _33$$25 = zephir_instance_of_ev(&realHandler, phalcon_mvc_controller_ce); + if (_33$$25) { + _33$$25 = Z_TYPE_P(&modelBinder) != IS_NULL; + } + if (_33$$25) { + ZEPHIR_OBS_VAR(&methodName); + zephir_array_fetch_long(&methodName, &handler, 1, PH_NOISY, "phalcon/Mvc/Micro.zep", 518); + ZEPHIR_INIT_VAR(&_34$$26); + zephir_get_class(&_34$$26, &realHandler, 0); + ZEPHIR_INIT_VAR(&_35$$26); + ZEPHIR_CONCAT_SVSV(&_35$$26, "_PHMB_", &_34$$26, "_", &methodName); + zephir_get_strval(&bindCacheKey, &_35$$26); + ZEPHIR_CALL_METHOD(&_36$$26, &modelBinder, "bindtohandler", NULL, 0, &realHandler, ¶ms, &bindCacheKey, &methodName); + zephir_check_call_status_or_jump(try_end_1); + ZEPHIR_CPY_WRT(¶ms, &_36$$26); + } + } + _37$$7 = Z_TYPE_P(&realHandler) != IS_NULL; + if (_37$$7) { + _37$$7 = zephir_instance_of_ev(&realHandler, phalcon_mvc_micro_lazyloader_ce); + } + if (_37$$7) { + ZEPHIR_OBS_NVAR(&methodName); + zephir_array_fetch_long(&methodName, &handler, 1, PH_NOISY, "phalcon/Mvc/Micro.zep", 535); + ZEPHIR_CALL_METHOD(&lazyReturned, &realHandler, "callmethod", NULL, 0, &methodName, ¶ms, &modelBinder); + zephir_check_call_status_or_jump(try_end_1); + } else { + ZEPHIR_INIT_NVAR(&lazyReturned); + ZEPHIR_CALL_USER_FUNC_ARRAY(&lazyReturned, &handler, ¶ms); + zephir_check_call_status_or_jump(try_end_1); + } + ZEPHIR_CPY_WRT(&returnedValue, &lazyReturned); + zephir_read_property(&_15$$7, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_15$$7) != IS_NULL) { + zephir_read_property(&_38$$29, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_40$$29); + ZVAL_STRING(&_40$$29, "micro:afterBinding"); + ZEPHIR_CALL_METHOD(&_39$$29, &_38$$29, "fire", NULL, 0, &_40$$29, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_39$$29)) { + RETURN_MM_BOOL(0); + } + } + zephir_read_property(&_41$$7, this_ptr, ZEND_STRL("afterBindingHandlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&afterBindingHandlers, &_41$$7); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$false); + } + zephir_is_iterable(&afterBindingHandlers, 0, "phalcon/Mvc/Micro.zep", 598); + if (Z_TYPE_P(&afterBindingHandlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&afterBindingHandlers), _42$$7) + { + ZEPHIR_INIT_NVAR(&afterBinding); + ZVAL_COPY(&afterBinding, _42$$7); + _44$$31 = Z_TYPE_P(&afterBinding) == IS_OBJECT; + if (_44$$31) { + _44$$31 = zephir_instance_of_ev(&afterBinding, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_44$$31) { + ZEPHIR_CALL_METHOD(&status, &afterBinding, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&afterBinding)))) { + ZEPHIR_INIT_NVAR(&_45$$34); + object_init_ex(&_45$$34, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_46$$34); + ZVAL_STRING(&_46$$34, "'afterBinding' handler is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_45$$34, "__construct", NULL, 32, &_46$$34); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_45$$34, "phalcon/Mvc/Micro.zep", 578); + goto try_end_1; + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &afterBinding); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_47$$31, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_47$$31)) { + RETURN_CCTOR(&status); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &afterBindingHandlers, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_43$$7, &afterBindingHandlers, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_43$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&afterBinding, &afterBindingHandlers, "current", NULL, 0); + zephir_check_call_status(); + _48$$36 = Z_TYPE_P(&afterBinding) == IS_OBJECT; + if (_48$$36) { + _48$$36 = zephir_instance_of_ev(&afterBinding, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_48$$36) { + ZEPHIR_CALL_METHOD(&status, &afterBinding, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&afterBinding)))) { + ZEPHIR_INIT_NVAR(&_49$$39); + object_init_ex(&_49$$39, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_50$$39); + ZVAL_STRING(&_50$$39, "'afterBinding' handler is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_49$$39, "__construct", NULL, 32, &_50$$39); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_49$$39, "phalcon/Mvc/Micro.zep", 578); + goto try_end_1; - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &attribute_param); - attribute = zephir_get_intval(attribute_param); + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &afterBinding); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_51$$36, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_51$$36)) { + RETURN_CCTOR(&status); + } + ZEPHIR_CALL_METHOD(NULL, &afterBindingHandlers, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&afterBinding); + zephir_update_property_zval(this_ptr, ZEND_STRL("returnedValue"), &returnedValue); + zephir_read_property(&_41$$7, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_41$$7) != IS_NULL) { + zephir_read_property(&_52$$41, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_53$$41); + ZVAL_STRING(&_53$$41, "micro:afterExecuteRoute"); + ZEPHIR_CALL_METHOD(NULL, &_52$$41, "fire", NULL, 0, &_53$$41, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_54$$7, this_ptr, ZEND_STRL("afterHandlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&afterHandlers, &_54$$7); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$false); + } + zephir_is_iterable(&afterHandlers, 0, "phalcon/Mvc/Micro.zep", 637); + if (Z_TYPE_P(&afterHandlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&afterHandlers), _55$$7) + { + ZEPHIR_INIT_NVAR(&after); + ZVAL_COPY(&after, _55$$7); + _57$$42 = Z_TYPE_P(&after) == IS_OBJECT; + if (_57$$42) { + _57$$42 = zephir_instance_of_ev(&after, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_57$$42) { + ZEPHIR_CALL_METHOD(&status, &after, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&after)))) { + ZEPHIR_INIT_NVAR(&_58$$45); + object_init_ex(&_58$$45, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_59$$45); + ZVAL_STRING(&_59$$45, "One of the 'after' handlers is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_58$$45, "__construct", NULL, 32, &_59$$45); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_58$$45, "phalcon/Mvc/Micro.zep", 624); + goto try_end_1; + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &after); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_60$$42, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_60$$42)) { + break; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &afterHandlers, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_56$$7, &afterHandlers, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_56$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&after, &afterHandlers, "current", NULL, 0); + zephir_check_call_status(); + _61$$47 = Z_TYPE_P(&after) == IS_OBJECT; + if (_61$$47) { + _61$$47 = zephir_instance_of_ev(&after, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_61$$47) { + ZEPHIR_CALL_METHOD(&status, &after, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&after)))) { + ZEPHIR_INIT_NVAR(&_62$$50); + object_init_ex(&_62$$50, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_63$$50); + ZVAL_STRING(&_63$$50, "One of the 'after' handlers is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_62$$50, "__construct", NULL, 32, &_63$$50); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_62$$50, "phalcon/Mvc/Micro.zep", 624); + goto try_end_1; - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, attribute); - ZEPHIR_RETURN_CALL_METHOD(&_0, "getattribute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} + } + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC(&status, &after); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_64$$47, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_64$$47)) { + break; + } + ZEPHIR_CALL_METHOD(NULL, &afterHandlers, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&after); + } else { + zephir_read_property(&_65$$52, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_65$$52) != IS_NULL) { + zephir_read_property(&_66$$53, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_68$$53); + ZVAL_STRING(&_68$$53, "micro:beforeNotFound"); + ZEPHIR_CALL_METHOD(&_67$$53, &_66$$53, "fire", NULL, 0, &_68$$53, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_67$$53)) { + RETURN_MM_BOOL(0); + } + } + zephir_read_property(&_69$$52, this_ptr, ZEND_STRL("notFoundHandler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(¬FoundHandler, &_69$$52); + if (UNEXPECTED(!(zephir_is_callable(¬FoundHandler)))) { + ZEPHIR_INIT_VAR(&_70$$55); + object_init_ex(&_70$$55, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_VAR(&_71$$55); + ZVAL_STRING(&_71$$55, "Not-Found handler is not callable or is not defined"); + ZEPHIR_CALL_METHOD(NULL, &_70$$55, "__construct", NULL, 32, &_71$$55); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_70$$55, "phalcon/Mvc/Micro.zep", 655); + goto try_end_1; -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getAvailableDrivers) -{ - zend_class_entry *_0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + } + ZEPHIR_INIT_NVAR(&returnedValue); + ZEPHIR_CALL_USER_FUNC(&returnedValue, ¬FoundHandler); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_72$$4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_72$$4) != IS_NULL) { + zephir_read_property(&_73$$56, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_74$$56); + ZVAL_STRING(&_74$$56, "micro:afterHandleRoute"); + ZEPHIR_CALL_METHOD(NULL, &_73$$56, "fire", NULL, 0, &_74$$56, this_ptr, &returnedValue); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_75$$4, this_ptr, ZEND_STRL("finishHandlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&finishHandlers, &_75$$4); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$false); + } + zephir_is_iterable(&finishHandlers, 0, "phalcon/Mvc/Micro.zep", 709); + if (Z_TYPE_P(&finishHandlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&finishHandlers), _76$$4) + { + ZEPHIR_INIT_NVAR(&finish); + ZVAL_COPY(&finish, _76$$4); + _78$$57 = Z_TYPE_P(&finish) == IS_OBJECT; + if (_78$$57) { + _78$$57 = zephir_instance_of_ev(&finish, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_78$$57) { + ZEPHIR_CALL_METHOD(&status, &finish, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&finish)))) { + ZEPHIR_INIT_NVAR(&_79$$60); + object_init_ex(&_79$$60, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_80$$60); + ZVAL_STRING(&_80$$60, "One of the 'finish' handlers is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_79$$60, "__construct", NULL, 32, &_80$$60); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_79$$60, "phalcon/Mvc/Micro.zep", 690); + goto try_end_1; + } + ZEPHIR_INIT_NVAR(&_81$$59); + zephir_create_array(&_81$$59, 1, 0); + zephir_array_fast_append(&_81$$59, this_ptr); + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC_ARRAY(&status, &finish, &_81$$59); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_82$$57, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_82$$57)) { + break; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &finishHandlers, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_77$$4, &finishHandlers, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_77$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&finish, &finishHandlers, "current", NULL, 0); + zephir_check_call_status(); + _83$$62 = Z_TYPE_P(&finish) == IS_OBJECT; + if (_83$$62) { + _83$$62 = zephir_instance_of_ev(&finish, phalcon_mvc_micro_middlewareinterface_ce); + } + if (_83$$62) { + ZEPHIR_CALL_METHOD(&status, &finish, "call", NULL, 0, this_ptr); + zephir_check_call_status_or_jump(try_end_1); + } else { + if (UNEXPECTED(!(zephir_is_callable(&finish)))) { + ZEPHIR_INIT_NVAR(&_84$$65); + object_init_ex(&_84$$65, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_NVAR(&_85$$65); + ZVAL_STRING(&_85$$65, "One of the 'finish' handlers is not callable"); + ZEPHIR_CALL_METHOD(NULL, &_84$$65, "__construct", NULL, 32, &_85$$65); + zephir_check_call_status_or_jump(try_end_1); + zephir_throw_exception_debug(&_84$$65, "phalcon/Mvc/Micro.zep", 690); + goto try_end_1; + } + ZEPHIR_INIT_NVAR(&_86$$64); + zephir_create_array(&_86$$64, 1, 0); + zephir_array_fast_append(&_86$$64, this_ptr); + ZEPHIR_INIT_NVAR(&status); + ZEPHIR_CALL_USER_FUNC_ARRAY(&status, &finish, &_86$$64); + zephir_check_call_status_or_jump(try_end_1); + } + zephir_read_property(&_87$$62, this_ptr, ZEND_STRL("stopped"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_87$$62)) { + break; + } + ZEPHIR_CALL_METHOD(NULL, &finishHandlers, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&finish); - ZEPHIR_MM_GROW(); + try_end_1: - _0 = zephir_fetch_class_str_ex(SL("PDO"), ZEND_FETCH_CLASS_AUTO); - ZEPHIR_RETURN_CALL_CE_STATIC(_0, "getavailabledrivers", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + if (EG(exception)) { + ZEPHIR_INIT_VAR(&_88); + ZVAL_OBJ(&_88, EG(exception)); + Z_ADDREF_P(&_88); + if (zephir_is_instance_of(&_88, SL("Throwable"))) { + zend_clear_exception(); + ZEPHIR_CPY_WRT(&e, &_88); + zephir_read_property(&_89$$67, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_89$$67) != IS_NULL) { + zephir_read_property(&_90$$68, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_91$$68); + ZVAL_STRING(&_91$$68, "micro:beforeException"); + ZEPHIR_CALL_METHOD(&returnedValue, &_90$$68, "fire", NULL, 0, &_91$$68, this_ptr, &e); + zephir_check_call_status(); + } + zephir_read_property(&_92$$67, this_ptr, ZEND_STRL("errorHandler"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_92$$67) != IS_NULL) { + zephir_read_property(&_93$$69, this_ptr, ZEND_STRL("errorHandler"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_is_callable(&_93$$69)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "Error handler is not callable", "phalcon/Mvc/Micro.zep", 726); + return; + } + zephir_read_property(&_94$$69, this_ptr, ZEND_STRL("errorHandler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_95$$69); + zephir_create_array(&_95$$69, 1, 0); + zephir_array_fast_append(&_95$$69, &e); + ZEPHIR_INIT_NVAR(&returnedValue); + ZEPHIR_CALL_USER_FUNC_ARRAY(&returnedValue, &_94$$69, &_95$$69); + zephir_check_call_status(); + if (Z_TYPE_P(&returnedValue) == IS_OBJECT) { + if (!(zephir_instance_of_ev(&returnedValue, phalcon_http_responseinterface_ce))) { + zephir_throw_exception_debug(&e, "phalcon/Mvc/Micro.zep", 739); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + if (!ZEPHIR_IS_FALSE_IDENTICAL(&returnedValue)) { + zephir_throw_exception_debug(&e, "phalcon/Mvc/Micro.zep", 743); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + if (!ZEPHIR_IS_FALSE_IDENTICAL(&returnedValue)) { + zephir_throw_exception_debug(&e, "phalcon/Mvc/Micro.zep", 748); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("responseHandler"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_0)) { + zephir_read_property(&_96$$77, this_ptr, ZEND_STRL("responseHandler"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_is_callable(&_96$$77)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "Response handler is not callable or is not defined", "phalcon/Mvc/Micro.zep", 761); + return; + } + zephir_read_property(&_97$$77, this_ptr, ZEND_STRL("responseHandler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_NVAR(&returnedValue); + ZEPHIR_CALL_USER_FUNC(&returnedValue, &_97$$77); + zephir_check_call_status(); + } else { + if (Z_TYPE_P(&returnedValue) == IS_STRING) { + ZEPHIR_INIT_VAR(&_99$$80); + ZVAL_STRING(&_99$$80, "response"); + ZEPHIR_CALL_METHOD(&_98$$80, &container, "getshared", NULL, 0, &_99$$80); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&response, &_98$$80); + ZEPHIR_CALL_METHOD(&_98$$80, &response, "issent", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_98$$80))) { + ZEPHIR_CALL_METHOD(NULL, &response, "setcontent", NULL, 0, &returnedValue); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &response, "send", NULL, 0); + zephir_check_call_status(); + } + } + _100$$79 = Z_TYPE_P(&returnedValue) == IS_OBJECT; + if (_100$$79) { + _100$$79 = zephir_instance_of_ev(&returnedValue, phalcon_http_responseinterface_ce); + } + _101$$79 = _100$$79; + if (_101$$79) { + ZEPHIR_CALL_METHOD(&_102$$79, &returnedValue, "issent", NULL, 0); + zephir_check_call_status(); + _101$$79 = !zephir_is_true(&_102$$79); + } + if (_101$$79) { + ZEPHIR_CALL_METHOD(NULL, &returnedValue, "send", NULL, 0); + zephir_check_call_status(); + } + } + RETURN_CCTOR(&returnedValue); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getDriverName) +static PHP_METHOD(Phalcon_Mvc_Micro, hasService) { - zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *serviceName_param = NULL, _0, _2, _1$$3; + zval serviceName; zval *this_ptr = getThis(); + ZVAL_UNDEF(&serviceName); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, 16); - ZEPHIR_RETURN_CALL_METHOD(&_0, "getattribute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getProfiler) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "profiler"); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, getQuoteNames) -{ - zval quotes; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *driver_param = NULL, option, _0$$5, _1$$6; - zval driver; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&driver); - ZVAL_UNDEF(&option); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF("es); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR(driver) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(serviceName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &driver_param); - if (!driver_param) { - ZEPHIR_INIT_VAR(&driver); - ZVAL_STRING(&driver, ""); + zephir_fetch_params(1, 1, 0, &serviceName_param); + if (UNEXPECTED(Z_TYPE_P(serviceName_param) != IS_STRING && Z_TYPE_P(serviceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'serviceName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(serviceName_param) == IS_STRING)) { + zephir_get_strval(&serviceName, serviceName_param); } else { - zephir_get_strval(&driver, driver_param); + ZEPHIR_INIT_VAR(&serviceName); } - ZEPHIR_CPY_WRT(&option, &driver); - if (ZEPHIR_IS_EMPTY(&option)) { - ZEPHIR_CALL_METHOD(&option, this_ptr, "getdrivername", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); } - do { - if (ZEPHIR_IS_STRING(&option, "mysql")) { - ZEPHIR_INIT_VAR("es); - zephir_create_array("es, 4, 0); - add_assoc_stringl_ex("es, SL("prefix"), SL("`")); - add_assoc_stringl_ex("es, SL("suffix"), SL("`")); - add_assoc_stringl_ex("es, SL("find"), SL("`")); - add_assoc_stringl_ex("es, SL("replace"), SL("``")); - break; - } - if (ZEPHIR_IS_STRING(&option, "sqlsrv")) { - ZEPHIR_INIT_VAR(&_0$$5); - zephir_create_array(&_0$$5, 4, 0); - add_assoc_stringl_ex(&_0$$5, SL("prefix"), SL("[")); - add_assoc_stringl_ex(&_0$$5, SL("suffix"), SL("]")); - add_assoc_stringl_ex(&_0$$5, SL("find"), SL("]")); - add_assoc_stringl_ex(&_0$$5, SL("replace"), SL("][")); - ZEPHIR_CPY_WRT("es, &_0$$5); - break; - } - ZEPHIR_INIT_VAR(&_1$$6); - zephir_create_array(&_1$$6, 4, 0); - add_assoc_stringl_ex(&_1$$6, SL("prefix"), SL("\"")); - add_assoc_stringl_ex(&_1$$6, SL("suffix"), SL("\"")); - add_assoc_stringl_ex(&_1$$6, SL("find"), SL("\"")); - add_assoc_stringl_ex(&_1$$6, SL("replace"), SL("\"\"")); - ZEPHIR_CPY_WRT("es, &_1$$6); - break; - } while(0); - - RETURN_CTOR("es); + zephir_read_property(&_2, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_2, "has", NULL, 0, &serviceName); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, inTransaction) +static PHP_METHOD(Phalcon_Mvc_Micro, head) { - zval result, _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); + } else { + ZEPHIR_INIT_VAR(&routePattern); + } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "inTransaction"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &_2, "intransaction", NULL, 0); + ZEPHIR_CALL_METHOD(&route, &router, "addhead", NULL, 0, &routePattern); zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); zephir_check_call_status(); - RETURN_CCTOR(&result); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, isConnected) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); - RETURN_MM_BOOL(zephir_get_boolval(&_0)); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, lastInsertId) +static PHP_METHOD(Phalcon_Mvc_Micro, map) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, result, _0, _1, _2, _3; - zval name, _4; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(name) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &name_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - zephir_get_strval(&name, name_param); + ZEPHIR_INIT_VAR(&routePattern); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "lastInsertId"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &_2, "lastinsertid", NULL, 0, &name); + ZEPHIR_CALL_METHOD(&route, &router, "add", NULL, 0, &routePattern); zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); zephir_check_call_status(); - zephir_cast_to_string(&_4, &result); - RETURN_CTOR(&_4); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, perform) +static PHP_METHOD(Phalcon_Mvc_Micro, mount) { - zend_string *_5; - zend_ulong _4; + zend_bool _4$$7, _5$$7, _7$$15, _8$$15; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL; + zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *statement_param = NULL, *values_param = NULL, name, sth, value, _0, _1, *_2, _3, _7; - zval statement; + zval *collection, collection_sub, mainHandler, handlers, lazyHandler, prefix, methods, pattern, subHandler, realHandler, prefixedPattern, route, handler, name, _0, *_1, _2, _6$$15; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&collection_sub); + ZVAL_UNDEF(&mainHandler); + ZVAL_UNDEF(&handlers); + ZVAL_UNDEF(&lazyHandler); + ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&methods); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&subHandler); + ZVAL_UNDEF(&realHandler); + ZVAL_UNDEF(&prefixedPattern); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&handler); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_6$$15); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(collection, phalcon_mvc_micro_collectioninterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &values_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); - } else { - zephir_get_arrval(&values, values_param); - } + zephir_fetch_params(1, 1, 0, &collection); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + ZEPHIR_CALL_METHOD(&mainHandler, collection, "gethandler", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "perform"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); + if (UNEXPECTED(ZEPHIR_IS_EMPTY(&mainHandler))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "Collection requires a main handler", "phalcon/Mvc/Micro.zep", 876); + return; + } + ZEPHIR_CALL_METHOD(&handlers, collection, "gethandlers", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&sth, this_ptr, "prepare", NULL, 0, &statement); + if (UNEXPECTED(!(zephir_fast_count_int(&handlers)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "There are no handlers to mount", "phalcon/Mvc/Micro.zep", 882); + return; + } + ZEPHIR_CALL_METHOD(&_0, collection, "islazy", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&values, 0, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 579); - if (Z_TYPE_P(&values) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&values), _4, _5, _2) + if (zephir_is_true(&_0)) { + ZEPHIR_INIT_VAR(&lazyHandler); + object_init_ex(&lazyHandler, phalcon_mvc_micro_lazyloader_ce); + ZEPHIR_CALL_METHOD(NULL, &lazyHandler, "__construct", NULL, 419, &mainHandler); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&lazyHandler, &mainHandler); + } + ZEPHIR_CALL_METHOD(&prefix, collection, "getprefix", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&handlers, 0, "phalcon/Mvc/Micro.zep", 940); + if (Z_TYPE_P(&handlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&handlers), _1) { - ZEPHIR_INIT_NVAR(&name); - if (_5 != NULL) { - ZVAL_STR_COPY(&name, _5); + ZEPHIR_INIT_NVAR(&handler); + ZVAL_COPY(&handler, _1); + if (UNEXPECTED(Z_TYPE_P(&handler) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "One of the registered handlers is invalid", "phalcon/Mvc/Micro.zep", 903); + return; + } + ZEPHIR_OBS_NVAR(&methods); + zephir_array_fetch_long(&methods, &handler, 0, PH_NOISY, "phalcon/Mvc/Micro.zep", 906); + ZEPHIR_OBS_NVAR(&pattern); + zephir_array_fetch_long(&pattern, &handler, 1, PH_NOISY, "phalcon/Mvc/Micro.zep", 907); + ZEPHIR_OBS_NVAR(&subHandler); + zephir_array_fetch_long(&subHandler, &handler, 2, PH_NOISY, "phalcon/Mvc/Micro.zep", 908); + ZEPHIR_OBS_NVAR(&name); + zephir_array_fetch_long(&name, &handler, 3, PH_NOISY, "phalcon/Mvc/Micro.zep", 909); + ZEPHIR_INIT_NVAR(&realHandler); + zephir_create_array(&realHandler, 2, 0); + zephir_array_fast_append(&realHandler, &lazyHandler); + zephir_array_fast_append(&realHandler, &subHandler); + if (!(ZEPHIR_IS_EMPTY(&prefix))) { + if (ZEPHIR_IS_STRING_IDENTICAL(&pattern, "/")) { + ZEPHIR_CPY_WRT(&prefixedPattern, &prefix); + } else { + ZEPHIR_INIT_NVAR(&prefixedPattern); + ZEPHIR_CONCAT_VV(&prefixedPattern, &prefix, &pattern); + } } else { - ZVAL_LONG(&name, _4); + ZEPHIR_CPY_WRT(&prefixedPattern, &pattern); } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _2); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "performbind", &_6, 0, &sth, &name, &value); + ZEPHIR_CALL_METHOD(&route, this_ptr, "map", &_3, 0, &prefixedPattern, &realHandler); zephir_check_call_status(); + _4$$7 = Z_TYPE_P(&methods) == IS_STRING; + if (_4$$7) { + _4$$7 = !ZEPHIR_IS_STRING_IDENTICAL(&methods, ""); + } + _5$$7 = _4$$7; + if (!(_5$$7)) { + _5$$7 = Z_TYPE_P(&methods) == IS_ARRAY; + } + if (_5$$7) { + ZEPHIR_CALL_METHOD(NULL, &route, "via", NULL, 0, &methods); + zephir_check_call_status(); + } + if (Z_TYPE_P(&name) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, &route, "setname", NULL, 0, &name); + zephir_check_call_status(); + } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &handlers, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_3, &values, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &handlers, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_3)) { + if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&name, &values, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&handler, &handlers, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "performbind", &_6, 0, &sth, &name, &value); + if (UNEXPECTED(Z_TYPE_P(&handler) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_micro_exception_ce, "One of the registered handlers is invalid", "phalcon/Mvc/Micro.zep", 903); + return; + } + ZEPHIR_OBS_NVAR(&methods); + zephir_array_fetch_long(&methods, &handler, 0, PH_NOISY, "phalcon/Mvc/Micro.zep", 906); + ZEPHIR_OBS_NVAR(&pattern); + zephir_array_fetch_long(&pattern, &handler, 1, PH_NOISY, "phalcon/Mvc/Micro.zep", 907); + ZEPHIR_OBS_NVAR(&subHandler); + zephir_array_fetch_long(&subHandler, &handler, 2, PH_NOISY, "phalcon/Mvc/Micro.zep", 908); + ZEPHIR_OBS_NVAR(&name); + zephir_array_fetch_long(&name, &handler, 3, PH_NOISY, "phalcon/Mvc/Micro.zep", 909); + ZEPHIR_INIT_NVAR(&_6$$15); + zephir_create_array(&_6$$15, 2, 0); + zephir_array_fast_append(&_6$$15, &lazyHandler); + zephir_array_fast_append(&_6$$15, &subHandler); + ZEPHIR_CPY_WRT(&realHandler, &_6$$15); + if (!(ZEPHIR_IS_EMPTY(&prefix))) { + if (ZEPHIR_IS_STRING_IDENTICAL(&pattern, "/")) { + ZEPHIR_CPY_WRT(&prefixedPattern, &prefix); + } else { + ZEPHIR_INIT_NVAR(&prefixedPattern); + ZEPHIR_CONCAT_VV(&prefixedPattern, &prefix, &pattern); + } + } else { + ZEPHIR_CPY_WRT(&prefixedPattern, &pattern); + } + ZEPHIR_CALL_METHOD(&route, this_ptr, "map", &_3, 0, &prefixedPattern, &realHandler); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); + _7$$15 = Z_TYPE_P(&methods) == IS_STRING; + if (_7$$15) { + _7$$15 = !ZEPHIR_IS_STRING_IDENTICAL(&methods, ""); + } + _8$$15 = _7$$15; + if (!(_8$$15)) { + _8$$15 = Z_TYPE_P(&methods) == IS_ARRAY; + } + if (_8$$15) { + ZEPHIR_CALL_METHOD(NULL, &route, "via", NULL, 0, &methods); + zephir_check_call_status(); + } + if (Z_TYPE_P(&name) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, &route, "setname", NULL, 0, &name); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &handlers, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&name); - ZEPHIR_CALL_METHOD(NULL, &sth, "execute", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_7, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_7, "finish", NULL, 0, &statement, &values); - zephir_check_call_status(); - RETURN_CCTOR(&sth); + ZEPHIR_INIT_NVAR(&handler); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, prepare) +static PHP_METHOD(Phalcon_Mvc_Micro, notFound) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options; - zval *statement_param = NULL, *options_param = NULL, sth, _0, _1, _2, _3, _4; - zval statement; + zval *handler, handler_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&options); + ZVAL_UNDEF(&handler_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &statement_param, &options_param); - zephir_get_strval(&statement, statement_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); - } else { - zephir_get_arrval(&options, options_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &handler); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "prepare"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&sth, &_2, "prepare", NULL, 0, &statement, &options); - zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_4, &sth, ZEND_STRL("queryString"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0, &_4); - zephir_check_call_status(); - RETURN_CCTOR(&sth); + zephir_update_property_zval(this_ptr, ZEND_STRL("notFoundHandler"), handler); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, query) +static PHP_METHOD(Phalcon_Mvc_Micro, offsetExists) { - zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *statement_param = NULL, sth, _0, _1, _3, _4, _5; - zval statement; + zval offset_sub; + zval *offset; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&offset_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(statement) + Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &statement_param); - zephir_get_strval(&statement, statement_param); + zephir_fetch_params(1, 1, 0, &offset); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "query"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - zephir_create_array(&_2, 2, 0); - ZEPHIR_OBS_VAR(&_3); - zephir_read_property(&_3, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC); - zephir_array_fast_append(&_2, &_3); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "query"); - zephir_array_fast_append(&_2, &_1); - ZEPHIR_INIT_NVAR(&_1); - zephir_get_args(&_1); - ZEPHIR_INIT_VAR(&sth); - ZEPHIR_CALL_USER_FUNC_ARRAY(&sth, &_2, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hasservice", NULL, 0, offset); zephir_check_call_status(); - zephir_read_property(&_4, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_5, &sth, ZEND_STRL("queryString"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_4, "finish", NULL, 0, &_5); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Micro, offsetGet) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval offset_sub; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getservice", NULL, 0, offset); zephir_check_call_status(); - RETURN_CCTOR(&sth); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, quote) +static PHP_METHOD(Phalcon_Mvc_Micro, offsetSet) { - zval _0$$3, _7$$4, _11$$5; - zend_string *_6; - zend_ulong _5; - zval elements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long type, ZEPHIR_LAST_CALL_STATUS; - zval *value, value_sub, *type_param = NULL, element, key, quotes, *_3, _4, _1$$3, _2$$3, _8$$4, _9$$4, _10$$4, _12$$5, _13$$5, _14$$5; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval offset_sub, value_sub; + zval *offset, *value; zval *this_ptr = getThis(); + ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&element); - ZVAL_UNDEF(&key); - ZVAL_UNDEF("es); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); - ZVAL_UNDEF(&_12$$5); - ZVAL_UNDEF(&_13$$5); - ZVAL_UNDEF(&_14$$5); - ZVAL_UNDEF(&elements); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_11$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &value, &type_param); - if (!type_param) { - type = 2; - } else { - type = zephir_get_intval(type_param); - } + zephir_fetch_params(1, 2, 0, &offset, &value); - ZEPHIR_INIT_VAR(&elements); - array_init(&elements); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&element, value); - ZEPHIR_CALL_METHOD("es, this_ptr, "getquotenames", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setservice", NULL, 0, offset, value); zephir_check_call_status(); - if (Z_TYPE_P(&element) != IS_ARRAY) { - zephir_cast_to_string(&_0$$3, &element); - ZEPHIR_CPY_WRT(&element, &_0$$3); - zephir_array_fetch_string(&_1$$3, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 664); - zephir_array_fetch_string(&_2$$3, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 664); - ZEPHIR_CONCAT_VVV(return_value, &_1$$3, &element, &_2$$3); - RETURN_MM(); - } - zephir_is_iterable(value, 0, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 673); - if (Z_TYPE_P(value) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(value), _5, _6, _3) - { - ZEPHIR_INIT_NVAR(&key); - if (_6 != NULL) { - ZVAL_STR_COPY(&key, _6); - } else { - ZVAL_LONG(&key, _5); - } - ZEPHIR_INIT_NVAR(&element); - ZVAL_COPY(&element, _3); - zephir_cast_to_string(&_7$$4, &element); - ZEPHIR_CPY_WRT(&element, &_7$$4); - zephir_array_fetch_string(&_8$$4, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); - zephir_array_fetch_string(&_9$$4, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); - ZEPHIR_INIT_NVAR(&_10$$4); - ZEPHIR_CONCAT_VVV(&_10$$4, &_8$$4, &element, &_9$$4); - zephir_array_update_zval(&elements, &key, &_10$$4, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, value, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&key, value, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&element, value, "current", NULL, 0); - zephir_check_call_status(); - zephir_cast_to_string(&_11$$5, &element); - ZEPHIR_CPY_WRT(&element, &_11$$5); - zephir_array_fetch_string(&_12$$5, "es, SL("prefix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); - zephir_array_fetch_string(&_13$$5, "es, SL("suffix"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 670); - ZEPHIR_INIT_NVAR(&_14$$5); - ZEPHIR_CONCAT_VVV(&_14$$5, &_12$$5, &element, &_13$$5); - zephir_array_update_zval(&elements, &key, &_14$$5, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, value, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&element); - ZEPHIR_INIT_NVAR(&key); - zephir_fast_join_str(return_value, SL(", "), &elements); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, rollBack) +static PHP_METHOD(Phalcon_Mvc_Micro, offsetUnset) { - zval result, _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval offset_sub, _0, _2, _1$$3; + zval *offset; zval *this_ptr = getThis(); - ZVAL_UNDEF(&result); + ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "rollBack"); - ZEPHIR_CALL_METHOD(NULL, &_0, "start", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_2, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &_2, "rollback", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_3, this_ptr, ZEND_STRL("profiler"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_3, "finish", NULL, 0); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_2, "remove", NULL, 0, offset); zephir_check_call_status(); - RETURN_CCTOR(&result); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, setAttribute) +static PHP_METHOD(Phalcon_Mvc_Micro, options) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *attribute_param = NULL, *value, value_sub, _0, _1; - zend_long attribute, ZEPHIR_LAST_CALL_STATUS; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_LONG(attribute) - Z_PARAM_ZVAL(value) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &attribute_param, &value); - attribute = zephir_get_intval(attribute_param); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); + } else { + ZEPHIR_INIT_VAR(&routePattern); + } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, attribute); - ZEPHIR_RETURN_CALL_METHOD(&_0, "setattribute", NULL, 0, &_1, value); + ZEPHIR_CALL_METHOD(&route, &router, "addoptions", NULL, 0, &routePattern); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, setProfiler) +static PHP_METHOD(Phalcon_Mvc_Micro, patch) { - zval *profiler, profiler_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&profiler_sub); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &profiler); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); + } else { + ZEPHIR_INIT_VAR(&routePattern); + } - zephir_update_property_zval(this_ptr, ZEND_STRL("profiler"), profiler); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&route, &router, "addpatch", NULL, 0, &routePattern); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, performBind) +static PHP_METHOD(Phalcon_Mvc_Micro, post) { - zend_bool _1$$4; - zval _8, _5$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS, _0$$3; - zval *statement, statement_sub, *name, name_sub, *arguments, arguments_sub, key, parameters, type, _7, _9, _2$$4, _3$$7, _4$$7, _6$$8; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement_sub); - ZVAL_UNDEF(&name_sub); - ZVAL_UNDEF(&arguments_sub); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(¶meters); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$7); - ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_6$$8); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_OBJECT_OF_CLASS(statement, zephir_get_internal_ce(SL("pdostatement"))) - Z_PARAM_ZVAL(name) - Z_PARAM_ZVAL(arguments) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &statement, &name, &arguments); - ZEPHIR_SEPARATE_PARAM(arguments); - - - ZEPHIR_CPY_WRT(&key, name); - if (Z_TYPE_P(&key) == IS_LONG) { - _0$$3 = (zephir_get_numberval(&key) + 1); - ZEPHIR_INIT_NVAR(&key); - ZVAL_LONG(&key, _0$$3); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); } - if (Z_TYPE_P(arguments) == IS_ARRAY) { - if (zephir_array_isset_long(arguments, 1)) { - ZEPHIR_OBS_VAR(&type); - zephir_array_fetch_long(&type, arguments, 1, PH_NOISY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 743); - } else { - ZEPHIR_INIT_NVAR(&type); - ZVAL_LONG(&type, 2); - } - _1$$4 = ZEPHIR_IS_LONG_IDENTICAL(&type, 5); - if (_1$$4) { - ZEPHIR_OBS_VAR(&_2$$4); - zephir_array_fetch_long(&_2$$4, arguments, 0, PH_NOISY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 748); - _1$$4 = ((Z_TYPE_P(&_2$$4) == IS_TRUE || Z_TYPE_P(&_2$$4) == IS_FALSE) == 1); - } - if (_1$$4) { - ZEPHIR_INIT_VAR(&_3$$7); - zephir_array_fetch_long(&_4$$7, arguments, 0, PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep", 749); - if (zephir_is_true(&_4$$7)) { - ZEPHIR_INIT_NVAR(&_3$$7); - ZVAL_STRING(&_3$$7, "1"); - } else { - ZEPHIR_INIT_NVAR(&_3$$7); - ZVAL_STRING(&_3$$7, "0"); - } - zephir_array_update_long(arguments, 0, &_3$$7, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - } - ZEPHIR_INIT_VAR(&_5$$4); - zephir_create_array(&_5$$4, 1, 0); - zephir_array_fast_append(&_5$$4, &key); - ZEPHIR_INIT_VAR(¶meters); - zephir_fast_array_merge(¶meters, &_5$$4, arguments); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&_6$$8); - zephir_create_array(&_6$$8, 2, 0); - zephir_array_fast_append(&_6$$8, &key); - zephir_array_fast_append(&_6$$8, arguments); - ZEPHIR_CPY_WRT(¶meters, &_6$$8); + ZEPHIR_INIT_VAR(&routePattern); } - ZEPHIR_INIT_VAR(&_7); - ZEPHIR_INIT_VAR(&_8); - zephir_create_array(&_8, 2, 0); - zephir_array_fast_append(&_8, statement); - ZEPHIR_INIT_VAR(&_9); - ZVAL_STRING(&_9, "bindValue"); - zephir_array_fast_append(&_8, &_9); - ZEPHIR_CALL_USER_FUNC_ARRAY(&_7, &_8, ¶meters); + + + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_CALL_METHOD(&route, &router, "addpost", NULL, 0, &routePattern); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_AbstractConnection, fetchData) +static PHP_METHOD(Phalcon_Mvc_Micro, put) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval arguments, values, _0; - zval *method_param = NULL, *arguments_param = NULL, *statement_param = NULL, *values_param = NULL, result, sth; - zval method, statement; + zval *routePattern_param = NULL, *handler, handler_sub, router, route, _0; + zval routePattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&sth); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(method) - Z_PARAM_ARRAY(arguments) - Z_PARAM_STR(statement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &method_param, &arguments_param, &statement_param, &values_param); - zephir_get_strval(&method, method_param); - zephir_get_arrval(&arguments, arguments_param); - zephir_get_strval(&statement, statement_param); - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); + zephir_fetch_params(1, 2, 0, &routePattern_param, &handler); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - zephir_get_arrval(&values, values_param); + ZEPHIR_INIT_VAR(&routePattern); } - ZEPHIR_CALL_METHOD(&sth, this_ptr, "perform", NULL, 0, &statement, &values); + ZEPHIR_CALL_METHOD(&router, this_ptr, "getrouter", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0); - zephir_array_fast_append(&_0, &sth); - zephir_array_fast_append(&_0, &method); - ZEPHIR_INIT_VAR(&result); - ZEPHIR_CALL_USER_FUNC_ARRAY(&result, &_0, &arguments); + ZEPHIR_CALL_METHOD(&route, &router, "addput", NULL, 0, &routePattern); zephir_check_call_status(); - if (Z_TYPE_P(&result) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(&result); - array_init(&result); - } - RETURN_CCTOR(&result); + ZEPHIR_CALL_METHOD(&_0, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("handlers"), &_0, handler); + RETURN_CCTOR(&route); } +static PHP_METHOD(Phalcon_Mvc_Micro, setActiveHandler) +{ + zval *activeHandler, activeHandler_sub; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&activeHandler_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(activeHandler) + ZEND_PARSE_PARAMETERS_END(); #endif + zephir_fetch_params_without_memory_grow(1, 0, &activeHandler); - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Connection, ConnectionInterface, phalcon, datamapper_pdo_connection_connectioninterface, phalcon_datamapper_pdo_connection_connectioninterface_method_entry); - - zend_class_implements(phalcon_datamapper_pdo_connection_connectioninterface_ce, 1, phalcon_datamapper_pdo_connection_pdointerface_ce); - return SUCCESS; + zephir_update_property_zval(this_ptr, ZEND_STRL("activeHandler"), activeHandler); } -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, connect); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, disconnect); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAffected); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAll); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchAssoc); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchColumn); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchGroup); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchObject); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchObjects); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchOne); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchPairs); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, fetchValue); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, getAdapter); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, getProfiler); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, isConnected); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, perform); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_ConnectionInterface, setProfiler); - - +static PHP_METHOD(Phalcon_Mvc_Micro, setDI) +{ + zval *container, container_sub; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&container_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) + ZEND_PARSE_PARAMETERS_END(); #endif + zephir_fetch_params_without_memory_grow(1, 0, &container); - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_Decorated) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Connection, Decorated, phalcon, datamapper_pdo_connection_decorated, phalcon_datamapper_pdo_connection_abstractconnection_ce, phalcon_datamapper_pdo_connection_decorated_method_entry, 0); - - return SUCCESS; + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, __construct) +static PHP_METHOD(Phalcon_Mvc_Micro, setModelBinder) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *pdo, pdo_sub, *profiler = NULL, profiler_sub, __$null; + zval *modelBinder, modelBinder_sub, *cache = NULL, cache_sub, __$null, _0$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&pdo_sub); - ZVAL_UNDEF(&profiler_sub); + ZVAL_UNDEF(&modelBinder_sub); + ZVAL_UNDEF(&cache_sub); ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(pdo, php_pdo_get_dbh_ce()) + Z_PARAM_OBJECT_OF_CLASS(modelBinder, phalcon_mvc_model_binderinterface_ce) Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(profiler, phalcon_datamapper_pdo_profiler_profilerinterface_ce) + Z_PARAM_ZVAL_OR_NULL(cache) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &pdo, &profiler); - if (!profiler) { - profiler = &profiler_sub; - ZEPHIR_CPY_WRT(profiler, &__$null); + zephir_fetch_params(1, 1, 1, &modelBinder, &cache); + if (!cache) { + cache = &cache_sub; + ZEPHIR_CPY_WRT(cache, &__$null); } else { - ZEPHIR_SEPARATE_PARAM(profiler); + ZEPHIR_SEPARATE_PARAM(cache); } - zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), pdo); - if (Z_TYPE_P(profiler) == IS_NULL) { - ZEPHIR_INIT_NVAR(profiler); - object_init_ex(profiler, phalcon_datamapper_pdo_profiler_profiler_ce); - ZEPHIR_CALL_METHOD(NULL, profiler, "__construct", NULL, 199); + if (Z_TYPE_P(cache) == IS_STRING) { + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getservice", NULL, 0, cache); zephir_check_call_status(); + ZEPHIR_CPY_WRT(cache, &_0$$3); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setprofiler", NULL, 0, profiler); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, connect) -{ - zval *this_ptr = getThis(); - - - + if (Z_TYPE_P(cache) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, modelBinder, "setcache", NULL, 0, cache); + zephir_check_call_status(); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("modelBinder"), modelBinder); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Connection_Decorated, disconnect) +static PHP_METHOD(Phalcon_Mvc_Micro, setResponseHandler) { + zval *handler, handler_sub; zval *this_ptr = getThis(); - - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_datamapper_pdo_exception_cannotdisconnect_ce, "Cannot disconnect a Decorated connection instance", "phalcon/DataMapper/Pdo/Connection/Decorated.zep", 66); - return; -} - - - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&handler_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(handler) + ZEND_PARSE_PARAMETERS_END(); #endif + zephir_fetch_params_without_memory_grow(1, 0, &handler); - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Connection_PdoInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Connection, PdoInterface, phalcon, datamapper_pdo_connection_pdointerface, phalcon_datamapper_pdo_connection_pdointerface_method_entry); - - return SUCCESS; + zephir_update_property_zval(this_ptr, ZEND_STRL("responseHandler"), handler); + RETURN_THISW(); } -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, beginTransaction); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, commit); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorCode); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, errorInfo); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, exec); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, getAttribute); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, getAvailableDrivers); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, inTransaction); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, lastInsertId); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, prepare); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, query); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, quote); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, rollBack); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Connection_PdoInterface, setAttribute); - - +static PHP_METHOD(Phalcon_Mvc_Micro, setService) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool shared; + zval *serviceName_param = NULL, *definition, definition_sub, *shared_param = NULL, _0, _2, _3, _1$$3; + zval serviceName; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&serviceName); + ZVAL_UNDEF(&definition_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(serviceName) + Z_PARAM_ZVAL(definition) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(shared) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &serviceName_param, &definition, &shared_param); + if (UNEXPECTED(Z_TYPE_P(serviceName_param) != IS_STRING && Z_TYPE_P(serviceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'serviceName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(serviceName_param) == IS_STRING)) { + zephir_get_strval(&serviceName, serviceName_param); + } else { + ZEPHIR_INIT_VAR(&serviceName); + } + if (!shared_param) { + shared = 0; + } else { + shared = zephir_get_boolval(shared_param); + } - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_CannotDisconnect) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, CannotDisconnect, phalcon, datamapper_pdo_exception_cannotdisconnect, phalcon_datamapper_pdo_exception_exception_ce, NULL, 0); - - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_di_factorydefault_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 418); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &_1$$3); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + if (shared) { + ZVAL_BOOL(&_3, 1); + } else { + ZVAL_BOOL(&_3, 0); + } + ZEPHIR_RETURN_CALL_METHOD(&_2, "set", NULL, 0, &serviceName, definition, &_3); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Mvc_Micro, stop) +{ + zval __$true, __$false; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H -#endif - + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("stopped"), &__$false); + } +} -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_ConnectionNotFound) +zend_object *zephir_init_properties_Phalcon_Mvc_Micro(zend_class_entry *class_type) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, ConnectionNotFound, phalcon, datamapper_pdo_exception_connectionnotfound, phalcon_datamapper_pdo_exception_exception_ce, NULL, 0); + zval _0, _2, _4, _6, _8, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_9$$7); + - return SUCCESS; + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("handlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("handlers"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("finishHandlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("finishHandlers"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("beforeHandlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("beforeHandlers"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("afterHandlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("afterHandlers"), &_7$$6); + } + zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("afterBindingHandlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_8) == IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$7); + array_init(&_9$$7); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("afterBindingHandlers"), &_9$$7); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } } @@ -43188,5081 +43428,10057 @@ ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_ConnectionNotFound) -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Exception_Exception) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\DataMapper\\Pdo\\Exception, Exception, phalcon, datamapper_pdo_exception_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; -} - - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Model, phalcon, mvc_model, phalcon_di_abstractinjectionaware_ce, phalcon_mvc_model_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_declare_property_long(phalcon_mvc_model_ce, SL("dirtyState"), 1, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("dirtyRelated"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("errorMessages"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("modelsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("modelsMetaData"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("related"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_mvc_model_ce, SL("operationMade"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("oldSnapshot"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_model_ce, SL("skipped"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("snapshot"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("transaction"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("uniqueKey"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("uniqueParams"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_ce, SL("uniqueTypes"), ZEND_ACC_PROTECTED); + phalcon_mvc_model_ce->create_object = zephir_init_properties_Phalcon_Mvc_Model; + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("DIRTY_STATE_DETACHED"), 2); -#ifdef HAVE_CONFIG_H -#endif + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("DIRTY_STATE_PERSISTENT"), 0); + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("DIRTY_STATE_TRANSIENT"), 1); + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("OP_CREATE"), 1); + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("OP_DELETE"), 3); + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("OP_NONE"), 0); -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Profiler, MemoryLogger, phalcon, datamapper_pdo_profiler_memorylogger, phalcon_datamapper_pdo_profiler_memorylogger_method_entry, 0); + zephir_declare_class_constant_long(phalcon_mvc_model_ce, SL("OP_UPDATE"), 2); - zend_declare_property_null(phalcon_datamapper_pdo_profiler_memorylogger_ce, SL("messages"), ZEND_ACC_PROTECTED); - phalcon_datamapper_pdo_profiler_memorylogger_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_MemoryLogger; + zephir_declare_class_constant_string(phalcon_mvc_model_ce, SL("TRANSACTION_INDEX"), "transaction"); - zend_class_implements(phalcon_datamapper_pdo_profiler_memorylogger_ce, 1, phalcon_logger_loggerinterface_ce); + zend_class_implements(phalcon_mvc_model_ce, 1, phalcon_mvc_entityinterface_ce); + zend_class_implements(phalcon_mvc_model_ce, 1, phalcon_mvc_modelinterface_ce); + zend_class_implements(phalcon_mvc_model_ce, 1, phalcon_mvc_model_resultinterface_ce); + zend_class_implements(phalcon_mvc_model_ce, 1, zend_ce_serializable); + zend_class_implements(phalcon_mvc_model_ce, 1, php_json_serializable_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, alert) +static PHP_METHOD(Phalcon_Mvc_Model, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zephir_fcall_cache_entry *_0 = NULL; + zval *data = NULL, data_sub, *container = NULL, container_sub, *modelsManager = NULL, modelsManager_sub, __$null, _1$$4, _2$$4, _3$$4, _4$$5, _5$$5, _6$$6, _7$$6, _8$$6; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&container_sub); + ZVAL_UNDEF(&modelsManager_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) + ZEND_PARSE_PARAMETERS_START(0, 3) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + Z_PARAM_ZVAL_OR_NULL(data) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(container, phalcon_di_diinterface_ce) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(modelsManager, phalcon_mvc_model_managerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); + zephir_fetch_params(1, 0, 3, &data, &container, &modelsManager); + if (!data) { + data = &data_sub; + data = &__$null; + } + if (!container) { + container = &container_sub; + ZEPHIR_CPY_WRT(container, &__$null); } else { - zephir_get_arrval(&context, context_param); + ZEPHIR_SEPARATE_PARAM(container); + } + if (!modelsManager) { + modelsManager = &modelsManager_sub; + ZEPHIR_CPY_WRT(modelsManager, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(modelsManager); } - ZVAL_LONG(&_0, 2); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + if (Z_TYPE_P(container) == IS_NULL) { + ZEPHIR_CALL_CE_STATIC(container, phalcon_di_di_ce, "getdefault", &_0, 0); + zephir_check_call_status(); + } + if (Z_TYPE_P(container) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$4); + object_init_ex(&_1$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$4); + zephir_get_class(&_2$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$4); + ZEPHIR_CONCAT_SVS(&_3$$4, "A dependency injection container is required to access the services related to the ODM in '", &_2$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_3$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Model.zep", 182); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), container); + if (Z_TYPE_P(modelsManager) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + ZVAL_STRING(&_5$$5, "modelsManager"); + ZEPHIR_CALL_METHOD(&_4$$5, container, "getshared", NULL, 0, &_5$$5); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(modelsManager, &_4$$5); + if (Z_TYPE_P(modelsManager) == IS_NULL) { + ZEPHIR_INIT_VAR(&_6$$6); + object_init_ex(&_6$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$6); + zephir_get_class(&_7$$6, this_ptr, 0); + ZEPHIR_INIT_VAR(&_8$$6); + ZEPHIR_CONCAT_SVS(&_8$$6, "The injected service 'modelsManager' is not valid in '", &_7$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$6, "__construct", NULL, 32, &_8$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$6, "phalcon/Mvc/Model.zep", 195); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_update_property_zval(this_ptr, ZEND_STRL("modelsManager"), modelsManager); + ZEPHIR_CALL_METHOD(NULL, modelsManager, "initialize", NULL, 0, this_ptr); zephir_check_call_status(); + if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("onconstruct")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "onconstruct", NULL, 0, data); + zephir_check_call_status(); + } + if (Z_TYPE_P(data) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "assign", NULL, 0, data); + zephir_check_call_status(); + } ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, critical) +static PHP_METHOD(Phalcon_Mvc_Model, __call) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zephir_fcall_cache_entry *_0 = NULL; + zval arguments; + zval *method_param = NULL, *arguments_param = NULL, modelName, status, records, _1, _2, _3; + zval method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&status); + ZVAL_UNDEF(&records); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&arguments); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(method) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + zephir_fetch_params(1, 2, 0, &method_param, &arguments_param); + zephir_get_strval(&method, method_param); + zephir_get_arrval(&arguments, arguments_param); - ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 420, &method, &arguments); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&records)) { + RETURN_CCTOR(&records); + } + ZEPHIR_INIT_VAR(&modelName); + zephir_get_class(&modelName, this_ptr, 0); + ZEPHIR_CALL_METHOD(&records, this_ptr, "getrelatedrecords", NULL, 0, &modelName, &method, &arguments); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&records)) { + RETURN_CCTOR(&records); + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&status, &_1, "missingmethod", NULL, 0, this_ptr, &method, &arguments); + zephir_check_call_status(); + if (Z_TYPE_P(&status) != IS_NULL) { + RETURN_CCTOR(&status); + } + ZEPHIR_INIT_VAR(&_2); + object_init_ex(&_2, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_CONCAT_SVSVS(&_3, "The method '", &method, "' doesn't exist on model '", &modelName, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 32, &_3); zephir_check_call_status(); + zephir_throw_exception_debug(&_2, "phalcon/Mvc/Model.zep", 264); ZEPHIR_MM_RESTORE(); + return; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, debug) +static PHP_METHOD(Phalcon_Mvc_Model, __callStatic) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zephir_fcall_cache_entry *_0 = NULL; + zval arguments; + zval *method_param = NULL, *arguments_param = NULL, modelName, records, _1, _2; + zval method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&records); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&arguments); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(method) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + zephir_fetch_params(1, 2, 0, &method_param, &arguments_param); + zephir_get_strval(&method, method_param); + zephir_get_arrval(&arguments, arguments_param); - ZVAL_LONG(&_0, 7); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + ZEPHIR_CALL_SELF(&records, "invokefinder", &_0, 420, &method, &arguments); + zephir_check_call_status(); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&records)) { + RETURN_CCTOR(&records); + } + ZEPHIR_INIT_VAR(&modelName); + zephir_get_called_class(&modelName); + ZEPHIR_INIT_VAR(&_1); + object_init_ex(&_1, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_SVSVS(&_2, "The method '", &method, "' doesn't exist on model '", &modelName, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 32, &_2); zephir_check_call_status(); + zephir_throw_exception_debug(&_1, "phalcon/Mvc/Model.zep", 290); ZEPHIR_MM_RESTORE(); + return; } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, emergency) +static PHP_METHOD(Phalcon_Mvc_Model, __get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zval *property_param = NULL, modelName, manager, lowerProperty, relation, _0, _4, _5, _6, _1$$3, _2$$4, _3$$4; + zval property, method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&lowerProperty); + ZVAL_UNDEF(&relation); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); + zephir_fetch_params(1, 1, 0, &property_param); + if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(property_param) == IS_STRING)) { + zephir_get_strval(&property, property_param); } else { - zephir_get_arrval(&context, context_param); + ZEPHIR_INIT_VAR(&property); } - ZVAL_LONG(&_0, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + ZEPHIR_INIT_VAR(&modelName); + zephir_get_class(&modelName, this_ptr, 0); + ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&lowerProperty); + zephir_fast_strtolower(&lowerProperty, &property); + ZEPHIR_CALL_METHOD(&_0, &manager, "getrelationbyalias", NULL, 0, &modelName, &lowerProperty); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_0); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_1$$3, &lowerProperty)) { + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_3$$4, &_2$$4, &lowerProperty, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 322); + RETURN_CTOR(&_3$$4); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getrelated", NULL, 0, &lowerProperty); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&_4); + zephir_camelize(&_4, &property, NULL ); + ZEPHIR_INIT_VAR(&_5); + ZEPHIR_CONCAT_SV(&_5, "get", &_4); + zephir_get_strval(&method, &_5); + if ((zephir_method_exists(this_ptr, &method) == SUCCESS)) { + ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &method, NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&_6); + ZEPHIR_CONCAT_SVSV(&_6, "Access to undefined property ", &modelName, "::", &property); + ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 7, &_6); + zephir_check_call_status(); + RETURN_MM_NULL(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, error) +static PHP_METHOD(Phalcon_Mvc_Model, __isset) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zval *property_param = NULL, manager, method, modelName, relation, result, _0, _1$$4; + zval property; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&_1$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); + zephir_fetch_params(1, 1, 0, &property_param); + if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(property_param) == IS_STRING)) { + zephir_get_strval(&property, property_param); } else { - zephir_get_arrval(&context, context_param); + ZEPHIR_INIT_VAR(&property); } - ZVAL_LONG(&_0, 3); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + ZEPHIR_INIT_VAR(&modelName); + zephir_get_class(&modelName, this_ptr, 0); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmodelsmanager", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_CALL_METHOD(&_0, &manager, "getrelationbyalias", NULL, 0, &modelName, &property); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_0); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&result); + ZVAL_BOOL(&result, 1); + } else { + ZEPHIR_INIT_VAR(&_1$$4); + zephir_camelize(&_1$$4, &property, NULL ); + ZEPHIR_INIT_VAR(&method); + ZEPHIR_CONCAT_SV(&method, "get", &_1$$4); + ZEPHIR_INIT_NVAR(&result); + ZVAL_BOOL(&result, (zephir_method_exists(this_ptr, &method) == SUCCESS)); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getAdapter) +static PHP_METHOD(Phalcon_Mvc_Model, __serialize) { + zend_bool _2, _3; + zval attributes, manager, dirtyState, snapshot, _0, _1, _4, _5$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&dirtyState); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - - object_init_ex(return_value, phalcon_logger_adapter_noop_ce); - if (zephir_has_constructor(return_value)) { - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&snapshot); + ZVAL_NULL(&snapshot); + ZEPHIR_CALL_METHOD(&attributes, this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dirtyState, &_0); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + ZEPHIR_CALL_METHOD(&_1, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + _2 = zephir_is_true(&_1); + if (_2) { + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + _2 = Z_TYPE_P(&_0) != IS_NULL; } - + _3 = _2; + if (_3) { + zephir_read_property(&_4, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + _3 = !ZEPHIR_IS_EQUAL(&attributes, &_4); + } + if (_3) { + zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&snapshot, &_5$$3); + } + zephir_create_array(return_value, 3, 0); + zephir_array_update_string(return_value, SL("attributes"), &attributes, PH_COPY | PH_SEPARATE); + zephir_array_update_string(return_value, SL("snapshot"), &snapshot, PH_COPY | PH_SEPARATE); + zephir_array_update_string(return_value, SL("dirtyState"), &dirtyState, PH_COPY | PH_SEPARATE); RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getAdapters) -{ - zval *this_ptr = getThis(); - - - - array_init(return_value); - return; -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getLogLevel) -{ - zval *this_ptr = getThis(); - - - - RETURN_LONG(8); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getMessages) +static PHP_METHOD(Phalcon_Mvc_Model, __set) { + zend_bool _0; + zval related; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *property_param = NULL, *value, value_sub, lowerProperty, modelName, manager, relation, referencedModel, item, dirtyState, _14, _15, _1$$3, _2$$4, _3$$4, _4$$6, _5$$7, _6$$8, _7$$9, _8$$9, *_9$$10, _10$$10, _11$$10, _12$$17, _13$$18, _16$$20, _17$$21, _18$$21, _19$$21; + zval property; zval *this_ptr = getThis(); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&lowerProperty); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&item); + ZVAL_UNDEF(&dirtyState); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$6); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_6$$8); + ZVAL_UNDEF(&_7$$9); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_10$$10); + ZVAL_UNDEF(&_11$$10); + ZVAL_UNDEF(&_12$$17); + ZVAL_UNDEF(&_13$$18); + ZVAL_UNDEF(&_16$$20); + ZVAL_UNDEF(&_17$$21); + ZVAL_UNDEF(&_18$$21); + ZVAL_UNDEF(&_19$$21); + ZVAL_UNDEF(&related); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(property) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "messages"); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, getName) -{ - zval *this_ptr = getThis(); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &property_param, &value); + zephir_get_strval(&property, property_param); + _0 = Z_TYPE_P(value) == IS_OBJECT; + if (_0) { + _0 = zephir_instance_of_ev(value, phalcon_mvc_modelinterface_ce); + } + if (_0) { + ZEPHIR_INIT_VAR(&lowerProperty); + zephir_fast_strtolower(&lowerProperty, &property); + ZEPHIR_INIT_VAR(&modelName); + zephir_get_class(&modelName, this_ptr, 0); + ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, &manager, "getrelationbyalias", NULL, 0, &modelName, &lowerProperty); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_1$$3); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dirtyState, &_2$$4); + ZEPHIR_CALL_METHOD(&_3$$4, value, "getdirtystate", NULL, 0); + zephir_check_call_status(); + if (!ZEPHIR_IS_EQUAL(&_3$$4, &dirtyState)) { + ZEPHIR_INIT_NVAR(&dirtyState); + ZVAL_LONG(&dirtyState, 1); + } + zephir_unset_property_array(this_ptr, ZEND_STRL("related"), &lowerProperty); + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_2$$4, &lowerProperty, PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("dirtyRelated"), &lowerProperty, value); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &dirtyState); + RETVAL_ZVAL(value, 1, 0); + RETURN_MM(); + } + } else if (Z_TYPE_P(value) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&lowerProperty); + zephir_fast_strtolower(&lowerProperty, &property); + ZEPHIR_INIT_NVAR(&modelName); + zephir_get_class(&modelName, this_ptr, 0); + ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$6, &manager, "getrelationbyalias", NULL, 0, &modelName, &lowerProperty); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_4$$6); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_5$$7, &relation, "gettype", NULL, 0); + zephir_check_call_status(); + do { + if (ZEPHIR_IS_LONG(&_5$$7, 0) || ZEPHIR_IS_LONG(&_5$$7, 1)) { + ZEPHIR_CALL_METHOD(&_6$$8, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedModel, &manager, "load", NULL, 0, &_6$$8); + zephir_check_call_status(); + if (Z_TYPE_P(&referencedModel) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, &referencedModel, "assign", NULL, 0, value); + zephir_check_call_status(); + zephir_unset_property_array(this_ptr, ZEND_STRL("related"), &lowerProperty); + zephir_read_property(&_7$$9, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_7$$9, &lowerProperty, PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("dirtyRelated"), &lowerProperty, &referencedModel); + ZEPHIR_INIT_ZVAL_NREF(_8$$9); + ZVAL_LONG(&_8$$9, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_8$$9); + RETVAL_ZVAL(value, 1, 0); + RETURN_MM(); + } + break; + } + if (ZEPHIR_IS_LONG(&_5$$7, 2) || ZEPHIR_IS_LONG(&_5$$7, 4)) { + ZEPHIR_INIT_VAR(&related); + array_init(&related); + zephir_is_iterable(value, 0, "phalcon/Mvc/Model.zep", 493); + if (Z_TYPE_P(value) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(value), _9$$10) + { + ZEPHIR_INIT_NVAR(&item); + ZVAL_COPY(&item, _9$$10); + if (Z_TYPE_P(&item) == IS_OBJECT) { + if (zephir_instance_of_ev(&item, phalcon_mvc_modelinterface_ce)) { + zephir_array_append(&related, &item, PH_SEPARATE, "phalcon/Mvc/Model.zep", 488); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$10, value, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$10)) { + break; + } + ZEPHIR_CALL_METHOD(&item, value, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&item) == IS_OBJECT) { + if (zephir_instance_of_ev(&item, phalcon_mvc_modelinterface_ce)) { + zephir_array_append(&related, &item, PH_SEPARATE, "phalcon/Mvc/Model.zep", 488); + } + } + ZEPHIR_CALL_METHOD(NULL, value, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&item); + zephir_unset_property_array(this_ptr, ZEND_STRL("related"), &lowerProperty); + zephir_read_property(&_11$$10, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_11$$10, &lowerProperty, PH_SEPARATE); + if (zephir_fast_count_int(&related) > 0) { + zephir_update_property_array(this_ptr, SL("dirtyRelated"), &lowerProperty, &related); + ZEPHIR_INIT_ZVAL_NREF(_12$$17); + ZVAL_LONG(&_12$$17, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_12$$17); + } else { + zephir_unset_property_array(this_ptr, ZEND_STRL("dirtyRelated"), &lowerProperty); + zephir_read_property(&_13$$18, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_13$$18, &lowerProperty, PH_SEPARATE); + } + RETVAL_ZVAL(value, 1, 0); + RETURN_MM(); + } + } while(0); - RETURN_STRING("memory logger"); + } + } + ZEPHIR_CALL_METHOD(&_14, this_ptr, "possiblesetter", NULL, 421, &property, value); + zephir_check_call_status(); + if (zephir_is_true(&_14)) { + RETVAL_ZVAL(value, 1, 0); + RETURN_MM(); + } + ZEPHIR_CALL_FUNCTION(&_15, "property_exists", NULL, 289, this_ptr, &property); + zephir_check_call_status(); + if (zephir_is_true(&_15)) { + ZEPHIR_CALL_METHOD(&manager, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_16$$20, &manager, "isvisiblemodelproperty", NULL, 0, this_ptr, &property); + zephir_check_call_status(); + if (UNEXPECTED(!zephir_is_true(&_16$$20))) { + ZEPHIR_INIT_VAR(&_17$$21); + object_init_ex(&_17$$21, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_18$$21); + zephir_get_class(&_18$$21, this_ptr, 0); + ZEPHIR_INIT_VAR(&_19$$21); + ZEPHIR_CONCAT_SVSVS(&_19$$21, "Cannot access property '", &property, "' (not public) in '", &_18$$21, "'"); + ZEPHIR_CALL_METHOD(NULL, &_17$$21, "__construct", NULL, 32, &_19$$21); + zephir_check_call_status(); + zephir_throw_exception_debug(&_17$$21, "phalcon/Mvc/Model.zep", 522); + ZEPHIR_MM_RESTORE(); + return; + } + } + zephir_update_property_zval_zval(this_ptr, &property, value); + RETVAL_ZVAL(value, 1, 0); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, info) +static PHP_METHOD(Phalcon_Mvc_Model, __unserialize) { + zend_string *_13$$6; + zend_ulong _12$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zephir_fcall_cache_entry *_1 = NULL; + zval *data_param = NULL, container, manager, key, value, snapshot, properties, dirtyState, _5, _6, _0$$3, _2$$4, _3$$4, _4$$4, _7$$5, _8$$5, _9$$5, *_10$$6, _11$$6; + zval data; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&properties); + ZVAL_UNDEF(&dirtyState); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_8$$5); + ZVAL_UNDEF(&_9$$5); + ZVAL_UNDEF(&_11$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(data) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + zephir_fetch_params(1, 1, 0, &data_param); + zephir_get_arrval(&data, data_param); - ZVAL_LONG(&_0, 6); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + if (!(zephir_array_isset_string(&data, SL("attributes")))) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_create_array(&_0$$3, 1, 0); + zephir_array_update_string(&_0$$3, SL("attributes"), &data, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&data, &_0$$3); + } + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_1, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_INIT_VAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$4); + zephir_get_class(&_3$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_4$$4); + ZEPHIR_CONCAT_SVS(&_4$$4, "A dependency injection container is required to access the services related to the ODM in '", &_3$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 32, &_4$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$4, "phalcon/Mvc/Model.zep", 551); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &container); + ZEPHIR_INIT_VAR(&_6); + ZVAL_STRING(&_6, "modelsManager"); + ZEPHIR_CALL_METHOD(&_5, &container, "getshared", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_5); + if (Z_TYPE_P(&manager) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$5); + object_init_ex(&_7$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_8$$5); + zephir_get_class(&_8$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_9$$5); + ZEPHIR_CONCAT_SVS(&_9$$5, "The injected service 'modelsManager' is not valid in '", &_8$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", NULL, 32, &_9$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_7$$5, "phalcon/Mvc/Model.zep", 566); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval(this_ptr, ZEND_STRL("modelsManager"), &manager); + ZEPHIR_CALL_METHOD(NULL, &manager, "initialize", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&properties); + if (zephir_array_isset_string_fetch(&properties, &data, SL("attributes"), 0)) { + zephir_is_iterable(&properties, 0, "phalcon/Mvc/Model.zep", 589); + if (Z_TYPE_P(&properties) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _12$$6, _13$$6, _10$$6) + { + ZEPHIR_INIT_NVAR(&key); + if (_13$$6 != NULL) { + ZVAL_STR_COPY(&key, _13$$6); + } else { + ZVAL_LONG(&key, _12$$6); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _10$$6); + zephir_update_property_zval_zval(this_ptr, &key, &value); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_11$$6, &properties, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_11$$6)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &properties, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &properties, "current", NULL, 0); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &key, &value); + ZEPHIR_CALL_METHOD(NULL, &properties, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + } else { + ZEPHIR_INIT_NVAR(&properties); + array_init(&properties); + } + ZEPHIR_OBS_VAR(&dirtyState); + if (zephir_array_isset_string_fetch(&dirtyState, &data, SL("dirtyState"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &dirtyState); + } + ZEPHIR_CALL_METHOD(&_5, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); zephir_check_call_status(); + if (zephir_is_true(&_5)) { + if (zephir_array_isset_string_fetch(&snapshot, &data, SL("snapshot"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &properties); + } + } ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, notice) +static PHP_METHOD(Phalcon_Mvc_Model, addBehavior) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zval *behavior, behavior_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); + ZVAL_UNDEF(&behavior_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(behavior, phalcon_mvc_model_behaviorinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + zephir_fetch_params(1, 1, 0, &behavior); - ZVAL_LONG(&_0, 5); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "addbehavior", NULL, 0, this_ptr, behavior); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, warning) +static PHP_METHOD(Phalcon_Mvc_Model, appendMessage) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval context; - zval *message_param = NULL, *context_param = NULL, _0; - zval message; + zval *message, message_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&context); + ZVAL_UNDEF(&message_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(message) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(message, phalcon_messages_messageinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &message); - ZVAL_LONG(&_0, 4); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "log", NULL, 0, &_0, &message, &context); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_array_append(this_ptr, SL("errorMessages"), message); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_MemoryLogger, log) +static PHP_METHOD(Phalcon_Mvc_Model, assign) { - zend_string *_3; - zend_ulong _2; + zend_bool _7$$12, _14$$18, _17$$22, _22$$28; + zend_string *_3$$3; + zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_9 = NULL, *_13 = NULL, *_16 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval context, replace; - zval message; - zval *level, level_sub, *message_param = NULL, *context_param = NULL, key, value, *_0, _1, _6, _4$$3, _5$$4; + zval *data_param = NULL, *whiteList = NULL, whiteList_sub, *dataColumnMap = NULL, dataColumnMap_sub, __$null, key, keyMapped, value, attribute, attributeField, metaData, columnMap, disableAssignSetters, _4, *_5, _6, *_0$$3, _1$$3, _8$$13, _10$$16, _11$$16, _12$$16, _15$$18, _18$$23, _19$$26, _20$$26, _21$$26, _23$$28; + zval data, dataMapped; zval *this_ptr = getThis(); - ZVAL_UNDEF(&level_sub); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&dataMapped); + ZVAL_UNDEF(&whiteList_sub); + ZVAL_UNDEF(&dataColumnMap_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&key); + ZVAL_UNDEF(&keyMapped); ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&disableAssignSetters); + ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&context); - ZVAL_UNDEF(&replace); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_8$$13); + ZVAL_UNDEF(&_10$$16); + ZVAL_UNDEF(&_11$$16); + ZVAL_UNDEF(&_12$$16); + ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&_18$$23); + ZVAL_UNDEF(&_19$$26); + ZVAL_UNDEF(&_20$$26); + ZVAL_UNDEF(&_21$$26); + ZVAL_UNDEF(&_23$$28); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_ZVAL(level) - Z_PARAM_STR(message) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_ARRAY(data) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(context) + Z_PARAM_ZVAL_OR_NULL(whiteList) + Z_PARAM_ZVAL_OR_NULL(dataColumnMap) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &level, &message_param, &context_param); - zephir_get_strval(&message, message_param); - if (!context_param) { - ZEPHIR_INIT_VAR(&context); - array_init(&context); - } else { - zephir_get_arrval(&context, context_param); + zephir_fetch_params(1, 1, 2, &data_param, &whiteList, &dataColumnMap); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!whiteList) { + whiteList = &whiteList_sub; + whiteList = &__$null; + } + if (!dataColumnMap) { + dataColumnMap = &dataColumnMap_sub; + dataColumnMap = &__$null; } - ZEPHIR_INIT_VAR(&replace); - array_init(&replace); - zephir_is_iterable(&context, 0, "phalcon/DataMapper/Pdo/Profiler/MemoryLogger.zep", 170); - if (Z_TYPE_P(&context) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&context), _2, _3, _0) + ZEPHIR_INIT_VAR(&disableAssignSetters); + ZVAL_BOOL(&disableAssignSetters, ZEPHIR_GLOBAL(orm).disable_assign_setters); + if (Z_TYPE_P(dataColumnMap) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&dataMapped); + array_init(&dataMapped); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 749); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2$$3, _3$$3, _0$$3) + { + ZEPHIR_INIT_NVAR(&key); + if (_3$$3 != NULL) { + ZVAL_STR_COPY(&key, _3$$3); + } else { + ZVAL_LONG(&key, _2$$3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0$$3); + ZEPHIR_OBS_NVAR(&keyMapped); + if (zephir_array_isset_fetch(&keyMapped, dataColumnMap, &key, 0)) { + zephir_array_update_zval(&dataMapped, &keyMapped, &value, PH_COPY | PH_SEPARATE); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&keyMapped); + if (zephir_array_isset_fetch(&keyMapped, dataColumnMap, &key, 0)) { + zephir_array_update_zval(&dataMapped, &keyMapped, &value, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + } else { + ZEPHIR_CPY_WRT(&dataMapped, &data); + } + if (zephir_fast_count_int(&dataMapped) == 0) { + RETURN_THIS(); + } + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); + } + ZEPHIR_CALL_METHOD(&_4, &metaData, "getattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + zephir_is_iterable(&_4, 0, "phalcon/Mvc/Model.zep", 806); + if (Z_TYPE_P(&_4) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_4), _5) { - ZEPHIR_INIT_NVAR(&key); - if (_3 != NULL) { - ZVAL_STR_COPY(&key, _3); + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _5); + _7$$12 = !(zephir_array_isset(&columnMap, &attribute)); + if (_7$$12) { + _7$$12 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_7$$12) { + ZEPHIR_CALL_SELF(&_8$$13, "caseinsensitivecolumnmap", &_9, 422, &columnMap, &attribute); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&attribute, &_8$$13); + } + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_10$$16); + object_init_ex(&_10$$16, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$16); + zephir_get_class(&_11$$16, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_12$$16); + ZEPHIR_CONCAT_SVSVS(&_12$$16, "Column '", &attribute, "' doesn't make part of the column map in '", &_11$$16, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$16, "__construct", &_13, 32, &_12$$16); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$16, "phalcon/Mvc/Model.zep", 780); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } } else { - ZVAL_LONG(&key, _2); + ZEPHIR_CPY_WRT(&attributeField, &attribute); + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_array_isset_fetch(&value, &dataMapped, &attributeField, 0)) { + if (Z_TYPE_P(whiteList) == IS_ARRAY) { + if (!(zephir_fast_in_array(&attributeField, whiteList))) { + continue; + } + } + _14$$18 = zephir_is_true(&disableAssignSetters); + if (!(_14$$18)) { + ZEPHIR_CALL_METHOD(&_15$$18, this_ptr, "possiblesetter", &_16, 421, &attributeField, &value); + zephir_check_call_status(); + _14$$18 = !zephir_is_true(&_15$$18); + } + if (_14$$18) { + zephir_update_property_zval_zval(this_ptr, &attributeField, &value); + } } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - ZEPHIR_INIT_NVAR(&_4$$3); - ZEPHIR_CONCAT_SVS(&_4$$3, "{", &key, "}"); - zephir_array_update_zval(&replace, &_4$$3, &value, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &context, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_4, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &context, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_6, &_4, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!zend_is_true(&_6)) { break; } - ZEPHIR_CALL_METHOD(&key, &context, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &context, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&attribute, &_4, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_5$$4); - ZEPHIR_CONCAT_SVS(&_5$$4, "{", &key, "}"); - zephir_array_update_zval(&replace, &_5$$4, &value, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &context, "next", NULL, 0); + _17$$22 = !(zephir_array_isset(&columnMap, &attribute)); + if (_17$$22) { + _17$$22 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_17$$22) { + ZEPHIR_CALL_SELF(&_18$$23, "caseinsensitivecolumnmap", &_9, 422, &columnMap, &attribute); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&attribute, &_18$$23); + } + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_19$$26); + object_init_ex(&_19$$26, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$26); + zephir_get_class(&_20$$26, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_21$$26); + ZEPHIR_CONCAT_SVSVS(&_21$$26, "Column '", &attribute, "' doesn't make part of the column map in '", &_20$$26, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$26, "__construct", &_13, 32, &_21$$26); + zephir_check_call_status(); + zephir_throw_exception_debug(&_19$$26, "phalcon/Mvc/Model.zep", 780); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &attribute); + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_array_isset_fetch(&value, &dataMapped, &attributeField, 0)) { + if (Z_TYPE_P(whiteList) == IS_ARRAY) { + if (!(zephir_fast_in_array(&attributeField, whiteList))) { + continue; + } + } + _22$$28 = zephir_is_true(&disableAssignSetters); + if (!(_22$$28)) { + ZEPHIR_CALL_METHOD(&_23$$28, this_ptr, "possiblesetter", &_16, 421, &attributeField, &value); + zephir_check_call_status(); + _22$$28 = !zephir_is_true(&_23$$28); + } + if (_22$$28) { + zephir_update_property_zval_zval(this_ptr, &attributeField, &value); + } + } + ZEPHIR_CALL_METHOD(NULL, &_4, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_CALL_FUNCTION(&_6, "strtr", NULL, 5, &message, &replace); - zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("messages"), &_6); - ZEPHIR_MM_RESTORE(); -} - -zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_MemoryLogger(zend_class_entry *class_type) -{ - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("messages"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("messages"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_Profiler) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\DataMapper\\Pdo\\Profiler, Profiler, phalcon, datamapper_pdo_profiler_profiler, phalcon_datamapper_pdo_profiler_profiler_method_entry, 0); - - zend_declare_property_bool(phalcon_datamapper_pdo_profiler_profiler_ce, SL("active"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_profiler_profiler_ce, SL("context"), ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logFormat"), "", ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logLevel"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_datamapper_pdo_profiler_profiler_ce, SL("logger"), ZEND_ACC_PROTECTED); - phalcon_datamapper_pdo_profiler_profiler_ce->create_object = zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_Profiler; - - zend_class_implements(phalcon_datamapper_pdo_profiler_profiler_ce, 1, phalcon_datamapper_pdo_profiler_profilerinterface_ce); - return SUCCESS; + ZEPHIR_INIT_NVAR(&attribute); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, __construct) +static PHP_METHOD(Phalcon_Mvc_Model, average) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *logger = NULL, logger_sub, __$null, _0, _1; + zval *parameters_param = NULL, result, _0, _1; + zval parameters; zval *this_ptr = getThis(); - ZVAL_UNDEF(&logger_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(¶meters); + ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(logger, phalcon_logger_loggerinterface_ce) + Z_PARAM_ARRAY(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &logger); - if (!logger) { - logger = &logger_sub; - ZEPHIR_CPY_WRT(logger, &__$null); + zephir_fetch_params(1, 0, 1, ¶meters_param); + if (!parameters_param) { + ZEPHIR_INIT_VAR(¶meters); + array_init(¶meters); } else { - ZEPHIR_SEPARATE_PARAM(logger); + zephir_get_arrval(¶meters, parameters_param); } - if (Z_TYPE_P(logger) == IS_NULL) { - ZEPHIR_INIT_NVAR(logger); - object_init_ex(logger, phalcon_datamapper_pdo_profiler_memorylogger_ce); - if (zephir_has_constructor(logger)) { - ZEPHIR_CALL_METHOD(NULL, logger, "__construct", NULL, 0); - zephir_check_call_status(); - } - - } ZEPHIR_INIT_VAR(&_0); - ZEPHIR_INIT_NVAR(&_0); - ZVAL_STRING(&_0, "{method} ({duration}s): {statement} {backtrace}"); - zephir_update_property_zval(this_ptr, ZEND_STRL("logFormat"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_1); - ZVAL_LONG(&_1, 7); - zephir_update_property_zval(this_ptr, ZEND_STRL("logLevel"), &_1); - zephir_update_property_zval(this_ptr, ZEND_STRL("logger"), logger); - ZEPHIR_MM_RESTORE(); + ZVAL_STRING(&_0, "AVG"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "average"); + ZEPHIR_CALL_SELF(&result, "groupresult", NULL, 0, &_0, &_1, ¶meters); + zephir_check_call_status(); + if (Z_TYPE_P(&result) == IS_STRING) { + RETURN_MM_DOUBLE(zephir_get_doubleval(&result)); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, finish) +static PHP_METHOD(Phalcon_Mvc_Model, cloneResult) { + zend_string *_4; + zend_ulong _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *statement_param = NULL, *values_param = NULL, __$true, ex, finish, _0, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3, _12$$3, _13$$3, _14$$3; - zval statement; + zephir_fcall_cache_entry *_8 = NULL; + zend_long dirtyState, ZEPHIR_LAST_CALL_STATUS; + zval data; + zval *base, base_sub, *data_param = NULL, *dirtyState_param = NULL, instance, key, value, _0, *_1, _2, _12, _5$$4, _6$$4, _7$$4, _9$$6, _10$$6, _11$$6; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&ex); - ZVAL_UNDEF(&finish); + ZVAL_UNDEF(&base_sub); + ZVAL_UNDEF(&instance); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_14$$3); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&data); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 2) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_OBJECT_OF_CLASS(base, phalcon_mvc_modelinterface_ce) + Z_PARAM_ARRAY(data) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(statement) - Z_PARAM_ARRAY(values) + Z_PARAM_LONG(dirtyState) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, &statement_param, &values_param); - if (!statement_param) { - ZEPHIR_INIT_VAR(&statement); - } else { - zephir_get_strval(&statement, statement_param); - } - if (!values_param) { - ZEPHIR_INIT_VAR(&values); - array_init(&values); + zephir_fetch_params(1, 2, 1, &base, &data_param, &dirtyState_param); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!dirtyState_param) { + dirtyState = 0; } else { - zephir_get_arrval(&values, values_param); + dirtyState = zephir_get_intval(dirtyState_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("active"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(zephir_is_true(&_0))) { - ZEPHIR_INIT_VAR(&ex); - object_init_ex(&ex, phalcon_datamapper_pdo_exception_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 29); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&finish, "hrtime", NULL, 201, &__$true); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, &ex, "gettraceasstring", NULL, 202); + ZEPHIR_INIT_VAR(&instance); + if (zephir_clone(&instance, base) == FAILURE) { + RETURN_MM(); + } + ZVAL_LONG(&_0, dirtyState); + ZEPHIR_CALL_METHOD(NULL, &instance, "setdirtystate", NULL, 0, &_0); + zephir_check_call_status(); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 896); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&key); + if (_4 != NULL) { + ZVAL_STR_COPY(&key, _4); + } else { + ZVAL_LONG(&key, _3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1); + if (UNEXPECTED(Z_TYPE_P(&key) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_5$$4); + object_init_ex(&_5$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_6$$4); + zephir_get_class(&_6$$4, base, 0); + ZEPHIR_INIT_NVAR(&_7$$4); + ZEPHIR_CONCAT_SVS(&_7$$4, "Invalid key in array data provided to dumpResult() in '", &_6$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", &_8, 32, &_7$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_5$$4, "phalcon/Mvc/Model.zep", 886); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval_zval(&instance, &key, &value); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "backtrace"); - zephir_update_property_array(this_ptr, SL("context"), &_2$$3, &_1$$3); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_string(&_4$$3, &_3$$3, SL("start"), PH_NOISY | PH_READONLY, "phalcon/DataMapper/Pdo/Profiler/Profiler.zep", 85); - ZEPHIR_INIT_VAR(&_5$$3); - zephir_sub_function(&_5$$3, &finish, &_4$$3); - ZEPHIR_INIT_VAR(&_6$$3); - ZVAL_STRING(&_6$$3, "duration"); - zephir_update_property_array(this_ptr, SL("context"), &_6$$3, &_5$$3); - ZEPHIR_INIT_VAR(&_7$$3); - ZVAL_STRING(&_7$$3, "finish"); - zephir_update_property_array(this_ptr, SL("context"), &_7$$3, &finish); - ZEPHIR_INIT_VAR(&_8$$3); - ZVAL_STRING(&_8$$3, "statement"); - zephir_update_property_array(this_ptr, SL("context"), &_8$$3, &statement); - ZEPHIR_INIT_NVAR(&_5$$3); - if (ZEPHIR_IS_EMPTY(&values)) { - ZEPHIR_INIT_NVAR(&_5$$3); - ZVAL_STRING(&_5$$3, ""); - } else { - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "encode", NULL, 203, &values); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&key) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_9$$6); + object_init_ex(&_9$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_10$$6); + zephir_get_class(&_10$$6, base, 0); + ZEPHIR_INIT_NVAR(&_11$$6); + ZEPHIR_CONCAT_SVS(&_11$$6, "Invalid key in array data provided to dumpResult() in '", &_10$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_9$$6, "__construct", &_8, 32, &_11$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_9$$6, "phalcon/Mvc/Model.zep", 886); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval_zval(&instance, &key, &value); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); zephir_check_call_status(); } - ZEPHIR_INIT_VAR(&_9$$3); - ZVAL_STRING(&_9$$3, "values"); - zephir_update_property_array(this_ptr, SL("context"), &_9$$3, &_5$$3); - zephir_read_property(&_10$$3, this_ptr, ZEND_STRL("logger"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_11$$3, this_ptr, ZEND_STRL("logLevel"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_12$$3, this_ptr, ZEND_STRL("logFormat"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_13$$3, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &_10$$3, "log", NULL, 0, &_11$$3, &_12$$3, &_13$$3); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_14$$3); - array_init(&_14$$3); - zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &_14$$3); } - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogFormat) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "logFormat"); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + ZEPHIR_INIT_VAR(&_12); + ZVAL_STRING(&_12, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_12); + zephir_check_call_status(); + RETURN_CCTOR(&instance); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogger) +static PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) { + zend_string *_4; + zend_ulong _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_9 = NULL, *_16 = NULL; + zend_bool keepSnapshots, _5$$6, _13$$3, _18$$24, _25$$21; + zend_long dirtyState, ZEPHIR_LAST_CALL_STATUS; + zval data; + zval *base, base_sub, *data_param = NULL, *columnMap, columnMap_sub, *dirtyState_param = NULL, *keepSnapshots_param = NULL, instance, attribute, key, value, castValue, attributeName, metaData, reverseMap, _0, *_1, _2, _6$$9, _7$$9, _8$$9, _10$$11, _11$$11, _12$$11, _14$$13, _15$$14, _17$$18, _19$$27, _20$$27, _21$$27, _22$$29, _23$$29, _24$$29, _26$$31, _27$$32, _28$$36, _29$$40; zval *this_ptr = getThis(); + ZVAL_UNDEF(&base_sub); + ZVAL_UNDEF(&columnMap_sub); + ZVAL_UNDEF(&instance); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&castValue); + ZVAL_UNDEF(&attributeName); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&reverseMap); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_6$$9); + ZVAL_UNDEF(&_7$$9); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&_11$$11); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$14); + ZVAL_UNDEF(&_17$$18); + ZVAL_UNDEF(&_19$$27); + ZVAL_UNDEF(&_20$$27); + ZVAL_UNDEF(&_21$$27); + ZVAL_UNDEF(&_22$$29); + ZVAL_UNDEF(&_23$$29); + ZVAL_UNDEF(&_24$$29); + ZVAL_UNDEF(&_26$$31); + ZVAL_UNDEF(&_27$$32); + ZVAL_UNDEF(&_28$$36); + ZVAL_UNDEF(&_29$$40); + ZVAL_UNDEF(&data); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_ZVAL(base) + Z_PARAM_ARRAY(data) + Z_PARAM_ZVAL(columnMap) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(dirtyState) + Z_PARAM_BOOL_OR_NULL(keepSnapshots, is_null_true) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "logger"); -} - -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, getLogLevel) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 2, &base, &data_param, &columnMap, &dirtyState_param, &keepSnapshots_param); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!dirtyState_param) { + dirtyState = 0; + } else { + dirtyState = zephir_get_intval(dirtyState_param); + } + if (!keepSnapshots_param) { + keepSnapshots = 0; + } else { + keepSnapshots = zephir_get_boolval(keepSnapshots_param); + } - RETURN_MEMBER(getThis(), "logLevel"); -} + ZEPHIR_INIT_VAR(&instance); + if (zephir_clone(&instance, base) == FAILURE) { + RETURN_MM(); + } + ZVAL_LONG(&_0, dirtyState); + ZEPHIR_CALL_METHOD(NULL, &instance, "setdirtystate", NULL, 0, &_0); + zephir_check_call_status(); + zephir_is_iterable(&data, 1, "phalcon/Mvc/Model.zep", 1029); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&key); + if (_4 != NULL) { + ZVAL_STR_COPY(&key, _4); + } else { + ZVAL_LONG(&key, _3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + zephir_update_property_zval_zval(&instance, &key, &value); + continue; + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + _5$$6 = Z_TYPE_P(columnMap) == IS_ARRAY; + if (_5$$6) { + _5$$6 = !(ZEPHIR_IS_EMPTY(columnMap)); + } + if (_5$$6) { + ZEPHIR_CALL_METHOD(&metaData, &instance, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&reverseMap, &metaData, "getreversecolumnmap", NULL, 0, &instance); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, &reverseMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_6$$9); + object_init_ex(&_6$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_7$$9); + zephir_get_class(&_7$$9, base, 0); + ZEPHIR_INIT_NVAR(&_8$$9); + ZEPHIR_CONCAT_SVSVS(&_8$$9, "Column '", &key, "' doesn't make part of the column map in '", &_7$$9, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$9, "__construct", &_9, 32, &_8$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$9, "phalcon/Mvc/Model.zep", 956); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } else { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_10$$11); + object_init_ex(&_10$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$11); + zephir_get_class(&_11$$11, base, 0); + ZEPHIR_INIT_NVAR(&_12$$11); + ZEPHIR_CONCAT_SVSVS(&_12$$11, "Column '", &key, "' doesn't make part of the column map in '", &_11$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$11, "__construct", &_9, 32, &_12$$11); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$11, "phalcon/Mvc/Model.zep", 965); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + if (Z_TYPE_P(&attribute) != IS_ARRAY) { + zephir_update_property_zval_zval(&instance, &attribute, &value); + continue; + } + _13$$3 = !ZEPHIR_IS_STRING(&value, ""); + if (_13$$3) { + _13$$3 = Z_TYPE_P(&value) != IS_NULL; + } + if (_13$$3) { + zephir_array_fetch_long(&_14$$13, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); + do { + if (ZEPHIR_IS_LONG(&_14$$13, 0) || ZEPHIR_IS_LONG(&_14$$13, 21) || ZEPHIR_IS_LONG(&_14$$13, 22) || ZEPHIR_IS_LONG(&_14$$13, 26)) { + ZVAL_LONG(&_15$$14, 10); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_16, 41, &value, &_15$$14); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(&_14$$13, 3) || ZEPHIR_IS_LONG(&_14$$13, 9) || ZEPHIR_IS_LONG(&_14$$13, 7)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_DOUBLE(&castValue, zephir_get_doubleval(&value)); + break; + } + if (ZEPHIR_IS_LONG(&_14$$13, 8)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); + break; + } + ZEPHIR_CPY_WRT(&castValue, &value); + break; + } while(0); -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, isActive) -{ - zval *this_ptr = getThis(); + } else { + zephir_array_fetch_long(&_17$$18, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); + do { + if (ZEPHIR_IS_LONG(&_17$$18, 14) || ZEPHIR_IS_LONG(&_17$$18, 8) || ZEPHIR_IS_LONG(&_17$$18, 3) || ZEPHIR_IS_LONG(&_17$$18, 9) || ZEPHIR_IS_LONG(&_17$$18, 7) || ZEPHIR_IS_LONG(&_17$$18, 0) || ZEPHIR_IS_LONG(&_17$$18, 21) || ZEPHIR_IS_LONG(&_17$$18, 22) || ZEPHIR_IS_LONG(&_17$$18, 26)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_NULL(&castValue); + break; + } + ZEPHIR_CPY_WRT(&castValue, &value); + break; + } while(0); + } + ZEPHIR_OBS_NVAR(&attributeName); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1021); + zephir_update_property_zval_zval(&instance, &attributeName, &castValue); + zephir_array_update_zval(&data, &key, &castValue, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + zephir_update_property_zval_zval(&instance, &key, &value); + continue; + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + _18$$24 = Z_TYPE_P(columnMap) == IS_ARRAY; + if (_18$$24) { + _18$$24 = !(ZEPHIR_IS_EMPTY(columnMap)); + } + if (_18$$24) { + ZEPHIR_CALL_METHOD(&metaData, &instance, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&reverseMap, &metaData, "getreversecolumnmap", NULL, 0, &instance); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, &reverseMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_19$$27); + object_init_ex(&_19$$27, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$27); + zephir_get_class(&_20$$27, base, 0); + ZEPHIR_INIT_NVAR(&_21$$27); + ZEPHIR_CONCAT_SVSVS(&_21$$27, "Column '", &key, "' doesn't make part of the column map in '", &_20$$27, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$27, "__construct", &_9, 32, &_21$$27); + zephir_check_call_status(); + zephir_throw_exception_debug(&_19$$27, "phalcon/Mvc/Model.zep", 956); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } else { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_22$$29); + object_init_ex(&_22$$29, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_23$$29); + zephir_get_class(&_23$$29, base, 0); + ZEPHIR_INIT_NVAR(&_24$$29); + ZEPHIR_CONCAT_SVSVS(&_24$$29, "Column '", &key, "' doesn't make part of the column map in '", &_23$$29, "'"); + ZEPHIR_CALL_METHOD(NULL, &_22$$29, "__construct", &_9, 32, &_24$$29); + zephir_check_call_status(); + zephir_throw_exception_debug(&_22$$29, "phalcon/Mvc/Model.zep", 965); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + if (Z_TYPE_P(&attribute) != IS_ARRAY) { + zephir_update_property_zval_zval(&instance, &attribute, &value); + continue; + } + _25$$21 = !ZEPHIR_IS_STRING(&value, ""); + if (_25$$21) { + _25$$21 = Z_TYPE_P(&value) != IS_NULL; + } + if (_25$$21) { + zephir_array_fetch_long(&_26$$31, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 979); + do { + if (ZEPHIR_IS_LONG(&_26$$31, 0) || ZEPHIR_IS_LONG(&_26$$31, 21) || ZEPHIR_IS_LONG(&_26$$31, 22) || ZEPHIR_IS_LONG(&_26$$31, 26)) { + ZVAL_LONG(&_27$$32, 10); + ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_16, 41, &value, &_27$$32); + zephir_check_call_status(); + break; + } + if (ZEPHIR_IS_LONG(&_26$$31, 3) || ZEPHIR_IS_LONG(&_26$$31, 9) || ZEPHIR_IS_LONG(&_26$$31, 7)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_DOUBLE(&castValue, zephir_get_doubleval(&value)); + break; + } + if (ZEPHIR_IS_LONG(&_26$$31, 8)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); + break; + } + ZEPHIR_CPY_WRT(&castValue, &value); + break; + } while(0); + } else { + zephir_array_fetch_long(&_28$$36, &attribute, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1002); + do { + if (ZEPHIR_IS_LONG(&_28$$36, 14) || ZEPHIR_IS_LONG(&_28$$36, 8) || ZEPHIR_IS_LONG(&_28$$36, 3) || ZEPHIR_IS_LONG(&_28$$36, 9) || ZEPHIR_IS_LONG(&_28$$36, 7) || ZEPHIR_IS_LONG(&_28$$36, 0) || ZEPHIR_IS_LONG(&_28$$36, 21) || ZEPHIR_IS_LONG(&_28$$36, 22) || ZEPHIR_IS_LONG(&_28$$36, 26)) { + ZEPHIR_INIT_NVAR(&castValue); + ZVAL_NULL(&castValue); + break; + } + ZEPHIR_CPY_WRT(&castValue, &value); + break; + } while(0); - RETURN_MEMBER(getThis(), "active"); + } + ZEPHIR_OBS_NVAR(&attributeName); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1021); + zephir_update_property_zval_zval(&instance, &attributeName, &castValue); + zephir_array_update_zval(&data, &key, &castValue, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + if (keepSnapshots) { + ZEPHIR_CALL_METHOD(NULL, &instance, "setsnapshotdata", NULL, 0, &data, columnMap); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &instance, "setoldsnapshotdata", NULL, 0, &data, columnMap); + zephir_check_call_status(); + } + if ((zephir_method_exists_ex(&instance, ZEND_STRL("fireevent")) == SUCCESS)) { + ZEPHIR_INIT_VAR(&_29$$40); + ZVAL_STRING(&_29$$40, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, &instance, "fireevent", NULL, 0, &_29$$40); + zephir_check_call_status(); + } + RETURN_CCTOR(&instance); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setActive) +static PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) { - zval *active_param = NULL, __$true, __$false; - zend_bool active; + zend_bool _4$$7, _10$$16; + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_9 = NULL; + zend_long hydrationMode, ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *columnMap, columnMap_sub, *hydrationMode_param = NULL, key, value, attribute, attributeName, *_0, _1, _5$$8, _7$$10, _8$$10, _11$$17, _12$$19, _13$$19; + zval data, hydrateArray; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&hydrateArray); + ZVAL_UNDEF(&columnMap_sub); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&attributeName); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$8); + ZVAL_UNDEF(&_7$$10); + ZVAL_UNDEF(&_8$$10); + ZVAL_UNDEF(&_11$$17); + ZVAL_UNDEF(&_12$$19); + ZVAL_UNDEF(&_13$$19); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_BOOL(active) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_ARRAY(data) + Z_PARAM_ZVAL(columnMap) + Z_PARAM_LONG(hydrationMode) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &active_param); - active = zephir_get_boolval(active_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &data_param, &columnMap, &hydrationMode_param); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + hydrationMode = zephir_get_intval(hydrationMode_param); - if (active) { - zephir_update_property_zval(this_ptr, ZEND_STRL("active"), &__$true); + if (Z_TYPE_P(columnMap) != IS_ARRAY) { + if (hydrationMode == 1) { + RETURN_CTOR(&data); + } + } + ZEPHIR_INIT_VAR(&hydrateArray); + array_init(&hydrateArray); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 1116); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&key); + if (_3 != NULL) { + ZVAL_STR_COPY(&key, _3); + } else { + ZVAL_LONG(&key, _2); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + _4$$7 = !(zephir_array_isset(columnMap, &key)); + if (_4$$7) { + _4$$7 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_4$$7) { + ZEPHIR_CALL_SELF(&_5$$8, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&key, &_5$$8); + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_7$$10); + object_init_ex(&_7$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_8$$10); + ZEPHIR_CONCAT_SVS(&_8$$10, "Column '", &key, "' doesn't make part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_7$$10, "__construct", &_9, 32, &_8$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(&_7$$10, "phalcon/Mvc/Model.zep", 1095); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeName); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1105); + } else { + ZEPHIR_CPY_WRT(&attributeName, &attribute); + } + zephir_array_update_zval(&hydrateArray, &attributeName, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&hydrateArray, &key, &value, PH_COPY | PH_SEPARATE); + } + } ZEND_HASH_FOREACH_END(); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("active"), &__$false); + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + _10$$16 = !(zephir_array_isset(columnMap, &key)); + if (_10$$16) { + _10$$16 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_10$$16) { + ZEPHIR_CALL_SELF(&_11$$17, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&key, &_11$$17); + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_12$$19); + object_init_ex(&_12$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_13$$19); + ZEPHIR_CONCAT_SVS(&_13$$19, "Column '", &key, "' doesn't make part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_12$$19, "__construct", &_9, 32, &_13$$19); + zephir_check_call_status(); + zephir_throw_exception_debug(&_12$$19, "phalcon/Mvc/Model.zep", 1095); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeName); + zephir_array_fetch_long(&attributeName, &attribute, 0, PH_NOISY, "phalcon/Mvc/Model.zep", 1105); + } else { + ZEPHIR_CPY_WRT(&attributeName, &attribute); + } + zephir_array_update_zval(&hydrateArray, &attributeName, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&hydrateArray, &key, &value, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } } - RETURN_THISW(); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + if (hydrationMode != 1) { + zephir_convert_to_object(&hydrateArray); + RETURN_CTOR(&hydrateArray); + } + RETURN_CTOR(&hydrateArray); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setLogFormat) +static PHP_METHOD(Phalcon_Mvc_Model, collectRelatedToSave) { + zend_bool _6$$3, _8$$6; + zend_string *_5; + zend_ulong _4; + zval related, dirtyRelated; + zval name, record, _0, _1, *_2, _3, _7$$3, _9$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *logFormat_param = NULL; - zval logFormat; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&logFormat); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(logFormat) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&record); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&related); + ZVAL_UNDEF(&dirtyRelated); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &logFormat_param); - zephir_get_strval(&logFormat, logFormat_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("logFormat"), &logFormat); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&related, &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dirtyRelated, &_1); + zephir_is_iterable(&related, 0, "phalcon/Mvc/Model.zep", 1157); + if (Z_TYPE_P(&related) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&related), _4, _5, _2) + { + ZEPHIR_INIT_NVAR(&name); + if (_5 != NULL) { + ZVAL_STR_COPY(&name, _5); + } else { + ZVAL_LONG(&name, _4); + } + ZEPHIR_INIT_NVAR(&record); + ZVAL_COPY(&record, _2); + if (zephir_array_isset(&dirtyRelated, &name)) { + continue; + } + _6$$3 = Z_TYPE_P(&record) != IS_OBJECT; + if (!(_6$$3)) { + _6$$3 = !((zephir_instance_of_ev(&record, phalcon_mvc_modelinterface_ce))); + } + if (_6$$3) { + continue; + } + ZVAL_LONG(&_7$$3, 1); + ZEPHIR_CALL_METHOD(NULL, &record, "setdirtystate", NULL, 0, &_7$$3); + zephir_check_call_status(); + zephir_array_update_zval(&dirtyRelated, &name, &record, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &related, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &related, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&name, &related, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&record, &related, "current", NULL, 0); + zephir_check_call_status(); + if (zephir_array_isset(&dirtyRelated, &name)) { + continue; + } + _8$$6 = Z_TYPE_P(&record) != IS_OBJECT; + if (!(_8$$6)) { + _8$$6 = !((zephir_instance_of_ev(&record, phalcon_mvc_modelinterface_ce))); + } + if (_8$$6) { + continue; + } + ZVAL_LONG(&_9$$6, 1); + ZEPHIR_CALL_METHOD(NULL, &record, "setdirtystate", NULL, 0, &_9$$6); + zephir_check_call_status(); + zephir_array_update_zval(&dirtyRelated, &name, &record, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &related, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&record); + ZEPHIR_INIT_NVAR(&name); + RETURN_CTOR(&dirtyRelated); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, setLogLevel) +static PHP_METHOD(Phalcon_Mvc_Model, count) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *logLevel_param = NULL; - zval logLevel; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *parameters = NULL, parameters_sub, __$null, result, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&logLevel); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(logLevel) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &logLevel_param); - zephir_get_strval(&logLevel, logLevel_param); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } - zephir_update_property_zval(this_ptr, ZEND_STRL("logLevel"), &logLevel); - RETURN_THIS(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "COUNT"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "rowcount"); + ZEPHIR_CALL_SELF(&result, "groupresult", NULL, 0, &_0, &_1, parameters); + zephir_check_call_status(); + if (Z_TYPE_P(&result) == IS_STRING) { + RETURN_MM_LONG(zephir_get_intval(&result)); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, start) +static PHP_METHOD(Phalcon_Mvc_Model, create) { - zval _1$$3; + zval _2$$3, _4$$3; + zval metaData, _0, _1, _3$$3, _5$$3, _6$$3, _7$$3, _8$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *method_param = NULL, __$true, _0, _2$$3; - zval method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&method); - ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&metaData); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$3); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(method) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_4$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &method_param); - zephir_get_strval(&method, method_param); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("active"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(zephir_is_true(&_0))) { - ZEPHIR_INIT_VAR(&_1$$3); - zephir_create_array(&_1$$3, 2, 0); - zephir_array_update_string(&_1$$3, SL("method"), &method, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(&_2$$3, "hrtime", NULL, 201, &__$true); + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getwriteconnection", NULL, 423); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &metaData, &_1); + zephir_check_call_status(); + if (zephir_is_true(&_0)) { + ZEPHIR_INIT_VAR(&_2$$3); + zephir_create_array(&_2$$3, 1, 0); + ZEPHIR_INIT_VAR(&_3$$3); + object_init_ex(&_3$$3, phalcon_messages_message_ce); + ZEPHIR_INIT_VAR(&_4$$3); + zephir_create_array(&_4$$3, 1, 0); + ZEPHIR_INIT_VAR(&_5$$3); + zephir_get_class(&_5$$3, this_ptr, 0); + zephir_array_update_string(&_4$$3, SL("model"), &_5$$3, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_5$$3); + ZVAL_STRING(&_5$$3, "Record cannot be created because it already exists"); + ZVAL_NULL(&_6$$3); + ZEPHIR_INIT_VAR(&_7$$3); + ZVAL_STRING(&_7$$3, "InvalidCreateAttempt"); + ZVAL_LONG(&_8$$3, 0); + ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 6, &_5$$3, &_6$$3, &_7$$3, &_8$$3, &_4$$3); zephir_check_call_status(); - zephir_array_update_string(&_1$$3, SL("start"), &_2$$3, PH_COPY | PH_SEPARATE); - zephir_update_property_zval(this_ptr, ZEND_STRL("context"), &_1$$3); + zephir_array_fast_append(&_2$$3, &_3$$3); + zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_2$$3); + RETURN_MM_BOOL(0); } - ZEPHIR_MM_RESTORE(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "save", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_DataMapper_Pdo_Profiler_Profiler, encode) +static PHP_METHOD(Phalcon_Mvc_Model, delete) { + zval values, bindTypes, conditions; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long options, depth, ZEPHIR_LAST_CALL_STATUS; - zval *data, data_sub, *options_param = NULL, *depth_param = NULL, encoded, _0, _1, _2, _3$$3, _4$$3, _5$$3; + zval __$true, __$false, metaData, writeConnection, primaryKeys, bindDataTypes, columnMap, attributeField, primaryKey, bindType, value, schema, source, table, success, _0, _1, *_6, _7, _35, _2$$3, _3$$7, _4$$7, _5$$7, _8$$9, _9$$9, _10$$9, _11$$11, _12$$11, _13$$11, _14$$13, _15$$13, _16$$13, _17$$8, _19$$8, _20$$15, _21$$15, _22$$15, _23$$17, _24$$17, _25$$17, _26$$19, _27$$19, _28$$19, _29$$14, _31$$14, _32$$20, _33$$20, _34$$20, _36$$25, _37$$28, _38$$29, _39$$29; + zephir_fcall_cache_entry *_18 = NULL, *_30 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&encoded); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&writeConnection); + ZVAL_UNDEF(&primaryKeys); + ZVAL_UNDEF(&bindDataTypes); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&primaryKey); + ZVAL_UNDEF(&bindType); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&source); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&success); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(data) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(options) - Z_PARAM_LONG(depth) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_35); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_9$$9); + ZVAL_UNDEF(&_10$$9); + ZVAL_UNDEF(&_11$$11); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_13$$11); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$13); + ZVAL_UNDEF(&_16$$13); + ZVAL_UNDEF(&_17$$8); + ZVAL_UNDEF(&_19$$8); + ZVAL_UNDEF(&_20$$15); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_22$$15); + ZVAL_UNDEF(&_23$$17); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$17); + ZVAL_UNDEF(&_26$$19); + ZVAL_UNDEF(&_27$$19); + ZVAL_UNDEF(&_28$$19); + ZVAL_UNDEF(&_29$$14); + ZVAL_UNDEF(&_31$$14); + ZVAL_UNDEF(&_32$$20); + ZVAL_UNDEF(&_33$$20); + ZVAL_UNDEF(&_34$$20); + ZVAL_UNDEF(&_36$$25); + ZVAL_UNDEF(&_37$$28); + ZVAL_UNDEF(&_38$$29); + ZVAL_UNDEF(&_39$$29); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&conditions); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &data, &options_param, &depth_param); - if (!options_param) { - options = 0; + + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 423); + zephir_check_call_status(); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("operationMade"), &_0); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_1); + if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "checkforeignkeysreverserestrict", NULL, 424); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_2$$3)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_INIT_VAR(&values); + array_init(&values); + ZEPHIR_INIT_VAR(&bindTypes); + array_init(&bindTypes); + ZEPHIR_INIT_VAR(&conditions); + array_init(&conditions); + ZEPHIR_CALL_METHOD(&primaryKeys, &metaData, "getprimarykeyattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&bindDataTypes, &metaData, "getbindtypes", NULL, 0, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); } else { - options = zephir_get_intval(options_param); + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); } - if (!depth_param) { - depth = 512; + if (UNEXPECTED(!(zephir_fast_count_int(&primaryKeys)))) { + ZEPHIR_INIT_VAR(&_3$$7); + object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_4$$7); + zephir_get_class(&_4$$7, this_ptr, 0); + ZEPHIR_INIT_VAR(&_5$$7); + ZEPHIR_CONCAT_SVS(&_5$$7, "A primary key must be defined in the model in order to perform the operation in '", &_4$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", NULL, 32, &_5$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 1314); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 1363); + if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _6) + { + ZEPHIR_INIT_NVAR(&primaryKey); + ZVAL_COPY(&primaryKey, _6); + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &primaryKey, 0)))) { + ZEPHIR_INIT_NVAR(&_8$$9); + object_init_ex(&_8$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$9); + zephir_get_class(&_9$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$9); + ZEPHIR_CONCAT_SVSVS(&_10$$9, "Column '", &primaryKey, "' have not defined a bind data type in '", &_9$$9, "'"); + ZEPHIR_CALL_METHOD(NULL, &_8$$9, "__construct", NULL, 32, &_10$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(&_8$$9, "phalcon/Mvc/Model.zep", 1328); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &primaryKey, 0)))) { + ZEPHIR_INIT_NVAR(&_11$$11); + object_init_ex(&_11$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$11); + zephir_get_class(&_12$$11, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$11); + ZEPHIR_CONCAT_SVSVS(&_13$$11, "Column '", &primaryKey, "' isn't part of the column map in '", &_12$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$11, "__construct", NULL, 32, &_13$$11); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$11, "phalcon/Mvc/Model.zep", 1338); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &primaryKey); + } + ZEPHIR_OBS_NVAR(&value); + if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)))) { + ZEPHIR_INIT_NVAR(&_14$$13); + object_init_ex(&_14$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$13); + zephir_get_class(&_15$$13, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$13); + ZEPHIR_CONCAT_SVSVS(&_16$$13, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set in '", &_15$$13, "'"); + ZEPHIR_CALL_METHOD(NULL, &_14$$13, "__construct", NULL, 32, &_16$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(&_14$$13, "phalcon/Mvc/Model.zep", 1352); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1358); + ZEPHIR_CALL_METHOD(&_17$$8, &writeConnection, "escapeidentifier", &_18, 0, &primaryKey); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_19$$8); + ZEPHIR_CONCAT_VS(&_19$$8, &_17$$8, " = ?"); + zephir_array_append(&conditions, &_19$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1359); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1360); + } ZEND_HASH_FOREACH_END(); } else { - depth = zephir_get_intval(depth_param); + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_7, &primaryKeys, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_7)) { + break; + } + ZEPHIR_CALL_METHOD(&primaryKey, &primaryKeys, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &primaryKey, 0)))) { + ZEPHIR_INIT_NVAR(&_20$$15); + object_init_ex(&_20$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$15); + zephir_get_class(&_21$$15, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_22$$15); + ZEPHIR_CONCAT_SVSVS(&_22$$15, "Column '", &primaryKey, "' have not defined a bind data type in '", &_21$$15, "'"); + ZEPHIR_CALL_METHOD(NULL, &_20$$15, "__construct", NULL, 32, &_22$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(&_20$$15, "phalcon/Mvc/Model.zep", 1328); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &primaryKey, 0)))) { + ZEPHIR_INIT_NVAR(&_23$$17); + object_init_ex(&_23$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_24$$17); + zephir_get_class(&_24$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_25$$17); + ZEPHIR_CONCAT_SVSVS(&_25$$17, "Column '", &primaryKey, "' isn't part of the column map in '", &_24$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_23$$17, "__construct", NULL, 32, &_25$$17); + zephir_check_call_status(); + zephir_throw_exception_debug(&_23$$17, "phalcon/Mvc/Model.zep", 1338); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &primaryKey); + } + ZEPHIR_OBS_NVAR(&value); + if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)))) { + ZEPHIR_INIT_NVAR(&_26$$19); + object_init_ex(&_26$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_27$$19); + zephir_get_class(&_27$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_28$$19); + ZEPHIR_CONCAT_SVSVS(&_28$$19, "Cannot delete the record because the primary key attribute: '", &attributeField, "' was not set in '", &_27$$19, "'"); + ZEPHIR_CALL_METHOD(NULL, &_26$$19, "__construct", NULL, 32, &_28$$19); + zephir_check_call_status(); + zephir_throw_exception_debug(&_26$$19, "phalcon/Mvc/Model.zep", 1352); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1358); + ZEPHIR_CALL_METHOD(&_29$$14, &writeConnection, "escapeidentifier", &_30, 0, &primaryKey); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_31$$14); + ZEPHIR_CONCAT_VS(&_31$$14, &_29$$14, " = ?"); + zephir_array_append(&conditions, &_31$$14, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1359); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1360); + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); + zephir_check_call_status(); + } } - - - ZVAL_LONG(&_0, options); - ZVAL_LONG(&_1, depth); - ZEPHIR_INIT_VAR(&encoded); - zephir_json_encode(&encoded, data, zephir_get_intval(&_0) ); - ZEPHIR_CALL_FUNCTION(&_2, "json_last_error", NULL, 193); + ZEPHIR_INIT_NVAR(&primaryKey); + if (ZEPHIR_GLOBAL(orm).events) { + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$false); + } + ZEPHIR_INIT_VAR(&_33$$20); + ZVAL_STRING(&_33$$20, "beforeDelete"); + ZEPHIR_CALL_METHOD(&_32$$20, this_ptr, "fireeventcancel", NULL, 0, &_33$$20); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_32$$20)) { + RETURN_MM_BOOL(0); + } + zephir_read_property(&_34$$20, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_34$$20)) { + RETURN_MM_BOOL(1); + } + } + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); zephir_check_call_status(); - if (UNEXPECTED(!ZEPHIR_IS_LONG_IDENTICAL(&_2, 0))) { - ZEPHIR_INIT_VAR(&_3$$3); - object_init_ex(&_3$$3, spl_ce_InvalidArgumentException); - ZEPHIR_CALL_FUNCTION(&_4$$3, "json_last_error_msg", NULL, 194); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); + zephir_check_call_status(); + if (zephir_is_true(&schema)) { + ZEPHIR_INIT_VAR(&table); + zephir_create_array(&table, 2, 0); + zephir_array_fast_append(&table, &schema); + zephir_array_fast_append(&table, &source); + } else { + ZEPHIR_CPY_WRT(&table, &source); + } + ZEPHIR_INIT_VAR(&_35); + zephir_fast_join_str(&_35, SL(" AND "), &conditions); + ZEPHIR_CALL_METHOD(&success, &writeConnection, "delete", NULL, 0, &table, &_35, &values, &bindTypes); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { + ZEPHIR_CALL_METHOD(&_36$$25, this_ptr, "checkforeignkeysreversecascade", NULL, 427); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_5$$3); - ZEPHIR_CONCAT_SV(&_5$$3, "json_encode error: ", &_4$$3); - ZEPHIR_CALL_METHOD(NULL, &_3$$3, "__construct", NULL, 195, &_5$$3); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_36$$25)) { + RETURN_MM_BOOL(0); + } + } + if (ZEPHIR_GLOBAL(orm).events) { + if (zephir_is_true(&success)) { + ZEPHIR_INIT_VAR(&_37$$28); + ZVAL_STRING(&_37$$28, "afterDelete"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_37$$28); + zephir_check_call_status(); + } + } + if (zephir_is_true(&success)) { + ZEPHIR_INIT_VAR(&_38$$29); + array_init(&_38$$29); + zephir_update_property_zval(this_ptr, ZEND_STRL("related"), &_38$$29); + zephir_read_property(&_39$$29, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_39$$29, "clearreusableobjects", NULL, 0); zephir_check_call_status(); - zephir_throw_exception_debug(&_3$$3, "phalcon/DataMapper/Pdo/Profiler/Profiler.zep", 209); - ZEPHIR_MM_RESTORE(); - return; } - RETURN_CCTOR(&encoded); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 2); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_0); + RETURN_CCTOR(&success); } -zend_object *zephir_init_properties_Phalcon_DataMapper_Pdo_Profiler_Profiler(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Mvc_Model, dump) { - zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("context"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("context"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); -ZEPHIR_INIT_CLASS(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\DataMapper\\Pdo\\Profiler, ProfilerInterface, phalcon, datamapper_pdo_profiler_profilerinterface, phalcon_datamapper_pdo_profiler_profilerinterface_method_entry); + ZEPHIR_MM_GROW(); - return SUCCESS; + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 428, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, finish); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogger); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogFormat); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, getLogLevel); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, isActive); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setActive); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setLogFormat); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, setLogLevel); -ZEPHIR_DOC_METHOD(Phalcon_DataMapper_Pdo_Profiler_ProfilerInterface, start); - - +static PHP_METHOD(Phalcon_Mvc_Model, find) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *parameters = NULL, parameters_sub, __$null, params, query, resultset, hydration; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&resultset); + ZVAL_UNDEF(&hydration); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } - -ZEPHIR_INIT_CLASS(Phalcon_Db_AbstractDb) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, AbstractDb, phalcon, db_abstractdb, phalcon_db_abstractdb_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - return SUCCESS; + if (Z_TYPE_P(parameters) != IS_ARRAY) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + if (Z_TYPE_P(parameters) != IS_NULL) { + zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1633); + } + } else { + ZEPHIR_CPY_WRT(¶ms, parameters); + } + ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_0, 429, ¶ms); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&resultset, &query, "execute", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&resultset) == IS_OBJECT) { + ZEPHIR_OBS_VAR(&hydration); + if (zephir_array_isset_string_fetch(&hydration, ¶ms, SL("hydration"), 0)) { + ZEPHIR_CALL_METHOD(NULL, &resultset, "sethydratemode", NULL, 0, &hydration); + zephir_check_call_status(); + } + } + RETURN_CCTOR(&resultset); } -static PHP_METHOD(Phalcon_Db_AbstractDb, setup) +static PHP_METHOD(Phalcon_Mvc_Model, findFirst) { + zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL, escapeIdentifiers, forceCasting; - zval options; + zephir_fcall_cache_entry *_5 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *parameters = NULL, parameters_sub, __$null, params, query, _6, _1$$5, _2$$6, _3$$6, _4$$6; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&escapeIdentifiers); - ZVAL_UNDEF(&forceCasting); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_2$$6); + ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&_4$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &options_param); - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } - ZEPHIR_OBS_VAR(&escapeIdentifiers); - if (zephir_array_isset_string_fetch(&escapeIdentifiers, &options, SL("escapeSqlIdentifiers"), 0)) { - ZEPHIR_GLOBAL(db).escape_identifiers = zend_is_true(&escapeIdentifiers); + _0 = Z_TYPE_P(parameters) == IS_STRING; + if (!(_0)) { + _0 = zephir_is_numeric(parameters); } - ZEPHIR_OBS_VAR(&forceCasting); - if (zephir_array_isset_string_fetch(&forceCasting, &options, SL("forceCasting"), 0)) { - ZEPHIR_GLOBAL(db).force_casting = zend_is_true(&forceCasting); + if (Z_TYPE_P(parameters) == IS_NULL) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else if (Z_TYPE_P(parameters) == IS_ARRAY) { + ZEPHIR_CPY_WRT(¶ms, parameters); + } else if (_0) { + ZEPHIR_INIT_VAR(&_1$$5); + zephir_create_array(&_1$$5, 1, 0); + zephir_array_fast_append(&_1$$5, parameters); + ZEPHIR_CPY_WRT(¶ms, &_1$$5); + } else { + ZEPHIR_INIT_VAR(&_2$$6); + object_init_ex(&_2$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$6); + zephir_get_called_class(&_3$$6); + ZEPHIR_INIT_VAR(&_4$$6); + ZEPHIR_CONCAT_SVS(&_4$$6, "Parameters passed must be of type array, string, numeric or null in '", &_3$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$6, "__construct", NULL, 32, &_4$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$6, "phalcon/Mvc/Model.zep", 1757); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_MM_RESTORE(); + ZVAL_LONG(&_6, 1); + ZEPHIR_CALL_STATIC(&query, "getpreparedquery", &_5, 429, ¶ms, &_6); + zephir_check_call_status(); + ZVAL_BOOL(&_6, 1); + ZEPHIR_CALL_METHOD(NULL, &query, "setuniquerow", NULL, 0, &_6); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&query, "execute", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Mvc_Model, fireEvent) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *eventName_param = NULL, _0; + zval eventName; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&eventName); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(eventName) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &eventName_param); + if (UNEXPECTED(Z_TYPE_P(eventName_param) != IS_STRING && Z_TYPE_P(eventName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'eventName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(eventName_param) == IS_STRING)) { + zephir_get_strval(&eventName, eventName_param); + } else { + ZEPHIR_INIT_VAR(&eventName); + } + if ((zephir_method_exists(this_ptr, &eventName) == SUCCESS)) { + ZEPHIR_CALL_METHOD_ZVAL(NULL, this_ptr, &eventName, NULL, 0); + zephir_check_call_status(); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "notifyevent", NULL, 0, &eventName, this_ptr); + zephir_check_call_status(); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Db_Column) +static PHP_METHOD(Phalcon_Mvc_Model, fireEventCancel) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Column, phalcon, db_column, phalcon_db_column_method_entry, 0); - - zend_declare_property_null(phalcon_db_column_ce, SL("after"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("autoIncrement"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_column_ce, SL("bindType"), 2, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_column_ce, SL("comment"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_column_ce, SL("defaultValue"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("first"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("isNumeric"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_column_ce, SL("name"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("notNull"), 1, ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("primary"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_column_ce, SL("scale"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_column_ce, SL("size"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_column_ce, SL("type"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_column_ce, SL("typeReference"), -1, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_column_ce, SL("typeValues"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_column_ce, SL("unsigned"), 0, ZEND_ACC_PROTECTED); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_BLOB"), 3); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_BOOL"), 5); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_DECIMAL"), 32); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_INT"), 1); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_NULL"), 0); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_PARAM_STR"), 2); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("BIND_SKIP"), 1024); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_BIGINTEGER"), 14); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_BIT"), 19); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_BINARY"), 26); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_BLOB"), 11); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_BOOLEAN"), 8); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_CHAR"), 5); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_DATE"), 1); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_DATETIME"), 4); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_DECIMAL"), 3); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_DOUBLE"), 9); - - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_ENUM"), 18); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *eventName_param = NULL, _0$$3, _1; + zval eventName; + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_FLOAT"), 7); + ZVAL_UNDEF(&eventName); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(eventName) + ZEND_PARSE_PARAMETERS_END(); +#endif - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_INTEGER"), 0); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_JSON"), 15); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &eventName_param); + if (UNEXPECTED(Z_TYPE_P(eventName_param) != IS_STRING && Z_TYPE_P(eventName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'eventName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(eventName_param) == IS_STRING)) { + zephir_get_strval(&eventName, eventName_param); + } else { + ZEPHIR_INIT_VAR(&eventName); + } - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_JSONB"), 16); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_LONGBLOB"), 13); + if ((zephir_method_exists(this_ptr, &eventName) == SUCCESS)) { + ZEPHIR_CALL_METHOD_ZVAL(&_0$$3, this_ptr, &eventName, NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_0$$3)) { + RETURN_MM_BOOL(0); + } + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_1, "notifyevent", NULL, 0, &eventName, this_ptr); + zephir_check_call_status(); + RETURN_MM(); +} - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_LONGTEXT"), 24); +static PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) +{ + zend_string *_8; + zend_ulong _7; + zval changed; + zval metaData, name, snapshot, columnMap, allAttributes, value, _0, _4, *_5, _6, _1$$3, _2$$3, _3$$3, _9$$6, _10$$10; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_MEDIUMBLOB"), 12); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&allAttributes); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_10$$10); + ZVAL_UNDEF(&changed); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_MEDIUMINTEGER"), 21); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_MEDIUMTEXT"), 23); + ZEPHIR_MM_GROW(); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_SMALLINTEGER"), 22); + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&snapshot, &_0); + if (UNEXPECTED(Z_TYPE_P(&snapshot) != IS_ARRAY)) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The 'keepSnapshots' option must be enabled to track changes in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 1843); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getreversecolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + if (Z_TYPE_P(&columnMap) != IS_ARRAY) { + ZEPHIR_CALL_METHOD(&allAttributes, &metaData, "getdatatypes", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&allAttributes, &columnMap); + } + ZEPHIR_INIT_VAR(&changed); + array_init(&changed); + ZEPHIR_INIT_VAR(&_4); + zephir_is_iterable(&allAttributes, 0, "phalcon/Mvc/Model.zep", 1901); + if (Z_TYPE_P(&allAttributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&allAttributes), _7, _8, _5) + { + ZEPHIR_INIT_NVAR(&name); + if (_8 != NULL) { + ZVAL_STR_COPY(&name, _8); + } else { + ZVAL_LONG(&name, _7); + } + ZEPHIR_INIT_NVAR(&_4); + ZVAL_COPY(&_4, _5); + if (!(zephir_array_isset(&snapshot, &name))) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1876); + continue; + } + ZEPHIR_OBS_NVAR(&value); + if (!(zephir_fetch_property_zval(&value, this_ptr, &name, PH_SILENT_CC))) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1886); + continue; + } + zephir_array_fetch(&_9$$6, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1894); + if (!ZEPHIR_IS_IDENTICAL(&value, &_9$$6)) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1895); + continue; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &allAttributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_6, &allAttributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_6)) { + break; + } + ZEPHIR_CALL_METHOD(&name, &allAttributes, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4, &allAttributes, "current", NULL, 0); + zephir_check_call_status(); + if (!(zephir_array_isset(&snapshot, &name))) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1876); + continue; + } + ZEPHIR_OBS_NVAR(&value); + if (!(zephir_fetch_property_zval(&value, this_ptr, &name, PH_SILENT_CC))) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1886); + continue; + } + zephir_array_fetch(&_10$$10, &snapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 1894); + if (!ZEPHIR_IS_IDENTICAL(&value, &_10$$10)) { + zephir_array_append(&changed, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1895); + continue; + } + ZEPHIR_CALL_METHOD(NULL, &allAttributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&_4); + ZEPHIR_INIT_NVAR(&name); + RETURN_CTOR(&changed); +} - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TEXT"), 6); +static PHP_METHOD(Phalcon_Mvc_Model, getDirtyState) +{ + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TIME"), 20); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TIMESTAMP"), 17); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TINYBLOB"), 10); + RETURN_MEMBER(getThis(), "dirtyState"); +} - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TINYINTEGER"), 26); +static PHP_METHOD(Phalcon_Mvc_Model, getEventsManager) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_TINYTEXT"), 25); + ZVAL_UNDEF(&_0); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_VARBINARY"), 27); - zephir_declare_class_constant_long(phalcon_db_column_ce, SL("TYPE_VARCHAR"), 2); + ZEPHIR_MM_GROW(); - zend_class_implements(phalcon_db_column_ce, 1, phalcon_db_columninterface_ce); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getcustomeventsmanager", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, __construct) +static PHP_METHOD(Phalcon_Mvc_Model, getMessages) { + zend_bool _0; + zval filtered; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval definition; - zval *name_param = NULL, *definition_param = NULL, __$true, __$false, type, notNull, primary, size, scale, dunsigned, first, after, bindType, isNumeric, autoIncrement, defaultValue, typeReference, typeValues, comment; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *filter = NULL, filter_sub, __$null, message, _1$$3, *_2$$3, _3$$3, _4$$4, _5$$6; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(¬Null); - ZVAL_UNDEF(&primary); - ZVAL_UNDEF(&size); - ZVAL_UNDEF(&scale); - ZVAL_UNDEF(&dunsigned); - ZVAL_UNDEF(&first); - ZVAL_UNDEF(&after); - ZVAL_UNDEF(&bindType); - ZVAL_UNDEF(&isNumeric); - ZVAL_UNDEF(&autoIncrement); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&typeReference); - ZVAL_UNDEF(&typeValues); - ZVAL_UNDEF(&comment); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&filter_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&filtered); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(filter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); + zephir_fetch_params(1, 0, 1, &filter); + if (!filter) { + filter = &filter_sub; + filter = &__$null; } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - ZEPHIR_OBS_VAR(&type); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&type, &definition, SL("type"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Column type is required", "phalcon/Db/Column.zep", 348); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &type); - ZEPHIR_OBS_VAR(&typeReference); - if (zephir_array_isset_string_fetch(&typeReference, &definition, SL("typeReference"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("typeReference"), &typeReference); - } - ZEPHIR_OBS_VAR(&typeValues); - if (zephir_array_isset_string_fetch(&typeValues, &definition, SL("typeValues"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("typeValues"), &typeValues); - } - ZEPHIR_OBS_VAR(¬Null); - if (zephir_array_isset_string_fetch(¬Null, &definition, SL("notNull"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("notNull"), ¬Null); - } - ZEPHIR_OBS_VAR(&primary); - if (zephir_array_isset_string_fetch(&primary, &definition, SL("primary"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("primary"), &primary); - } - ZEPHIR_OBS_VAR(&size); - if (zephir_array_isset_string_fetch(&size, &definition, SL("size"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("size"), &size); - } - ZEPHIR_OBS_VAR(&scale); - if (zephir_array_isset_string_fetch(&scale, &definition, SL("scale"), 0)) { - do { - if (ZEPHIR_IS_LONG(&type, 14) || ZEPHIR_IS_LONG(&type, 3) || ZEPHIR_IS_LONG(&type, 9) || ZEPHIR_IS_LONG(&type, 7) || ZEPHIR_IS_LONG(&type, 0) || ZEPHIR_IS_LONG(&type, 21) || ZEPHIR_IS_LONG(&type, 22) || ZEPHIR_IS_LONG(&type, 26)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("scale"), &scale); - break; - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Column type does not support scale parameter", "phalcon/Db/Column.zep", 398); - return; - } while(0); - - } - ZEPHIR_OBS_VAR(&defaultValue); - if (zephir_array_isset_string_fetch(&defaultValue, &definition, SL("default"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("defaultValue"), &defaultValue); - } - ZEPHIR_OBS_VAR(&dunsigned); - if (zephir_array_isset_string_fetch(&dunsigned, &definition, SL("unsigned"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("unsigned"), &dunsigned); - } - ZEPHIR_OBS_VAR(&isNumeric); - if (zephir_array_isset_string_fetch(&isNumeric, &definition, SL("isNumeric"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("isNumeric"), &isNumeric); + _0 = Z_TYPE_P(filter) == IS_STRING; + if (_0) { + _0 = !(ZEPHIR_IS_EMPTY(filter)); } - ZEPHIR_OBS_VAR(&autoIncrement); - if (zephir_array_isset_string_fetch(&autoIncrement, &definition, SL("autoIncrement"), 0)) { - if (!(zephir_is_true(&autoIncrement))) { - if (0) { - zephir_update_property_zval(this_ptr, ZEND_STRL("autoIncrement"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("autoIncrement"), &__$false); - } + if (_0) { + ZEPHIR_INIT_VAR(&filtered); + array_init(&filtered); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("errorMessages"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_1$$3, 0, "phalcon/Mvc/Model.zep", 1958); + if (Z_TYPE_P(&_1$$3) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_1$$3), _2$$3) + { + ZEPHIR_INIT_NVAR(&message); + ZVAL_COPY(&message, _2$$3); + ZEPHIR_CALL_METHOD(&_4$$4, &message, "getfield", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_4$$4, filter)) { + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1954); + } + } ZEND_HASH_FOREACH_END(); } else { - do { - if (ZEPHIR_IS_LONG(&type, 14) || ZEPHIR_IS_LONG(&type, 0) || ZEPHIR_IS_LONG(&type, 21) || ZEPHIR_IS_LONG(&type, 22) || ZEPHIR_IS_LONG(&type, 26)) { - if (1) { - zephir_update_property_zval(this_ptr, ZEND_STRL("autoIncrement"), &__$true); - } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("autoIncrement"), &__$false); - } + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$3, &_1$$3, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$3)) { break; } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Column type cannot be auto-increment", "phalcon/Db/Column.zep", 442); - return; - } while(0); - + ZEPHIR_CALL_METHOD(&message, &_1$$3, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5$$6, &message, "getfield", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_5$$6, filter)) { + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Mvc/Model.zep", 1954); + } + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&message); + RETURN_CTOR(&filtered); } - if (zephir_array_isset_string_fetch(&first, &definition, SL("first"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("first"), &first); - } - if (zephir_array_isset_string_fetch(&after, &definition, SL("after"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("after"), &after); - } - if (zephir_array_isset_string_fetch(&bindType, &definition, SL("bindType"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("bindType"), &bindType); - } - if (zephir_array_isset_string_fetch(&comment, &definition, SL("comment"), 1)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("comment"), &comment); - } - ZEPHIR_MM_RESTORE(); + RETURN_MM_MEMBER(getThis(), "errorMessages"); } -static PHP_METHOD(Phalcon_Db_Column, getAfterPosition) +static PHP_METHOD(Phalcon_Mvc_Model, getModelsManager) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "after"); + RETURN_MEMBER(getThis(), "modelsManager"); } -static PHP_METHOD(Phalcon_Db_Column, getBindType) +static PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) { + zval metaData, container, _0$$3, _1$$3, _2$$3, _3$$4, _4$$4, _5$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$4); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "bindType"); + ZEPHIR_OBS_VAR(&metaData); + zephir_read_property(&metaData, this_ptr, ZEND_STRL("modelsMetaData"), PH_NOISY_CC); + if (Z_TYPE_P(&metaData) == IS_NULL) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0$$3); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "modelsMetadata"); + ZEPHIR_CALL_METHOD(&_1$$3, &container, "getshared", NULL, 0, &_2$$3); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&metaData, &_1$$3); + if (UNEXPECTED(Z_TYPE_P(&metaData) != IS_OBJECT)) { + ZEPHIR_INIT_VAR(&_3$$4); + object_init_ex(&_3$$4, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_4$$4); + zephir_get_class(&_4$$4, this_ptr, 0); + ZEPHIR_INIT_VAR(&_5$$4); + ZEPHIR_CONCAT_SVS(&_5$$4, "The injected service 'modelsMetadata' is not valid in '", &_4$$4, "'"); + ZEPHIR_CALL_METHOD(NULL, &_3$$4, "__construct", NULL, 32, &_5$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$4, "phalcon/Mvc/Model.zep", 1992); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_update_property_zval(this_ptr, ZEND_STRL("modelsMetaData"), &metaData); + } + RETURN_CCTOR(&metaData); } -static PHP_METHOD(Phalcon_Db_Column, getComment) +static PHP_METHOD(Phalcon_Mvc_Model, getOperationMade) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "comment"); + RETURN_MEMBER(getThis(), "operationMade"); } -static PHP_METHOD(Phalcon_Db_Column, getDefault) +static PHP_METHOD(Phalcon_Mvc_Model, getOldSnapshotData) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "defaultValue"); + RETURN_MEMBER(getThis(), "oldSnapshot"); } -static PHP_METHOD(Phalcon_Db_Column, getName) +static PHP_METHOD(Phalcon_Mvc_Model, getReadConnection) { + zval _0, _2, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "name"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("transaction"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) != IS_NULL) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("transaction"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_1$$3, "getconnection", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_2, "getreadconnection", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, getScale) +static PHP_METHOD(Phalcon_Mvc_Model, getReadConnectionService) { + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "scale"); + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getreadconnectionservice", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, getSize) +static PHP_METHOD(Phalcon_Mvc_Model, getRelated) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *alias_param = NULL, *arguments = NULL, arguments_sub, __$null, relation, className, manager, result, lowerAlias, _0, _1, _2$$3, _3$$3; + zval alias; zval *this_ptr = getThis(); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&arguments_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(alias) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(arguments) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &alias_param, &arguments); + zephir_get_strval(&alias, alias_param); + if (!arguments) { + arguments = &arguments_sub; + arguments = &__$null; + } - RETURN_MEMBER(getThis(), "size"); + ZEPHIR_INIT_VAR(&className); + zephir_get_class(&className, this_ptr, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + ZEPHIR_CALL_METHOD(&_1, &manager, "getrelationbyalias", NULL, 0, &className, &lowerAlias); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_1); + if (UNEXPECTED(Z_TYPE_P(&relation) != IS_OBJECT)) { + ZEPHIR_INIT_VAR(&_2$$3); + object_init_ex(&_2$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVSVS(&_3$$3, "There is no defined relations for the model '", &className, "' using alias '", &alias, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$3, "phalcon/Mvc/Model.zep", 2068); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(arguments) == IS_NULL) { + ZEPHIR_CALL_METHOD(&result, &manager, "getrelationrecords", NULL, 0, &relation, this_ptr, arguments); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("related"), &lowerAlias, &result); + } else { + ZEPHIR_CALL_METHOD(&result, &manager, "getrelationrecords", NULL, 0, &relation, this_ptr, arguments); + zephir_check_call_status(); + } + RETURN_CCTOR(&result); } -static PHP_METHOD(Phalcon_Db_Column, getType) +static PHP_METHOD(Phalcon_Mvc_Model, isRelationshipLoaded) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *relationshipAlias_param = NULL, _0, _1; + zval relationshipAlias; zval *this_ptr = getThis(); + ZVAL_UNDEF(&relationshipAlias); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(relationshipAlias) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "type"); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &relationshipAlias_param); + zephir_get_strval(&relationshipAlias, relationshipAlias_param); + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_fast_strtolower(&_1, &relationshipAlias); + RETURN_MM_BOOL(zephir_array_isset(&_0, &_1)); } -static PHP_METHOD(Phalcon_Db_Column, getTypeReference) +static PHP_METHOD(Phalcon_Mvc_Model, getSchema) { + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "typeReference"); + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getmodelschema", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, getTypeValues) +static PHP_METHOD(Phalcon_Mvc_Model, getSnapshotData) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "typeValues"); + RETURN_MEMBER(getThis(), "snapshot"); } -static PHP_METHOD(Phalcon_Db_Column, hasDefault) +static PHP_METHOD(Phalcon_Mvc_Model, getSource) { - zval _0, _1; + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "isautoincrement", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getmodelsource", NULL, 0, this_ptr); zephir_check_call_status(); - if (zephir_is_true(&_0)) { - RETURN_MM_BOOL(0); - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("defaultValue"), PH_NOISY_CC | PH_READONLY); - RETURN_MM_BOOL(Z_TYPE_P(&_1) != IS_NULL); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, isAutoIncrement) +static PHP_METHOD(Phalcon_Mvc_Model, getUpdatedFields) { + zend_bool _11$$6, _13$$8; + zend_string *_10; + zend_ulong _9; + zval updated; + zval name, snapshot, oldSnapshot, value, _0, *_7, _8, _1$$3, _2$$3, _3$$3, _4$$5, _5$$5, _6$$5, _12$$6, _14$$8; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&oldSnapshot); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$8); + ZVAL_UNDEF(&updated); + + ZEPHIR_MM_GROW(); - RETURN_MEMBER(getThis(), "autoIncrement"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&snapshot, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("oldSnapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&oldSnapshot, &_0); + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).update_snapshot_on_save))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 2192); + ZEPHIR_MM_RESTORE(); + return; + } + if (UNEXPECTED(Z_TYPE_P(&snapshot) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The 'keepSnapshots' option must be enabled to track changes", "phalcon/Mvc/Model.zep", 2198); + return; + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!ZEPHIR_IS_LONG(&_0, 0))) { + ZEPHIR_INIT_VAR(&_4$$5); + object_init_ex(&_4$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_5$$5); + zephir_get_class(&_5$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_6$$5); + ZEPHIR_CONCAT_SVS(&_6$$5, "Change checking cannot be performed because the object has not been persisted or is deleted in '", &_5$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_4$$5, "__construct", NULL, 32, &_6$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_4$$5, "phalcon/Mvc/Model.zep", 2207); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(&updated); + array_init(&updated); + zephir_is_iterable(&snapshot, 0, "phalcon/Mvc/Model.zep", 2222); + if (Z_TYPE_P(&snapshot) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&snapshot), _9, _10, _7) + { + ZEPHIR_INIT_NVAR(&name); + if (_10 != NULL) { + ZVAL_STR_COPY(&name, _10); + } else { + ZVAL_LONG(&name, _9); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _7); + _11$$6 = !(zephir_array_isset(&oldSnapshot, &name)); + if (!(_11$$6)) { + zephir_array_fetch(&_12$$6, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2217); + _11$$6 = !ZEPHIR_IS_IDENTICAL(&value, &_12$$6); + } + if (_11$$6) { + zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2218); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &snapshot, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_8, &snapshot, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_8)) { + break; + } + ZEPHIR_CALL_METHOD(&name, &snapshot, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &snapshot, "current", NULL, 0); + zephir_check_call_status(); + _13$$8 = !(zephir_array_isset(&oldSnapshot, &name)); + if (!(_13$$8)) { + zephir_array_fetch(&_14$$8, &oldSnapshot, &name, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 2217); + _13$$8 = !ZEPHIR_IS_IDENTICAL(&value, &_14$$8); + } + if (_13$$8) { + zephir_array_append(&updated, &name, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2218); + } + ZEPHIR_CALL_METHOD(NULL, &snapshot, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&name); + RETURN_CTOR(&updated); } -static PHP_METHOD(Phalcon_Db_Column, isFirst) +static PHP_METHOD(Phalcon_Mvc_Model, getWriteConnection) { + zval _0, _2, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1$$3); - RETURN_MEMBER(getThis(), "first"); + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("transaction"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) != IS_NULL) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("transaction"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_1$$3, "getconnection", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_2, "getwriteconnection", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, isNotNull) +static PHP_METHOD(Phalcon_Mvc_Model, getWriteConnectionService) { + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "notNull"); + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "getwriteconnectionservice", NULL, 0, this_ptr); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Column, isNumeric) +static PHP_METHOD(Phalcon_Mvc_Model, hasChanged) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool allFields; + zval *fieldName = NULL, fieldName_sub, *allFields_param = NULL, __$null, changedFields, intersect; zval *this_ptr = getThis(); + ZVAL_UNDEF(&fieldName_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&changedFields); + ZVAL_UNDEF(&intersect); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(fieldName) + Z_PARAM_BOOL(allFields) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "isNumeric"); -} - -static PHP_METHOD(Phalcon_Db_Column, isPrimary) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 2, &fieldName, &allFields_param); + if (!fieldName) { + fieldName = &fieldName_sub; + fieldName = &__$null; + } + if (!allFields_param) { + allFields = 0; + } else { + allFields = zephir_get_boolval(allFields_param); + } - RETURN_MEMBER(getThis(), "primary"); + ZEPHIR_CALL_METHOD(&changedFields, this_ptr, "getchangedfields", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(fieldName) == IS_STRING) { + RETURN_MM_BOOL(zephir_fast_in_array(fieldName, &changedFields)); + } + if (Z_TYPE_P(fieldName) == IS_ARRAY) { + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 430, fieldName, &changedFields); + zephir_check_call_status(); + if (allFields) { + RETURN_MM_BOOL(ZEPHIR_IS_EQUAL(&intersect, fieldName)); + } + RETURN_MM_BOOL(zephir_fast_count_int(&intersect) > 0); + } + RETURN_MM_BOOL(zephir_fast_count_int(&changedFields) > 0); } -static PHP_METHOD(Phalcon_Db_Column, isUnsigned) +static PHP_METHOD(Phalcon_Mvc_Model, hasSnapshotData) { + zval _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "unsigned"); -} - + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(!(ZEPHIR_IS_EMPTY(&_0))); +} +static PHP_METHOD(Phalcon_Mvc_Model, hasUpdated) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool allFields; + zval *fieldName = NULL, fieldName_sub, *allFields_param = NULL, __$null, updatedFields, intersect; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&fieldName_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&updatedFields); + ZVAL_UNDEF(&intersect); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(fieldName) + Z_PARAM_BOOL(allFields) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 2, &fieldName, &allFields_param); + if (!fieldName) { + fieldName = &fieldName_sub; + fieldName = &__$null; + } + if (!allFields_param) { + allFields = 0; + } else { + allFields = zephir_get_boolval(allFields_param); + } - -ZEPHIR_INIT_CLASS(Phalcon_Db_ColumnInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, ColumnInterface, phalcon, db_columninterface, phalcon_db_columninterface_method_entry); - - return SUCCESS; + ZEPHIR_CALL_METHOD(&updatedFields, this_ptr, "getupdatedfields", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(fieldName) == IS_STRING) { + RETURN_MM_BOOL(zephir_fast_in_array(fieldName, &updatedFields)); + } + if (Z_TYPE_P(fieldName) == IS_ARRAY) { + ZEPHIR_CALL_FUNCTION(&intersect, "array_intersect", NULL, 430, fieldName, &updatedFields); + zephir_check_call_status(); + if (allFields) { + RETURN_MM_BOOL(ZEPHIR_IS_EQUAL(&intersect, fieldName)); + } + RETURN_MM_BOOL(zephir_fast_count_int(&intersect) > 0); + } + RETURN_MM_BOOL(zephir_fast_count_int(&updatedFields) > 0); } -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getAfterPosition); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getBindType); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getDefault); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getScale); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getSize); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getType); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getTypeReference); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, getTypeValues); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, hasDefault); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isAutoIncrement); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isFirst); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isNotNull); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isNumeric); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isPrimary); -ZEPHIR_DOC_METHOD(Phalcon_Db_ColumnInterface, isUnsigned); +static PHP_METHOD(Phalcon_Mvc_Model, jsonSerialize) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "toarray", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} +static PHP_METHOD(Phalcon_Mvc_Model, maximum) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *parameters = NULL, parameters_sub, __$null, _0, _1; + zval *this_ptr = getThis(); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) + ZEND_PARSE_PARAMETERS_END(); +#endif -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Dialect, phalcon, db_dialect, phalcon_db_dialect_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } - zend_declare_property_null(phalcon_db_dialect_ce, SL("escapeChar"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_dialect_ce, SL("customFunctions"), ZEND_ACC_PROTECTED); - phalcon_db_dialect_ce->create_object = zephir_init_properties_Phalcon_Db_Dialect; - zend_class_implements(phalcon_db_dialect_ce, 1, phalcon_db_dialectinterface_ce); - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "MAX"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "maximum"); + ZEPHIR_RETURN_CALL_SELF("groupresult", NULL, 0, &_0, &_1, parameters); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, createSavepoint) +static PHP_METHOD(Phalcon_Mvc_Model, minimum) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *parameters = NULL, parameters_sub, __$null, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; } - ZEPHIR_CONCAT_SV(return_value, "SAVEPOINT ", &name); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "MIN"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "minimum"); + ZEPHIR_RETURN_CALL_SELF("groupresult", NULL, 0, &_0, &_1, parameters); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, escape) +static PHP_METHOD(Phalcon_Mvc_Model, query) { - zend_bool _2$$5, _12$$7, _13$$7, _17$$9, _18$$9; - zend_string *_11; - zend_ulong _10; - zval _7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *str_param = NULL, *escapeChar_param = NULL, parts, key, part, newParts, _5, _6, *_8, _9, _0$$4, _3$$6, _14$$7, _16$$7, _19$$9, _21$$9; - zval str, escapeChar, _1$$4, _4$$6, _15$$7, _20$$9; + zephir_fcall_cache_entry *_0 = NULL; + zval *container = NULL, container_sub, __$null, criteria, _3, _1$$4, _2$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&str); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&container_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&criteria); + ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&_15$$7); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&parts); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&part); - ZVAL_UNDEF(&newParts); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_16$$7); - ZVAL_UNDEF(&_19$$9); - ZVAL_UNDEF(&_21$$9); - ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_2$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(container, phalcon_di_diinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &str_param, &escapeChar_param); - if (UNEXPECTED(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(str_param) == IS_STRING)) { - zephir_get_strval(&str, str_param); - } else { - ZEPHIR_INIT_VAR(&str); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); + zephir_fetch_params(1, 0, 1, &container); + if (!container) { + container = &container_sub; + ZEPHIR_CPY_WRT(container, &__$null); } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_SEPARATE_PARAM(container); } - if (!(ZEPHIR_GLOBAL(db).escape_identifiers)) { - RETURN_CTOR(&str); + if (Z_TYPE_P(container) != IS_OBJECT) { + ZEPHIR_CALL_CE_STATIC(container, phalcon_di_di_ce, "getdefault", &_0, 0); + zephir_check_call_status(); } - if (ZEPHIR_IS_EMPTY(&escapeChar)) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("escapeChar"), PH_NOISY_CC); - zephir_cast_to_string(&_1$$4, &_0$$4); - ZEPHIR_CPY_WRT(&escapeChar, &_1$$4); - } - if (!(zephir_memnstr_str(&str, SL("."), "phalcon/Db/Dialect.zep", 52))) { - _2$$5 = !ZEPHIR_IS_STRING(&escapeChar, ""); - if (_2$$5) { - _2$$5 = !ZEPHIR_IS_STRING(&str, "*"); - } - if (_2$$5) { - ZEPHIR_INIT_VAR(&_3$$6); - ZEPHIR_INIT_VAR(&_4$$6); - ZEPHIR_CONCAT_VV(&_4$$6, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_3$$6, &escapeChar, &_4$$6, &str); - ZEPHIR_CONCAT_VVV(return_value, &escapeChar, &_3$$6, &escapeChar); - RETURN_MM(); - } - RETURN_CTOR(&str); - } - ZEPHIR_INIT_VAR(&_5); - ZEPHIR_INIT_VAR(&_6); - zephir_fast_trim(&_6, &str, &escapeChar, ZEPHIR_TRIM_BOTH); - zephir_fast_explode_str(&_5, SL("."), &_6, LONG_MAX); - zephir_get_arrval(&_7, &_5); - ZEPHIR_CPY_WRT(&parts, &_7); - ZEPHIR_CPY_WRT(&newParts, &parts); - zephir_is_iterable(&parts, 0, "phalcon/Db/Dialect.zep", 72); - if (Z_TYPE_P(&parts) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&parts), _10, _11, _8) - { - ZEPHIR_INIT_NVAR(&key); - if (_11 != NULL) { - ZVAL_STR_COPY(&key, _11); - } else { - ZVAL_LONG(&key, _10); - } - ZEPHIR_INIT_NVAR(&part); - ZVAL_COPY(&part, _8); - _12$$7 = ZEPHIR_IS_STRING(&escapeChar, ""); - if (!(_12$$7)) { - _12$$7 = ZEPHIR_IS_STRING(&part, ""); - } - _13$$7 = _12$$7; - if (!(_13$$7)) { - _13$$7 = ZEPHIR_IS_STRING(&part, "*"); - } - if (_13$$7) { - continue; - } - ZEPHIR_INIT_NVAR(&_14$$7); - ZEPHIR_INIT_NVAR(&_15$$7); - ZEPHIR_CONCAT_VV(&_15$$7, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_14$$7, &escapeChar, &_15$$7, &part); - ZEPHIR_INIT_NVAR(&_16$$7); - ZEPHIR_CONCAT_VVV(&_16$$7, &escapeChar, &_14$$7, &escapeChar); - zephir_array_update_zval(&newParts, &key, &_16$$7, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &parts, "rewind", NULL, 0); + ZEPHIR_INIT_VAR(&criteria); + if (zephir_instance_of_ev(container, phalcon_di_diinterface_ce)) { + ZEPHIR_INIT_VAR(&_2$$4); + ZVAL_STRING(&_2$$4, "Phalcon\\Mvc\\Model\\Criteria"); + ZEPHIR_CALL_METHOD(&_1$$4, container, "get", NULL, 0, &_2$$4); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9, &parts, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &parts, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&part, &parts, "current", NULL, 0); - zephir_check_call_status(); - _17$$9 = ZEPHIR_IS_STRING(&escapeChar, ""); - if (!(_17$$9)) { - _17$$9 = ZEPHIR_IS_STRING(&part, ""); - } - _18$$9 = _17$$9; - if (!(_18$$9)) { - _18$$9 = ZEPHIR_IS_STRING(&part, "*"); - } - if (_18$$9) { - continue; - } - ZEPHIR_INIT_NVAR(&_19$$9); - ZEPHIR_INIT_NVAR(&_20$$9); - ZEPHIR_CONCAT_VV(&_20$$9, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_19$$9, &escapeChar, &_20$$9, &part); - ZEPHIR_INIT_NVAR(&_21$$9); - ZEPHIR_CONCAT_VVV(&_21$$9, &escapeChar, &_19$$9, &escapeChar); - zephir_array_update_zval(&newParts, &key, &_21$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &parts, "next", NULL, 0); + ZEPHIR_CPY_WRT(&criteria, &_1$$4); + } else { + object_init_ex(&criteria, phalcon_mvc_model_criteria_ce); + if (zephir_has_constructor(&criteria)) { + ZEPHIR_CALL_METHOD(NULL, &criteria, "__construct", NULL, 0); zephir_check_call_status(); } - } - ZEPHIR_INIT_NVAR(&part); - ZEPHIR_INIT_NVAR(&key); - zephir_fast_join_str(return_value, SL("."), &newParts); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Dialect, escapeSchema) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *str_param = NULL, *escapeChar_param = NULL, _0$$4, _2; - zval str, escapeChar, _1$$4; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&str); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(str) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &str_param, &escapeChar_param); - if (UNEXPECTED(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(str_param) == IS_STRING)) { - zephir_get_strval(&str, str_param); - } else { - ZEPHIR_INIT_VAR(&str); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - if (!(ZEPHIR_GLOBAL(db).escape_identifiers)) { - RETURN_CTOR(&str); - } - if (ZEPHIR_IS_STRING(&escapeChar, "")) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("escapeChar"), PH_NOISY_CC); - zephir_cast_to_string(&_1$$4, &_0$$4); - ZEPHIR_CPY_WRT(&escapeChar, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 431, container); + zephir_check_call_status(); } - ZEPHIR_INIT_VAR(&_2); - zephir_fast_trim(&_2, &str, &escapeChar, ZEPHIR_TRIM_BOTH); - ZEPHIR_CONCAT_VVV(return_value, &escapeChar, &_2, &escapeChar); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_3); + zephir_get_called_class(&_3); + ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 432, &_3); + zephir_check_call_status(); + RETURN_CCTOR(&criteria); } -static PHP_METHOD(Phalcon_Db_Dialect, forUpdate) +static PHP_METHOD(Phalcon_Mvc_Model, readAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL; - zval sqlQuery; + zval *attribute_param = NULL, _0; + zval attribute; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) + Z_PARAM_STR(attribute) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); + zephir_fetch_params(1, 1, 0, &attribute_param); + if (UNEXPECTED(Z_TYPE_P(attribute_param) != IS_STRING && Z_TYPE_P(attribute_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'attribute' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); + if (EXPECTED(Z_TYPE_P(attribute_param) == IS_STRING)) { + zephir_get_strval(&attribute, attribute_param); } else { - ZEPHIR_INIT_VAR(&sqlQuery); + ZEPHIR_INIT_VAR(&attribute); } - ZEPHIR_CONCAT_VS(return_value, &sqlQuery, " FOR UPDATE"); - RETURN_MM(); + if (!(zephir_isset_property_zval(this_ptr, &attribute))) { + RETURN_MM_NULL(); + } + ZEPHIR_OBS_VAR(&_0); + zephir_read_property_zval(&_0, this_ptr, &attribute, PH_NOISY_CC); + RETURN_CCTOR(&_0); } -static PHP_METHOD(Phalcon_Db_Dialect, getColumnList) +static PHP_METHOD(Phalcon_Mvc_Model, refresh) { + zval fields, _18, _16$$9, _17$$10; + zval metaData, readConnection, schema, source, table, uniqueKey, tables, uniqueParams, dialect, row, attribute, manager, columnMap, _0, _4, _13, *_14, _15, _19, _20, _23, _1$$3, _2$$3, _3$$3, _5$$6, _9$$6, _6$$7, _7$$7, _8$$7, _10$$8, _11$$8, _12$$8, _21$$11, _22$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *columnList_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, column, *_0, _1, _2$$3, _4$$4; - zval columnList, bindCounts, columns; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columnList); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&readConnection); + ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&source); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&uniqueKey); + ZVAL_UNDEF(&tables); + ZVAL_UNDEF(&uniqueParams); + ZVAL_UNDEF(&dialect); + ZVAL_UNDEF(&row); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_13); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_19); + ZVAL_UNDEF(&_20); + ZVAL_UNDEF(&_23); + ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&escapeChar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(columnList) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_21$$11); + ZVAL_UNDEF(&_22$$11); + ZVAL_UNDEF(&fields); + ZVAL_UNDEF(&_18); + ZVAL_UNDEF(&_16$$9); + ZVAL_UNDEF(&_17$$10); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &columnList_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&columnList, columnList_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!ZEPHIR_IS_LONG(&_0, 0))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + zephir_get_class(&_2$$3, this_ptr, 0); + ZEPHIR_INIT_VAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, "The record cannot be refreshed because it does not exist or is deleted in '", &_2$$3, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 32, &_3$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Mvc/Model.zep", 2473); + ZEPHIR_MM_RESTORE(); + return; } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 433); + zephir_check_call_status(); + zephir_read_property(&_4, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_4); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); + zephir_check_call_status(); + if (zephir_is_true(&schema)) { + ZEPHIR_INIT_VAR(&table); + zephir_create_array(&table, 2, 0); + zephir_array_fast_append(&table, &schema); + zephir_array_fast_append(&table, &source); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + ZEPHIR_CPY_WRT(&table, &source); } - - - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_is_iterable(&columnList, 0, "phalcon/Db/Dialect.zep", 128); - if (Z_TYPE_P(&columnList) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&columnList), _0) - { - ZEPHIR_INIT_NVAR(&column); - ZVAL_COPY(&column, _0); - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getsqlcolumn", &_3, 40, &column, &escapeChar, &bindCounts); + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_4); + if (!(zephir_is_true(&uniqueKey))) { + ZEPHIR_CALL_METHOD(&_5$$6, this_ptr, "has", NULL, 0, &metaData, &readConnection); + zephir_check_call_status(); + if (UNEXPECTED(!zephir_is_true(&_5$$6))) { + ZEPHIR_INIT_VAR(&_6$$7); + object_init_ex(&_6$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$7); + zephir_get_class(&_7$$7, this_ptr, 0); + ZEPHIR_INIT_VAR(&_8$$7); + ZEPHIR_CONCAT_SVS(&_8$$7, "The record cannot be refreshed because it does not exist or is deleted in '", &_7$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", NULL, 32, &_8$$7); zephir_check_call_status(); - zephir_array_append(&columns, &_2$$3, PH_SEPARATE, "phalcon/Db/Dialect.zep", 125); + zephir_throw_exception_debug(&_6$$7, "phalcon/Mvc/Model.zep", 2498); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_read_property(&_9$$6, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_9$$6); + } + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueParams, &_4); + if (UNEXPECTED(Z_TYPE_P(&uniqueParams) != IS_ARRAY)) { + ZEPHIR_INIT_VAR(&_10$$8); + object_init_ex(&_10$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_11$$8); + zephir_get_class(&_11$$8, this_ptr, 0); + ZEPHIR_INIT_VAR(&_12$$8); + ZEPHIR_CONCAT_SVS(&_12$$8, "The record cannot be refreshed because it does not exist or is deleted in '", &_11$$8, "'"); + ZEPHIR_CALL_METHOD(NULL, &_10$$8, "__construct", NULL, 32, &_12$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$8, "phalcon/Mvc/Model.zep", 2509); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(&fields); + array_init(&fields); + ZEPHIR_CALL_METHOD(&_13, &metaData, "getattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + zephir_is_iterable(&_13, 0, "phalcon/Mvc/Model.zep", 2524); + if (Z_TYPE_P(&_13) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_13), _14) + { + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _14); + ZEPHIR_INIT_NVAR(&_16$$9); + zephir_create_array(&_16$$9, 1, 0); + zephir_array_fast_append(&_16$$9, &attribute); + zephir_array_append(&fields, &_16$$9, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2518); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &columnList, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_13, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &columnList, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_15, &_13, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!zend_is_true(&_15)) { break; } - ZEPHIR_CALL_METHOD(&column, &columnList, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&attribute, &_13, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$4, this_ptr, "getsqlcolumn", &_3, 40, &column, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_append(&columns, &_4$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 125); - ZEPHIR_CALL_METHOD(NULL, &columnList, "next", NULL, 0); + ZEPHIR_INIT_NVAR(&_17$$10); + zephir_create_array(&_17$$10, 1, 0); + zephir_array_fast_append(&_17$$10, &attribute); + zephir_array_append(&fields, &_17$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 2518); + ZEPHIR_CALL_METHOD(NULL, &_13, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&column); - zephir_fast_join_str(return_value, SL(", "), &columns); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Dialect, getCustomFunctions) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "customFunctions"); + ZEPHIR_INIT_NVAR(&attribute); + ZEPHIR_CALL_METHOD(&dialect, &readConnection, "getdialect", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_18); + zephir_create_array(&_18, 3, 0); + zephir_array_update_string(&_18, SL("columns"), &fields, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_19, &readConnection, "escapeidentifier", NULL, 0, &table); + zephir_check_call_status(); + zephir_array_update_string(&_18, SL("tables"), &_19, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_18, SL("where"), &uniqueKey, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&tables, &dialect, "select", NULL, 0, &_18); + zephir_check_call_status(); + zephir_read_property(&_4, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_20, 2); + ZEPHIR_CALL_METHOD(&row, &readConnection, "fetchone", NULL, 0, &tables, &_20, &uniqueParams, &_4); + zephir_check_call_status(); + if (Z_TYPE_P(&row) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + ZVAL_NULL(&_21$$11); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "assign", NULL, 0, &row, &_21$$11, &columnMap); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_22$$11, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + if (zephir_is_true(&_22$$11)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setsnapshotdata", NULL, 0, &row, &columnMap); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setoldsnapshotdata", NULL, 0, &row, &columnMap); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_VAR(&_23); + ZVAL_STRING(&_23, "afterFetch"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_23); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlColumn) +static PHP_METHOD(Phalcon_Mvc_Model, save) { - zend_bool _5, _3$$4, _4$$4; + zend_bool hasRelatedToSave = 0; + zval metaData, schema, writeConnection, readConnection, source, table, identityField, exists, success, relatedToSave, _0, _4, _1$$3, _2$$7, _3$$8, _5$$10, _6$$11, _7$$11, _8$$14, _9$$16, _10$$18, _11$$21, _12$$20; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts; - zval escapeChar; - zval *column = NULL, column_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, columnExpression, columnAlias, columnField, columnDomain, _6, _0$$3, _1$$6, _2$$7; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&columnExpression); - ZVAL_UNDEF(&columnAlias); - ZVAL_UNDEF(&columnField); - ZVAL_UNDEF(&columnDomain); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$6); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&writeConnection); + ZVAL_UNDEF(&readConnection); + ZVAL_UNDEF(&source); + ZVAL_UNDEF(&table); + ZVAL_UNDEF(&identityField); + ZVAL_UNDEF(&exists); + ZVAL_UNDEF(&success); + ZVAL_UNDEF(&relatedToSave); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$7); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&bindCounts); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(column) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_3$$8); + ZVAL_UNDEF(&_5$$10); + ZVAL_UNDEF(&_6$$11); + ZVAL_UNDEF(&_7$$11); + ZVAL_UNDEF(&_8$$14); + ZVAL_UNDEF(&_9$$16); + ZVAL_UNDEF(&_10$$18); + ZVAL_UNDEF(&_11$$21); + ZVAL_UNDEF(&_12$$20); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column, &escapeChar_param, &bindCounts_param); - ZEPHIR_SEPARATE_PARAM(column); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); + + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&writeConnection, this_ptr, "getwriteconnection", NULL, 423); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "prepareSave"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&relatedToSave, this_ptr, "collectrelatedtosave", NULL, 0); + zephir_check_call_status(); + hasRelatedToSave = zephir_fast_count_int(&relatedToSave) > 0; + if (hasRelatedToSave) { + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "presaverelatedrecords", NULL, 0, &writeConnection, &relatedToSave); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); + zephir_check_call_status(); + if (zephir_is_true(&schema)) { + ZEPHIR_INIT_VAR(&table); + zephir_create_array(&table, 2, 0); + zephir_array_fast_append(&table, &schema); + zephir_array_fast_append(&table, &source); } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_CPY_WRT(&table, &source); } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); + ZEPHIR_CALL_METHOD(&readConnection, this_ptr, "getreadconnection", NULL, 433); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&exists, this_ptr, "has", NULL, 0, &metaData, &readConnection); + zephir_check_call_status(); + if (zephir_is_true(&exists)) { + ZEPHIR_INIT_ZVAL_NREF(_2$$7); + ZVAL_LONG(&_2$$7, 2); + zephir_update_property_zval(this_ptr, ZEND_STRL("operationMade"), &_2$$7); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + ZEPHIR_INIT_ZVAL_NREF(_3$$8); + ZVAL_LONG(&_3$$8, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("operationMade"), &_3$$8); } - - - if (Z_TYPE_P(column) != IS_ARRAY) { - ZVAL_NULL(&_0$$3); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, column, &_0$$3, &escapeChar); + ZEPHIR_INIT_NVAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_0); + ZEPHIR_CALL_METHOD(&identityField, &metaData, "getidentityfield", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "presave", NULL, 0, &metaData, &exists, &identityField); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_4)) { + if (hasRelatedToSave) { + ZVAL_BOOL(&_5$$10, 0); + ZEPHIR_CALL_METHOD(NULL, &writeConnection, "rollback", NULL, 0, &_5$$10); + zephir_check_call_status(); + } + if (UNEXPECTED(ZEPHIR_GLOBAL(orm).exception_on_failed_save)) { + ZEPHIR_INIT_VAR(&_6$$11); + object_init_ex(&_6$$11, phalcon_mvc_model_validationfailed_ce); + ZEPHIR_CALL_METHOD(&_7$$11, this_ptr, "getmessages", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_6$$11, "__construct", NULL, 434, this_ptr, &_7$$11); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$11, "phalcon/Mvc/Model.zep", 2675); + ZEPHIR_MM_RESTORE(); + return; + } + RETURN_MM_BOOL(0); + } + if (zephir_is_true(&exists)) { + ZEPHIR_CALL_METHOD(&success, this_ptr, "dolowupdate", NULL, 0, &metaData, &writeConnection, &table); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(&success, this_ptr, "dolowinsert", NULL, 0, &metaData, &writeConnection, &table, &identityField); zephir_check_call_status(); - RETURN_MM(); } - if (!(zephir_array_isset_string(column, SL("type")))) { - ZEPHIR_OBS_VAR(&columnField); - zephir_array_fetch_long(&columnField, column, 0, PH_NOISY, "phalcon/Db/Dialect.zep", 160); - if (Z_TYPE_P(&columnField) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&columnExpression); - zephir_create_array(&columnExpression, 2, 0); - add_assoc_stringl_ex(&columnExpression, SL("type"), SL("scalar")); - zephir_array_update_string(&columnExpression, SL("value"), &columnField, PH_COPY | PH_SEPARATE); - } else if (ZEPHIR_IS_STRING_IDENTICAL(&columnField, "*")) { - ZEPHIR_INIT_VAR(&_1$$6); - zephir_create_array(&_1$$6, 1, 0); - add_assoc_stringl_ex(&_1$$6, SL("type"), SL("all")); - ZEPHIR_CPY_WRT(&columnExpression, &_1$$6); + if (zephir_is_true(&success)) { + ZEPHIR_INIT_ZVAL_NREF(_8$$14); + ZVAL_LONG(&_8$$14, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_8$$14); + } + if (hasRelatedToSave) { + if (ZEPHIR_IS_FALSE_IDENTICAL(&success)) { + ZVAL_BOOL(&_9$$16, 0); + ZEPHIR_CALL_METHOD(NULL, &writeConnection, "rollback", NULL, 0, &_9$$16); + zephir_check_call_status(); } else { - ZEPHIR_INIT_VAR(&_2$$7); - zephir_create_array(&_2$$7, 2, 0); - add_assoc_stringl_ex(&_2$$7, SL("type"), SL("qualified")); - zephir_array_update_string(&_2$$7, SL("name"), &columnField, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(&columnExpression, &_2$$7); - } - ZEPHIR_OBS_VAR(&columnDomain); - _3$$4 = zephir_array_isset_long_fetch(&columnDomain, column, 1, 0); - if (_3$$4) { - _3$$4 = !ZEPHIR_IS_STRING_IDENTICAL(&columnDomain, ""); - } - if (_3$$4) { - zephir_array_update_string(&columnExpression, SL("domain"), &columnDomain, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&columnAlias); - _4$$4 = zephir_array_isset_long_fetch(&columnAlias, column, 2, 0); - if (_4$$4) { - _4$$4 = zephir_is_true(&columnAlias); - } - if (_4$$4) { - zephir_array_update_string(&columnExpression, SL("sqlAlias"), &columnAlias, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&success, this_ptr, "postsaverelatedrecords", NULL, 0, &writeConnection, &relatedToSave); + zephir_check_call_status(); } + } + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_CALL_METHOD(&_10$$18, this_ptr, "postsave", NULL, 0, &success, &exists); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&success, &_10$$18); + } + if (ZEPHIR_IS_FALSE_IDENTICAL(&success)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); + zephir_check_call_status(); } else { - ZEPHIR_CPY_WRT(&columnExpression, column); + if (hasRelatedToSave) { + ZEPHIR_INIT_VAR(&_11$$21); + array_init(&_11$$21); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyRelated"), &_11$$21); + } + ZEPHIR_INIT_VAR(&_12$$20); + ZVAL_STRING(&_12$$20, "afterSave"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_12$$20); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(column, this_ptr, "getsqlexpression", NULL, 0, &columnExpression, &escapeChar, &bindCounts); + RETURN_CCTOR(&success); +} + +static PHP_METHOD(Phalcon_Mvc_Model, serialize) +{ + zval _6; + zend_bool _2, _3; + zval attributes, manager, dirtyState, snapshot, _0, _1, _4, _5$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&dirtyState); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&snapshot); + ZVAL_NULL(&snapshot); + ZEPHIR_CALL_METHOD(&attributes, this_ptr, "toarray", NULL, 0); zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&columnAlias); - _5 = zephir_array_isset_string_fetch(&columnAlias, &columnExpression, SL("sqlAlias"), 0); - if (!(_5)) { - ZEPHIR_OBS_NVAR(&columnAlias); - _5 = zephir_array_isset_string_fetch(&columnAlias, &columnExpression, SL("alias"), 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dirtyState, &_0); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + ZEPHIR_CALL_METHOD(&_1, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + _2 = zephir_is_true(&_1); + if (_2) { + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + _2 = Z_TYPE_P(&_0) != IS_NULL; } - if (_5) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", NULL, 0, column, &columnAlias, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); + _3 = _2; + if (_3) { + zephir_read_property(&_4, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + _3 = !ZEPHIR_IS_EQUAL(&attributes, &_4); } - ZVAL_NULL(&_6); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", NULL, 0, column, &_6, &escapeChar); + if (_3) { + zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&snapshot, &_5$$3); + } + ZEPHIR_INIT_VAR(&_6); + zephir_create_array(&_6, 3, 0); + zephir_array_update_string(&_6, SL("attributes"), &attributes, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_6, SL("snapshot"), &snapshot, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_6, SL("dirtyState"), &dirtyState, PH_COPY | PH_SEPARATE); + ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 15, &_6); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) +static PHP_METHOD(Phalcon_Mvc_Model, unserialize) { - zend_bool _1$$9; + zend_string *_13$$7; + zend_ulong _12$$7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS, i = 0, _2$$9; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, type, times, postTimes, rawValue, value, _11, _12, _0$$7, _3$$9, _4$$11, _5$$11, _6$$8, _7$$14, _8$$14, _9$$18, _10$$18; - zval expression, bindCounts, placeholders; + zephir_fcall_cache_entry *_1 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *data, data_sub, attributes, container, manager, key, value, snapshot, properties, dirtyState, _0$$4, _2$$5, _3$$5, _4$$5, _5$$3, _6$$3, _7$$6, _8$$6, _9$$6, *_10$$7, _11$$7; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(×); - ZVAL_UNDEF(&postTimes); - ZVAL_UNDEF(&rawValue); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_0$$7); - ZVAL_UNDEF(&_3$$9); - ZVAL_UNDEF(&_4$$11); - ZVAL_UNDEF(&_5$$11); - ZVAL_UNDEF(&_6$$8); - ZVAL_UNDEF(&_7$$14); - ZVAL_UNDEF(&_8$$14); - ZVAL_UNDEF(&_9$$18); - ZVAL_UNDEF(&_10$$18); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&properties); + ZVAL_UNDEF(&dirtyState); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$6); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_11$$7); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(data) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 1, 0, &data); - ZEPHIR_OBS_VAR(&type); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&type, &expression, SL("type"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/Db/Dialect.zep", 224); - return; - } - do { - if (ZEPHIR_IS_STRING(&type, "scalar")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionscalar", NULL, 41, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_CALL_FUNCTION(&attributes, "unserialize", NULL, 16, data); + zephir_check_call_status(); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + if (!(zephir_array_isset_string(&attributes, SL("attributes")))) { + ZEPHIR_INIT_VAR(&_0$$4); + zephir_create_array(&_0$$4, 1, 0); + zephir_array_update_string(&_0$$4, SL("attributes"), &attributes, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&attributes, &_0$$4); } - if (ZEPHIR_IS_STRING(&type, "object")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionobject", NULL, 42, &expression, &escapeChar, &bindCounts); + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_1, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_INIT_VAR(&_2$$5); + object_init_ex(&_2$$5, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_3$$5); + zephir_get_class(&_3$$5, this_ptr, 0); + ZEPHIR_INIT_VAR(&_4$$5); + ZEPHIR_CONCAT_SVS(&_4$$5, "A dependency injection container is required to access the services related to the ODM in '", &_3$$5, "'"); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 32, &_4$$5); zephir_check_call_status(); - RETURN_MM(); + zephir_throw_exception_debug(&_2$$5, "phalcon/Mvc/Model.zep", 2794); + ZEPHIR_MM_RESTORE(); + return; } - if (ZEPHIR_IS_STRING(&type, "qualified")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionqualified", NULL, 43, &expression, &escapeChar); + zephir_update_property_zval(this_ptr, ZEND_STRL("container"), &container); + ZEPHIR_INIT_VAR(&_6$$3); + ZVAL_STRING(&_6$$3, "modelsManager"); + ZEPHIR_CALL_METHOD(&_5$$3, &container, "getshared", NULL, 0, &_6$$3); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_5$$3); + if (UNEXPECTED(Z_TYPE_P(&manager) != IS_OBJECT)) { + ZEPHIR_INIT_VAR(&_7$$6); + object_init_ex(&_7$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_8$$6); + zephir_get_class(&_8$$6, this_ptr, 0); + ZEPHIR_INIT_VAR(&_9$$6); + ZEPHIR_CONCAT_SVS(&_9$$6, "The injected service 'modelsManager' is not valid in '", &_8$$6, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", NULL, 32, &_9$$6); zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "literal")) { - zephir_array_fetch_string(&_0$$7, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 258); - RETURN_CTOR(&_0$$7); + zephir_throw_exception_debug(&_7$$6, "phalcon/Mvc/Model.zep", 2810); + ZEPHIR_MM_RESTORE(); + return; } - if (ZEPHIR_IS_STRING(&type, "placeholder")) { - ZEPHIR_OBS_VAR(×); - if (zephir_array_isset_string_fetch(×, &expression, SL("times"), 0)) { - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); - ZEPHIR_OBS_VAR(&rawValue); - zephir_array_fetch_string(&rawValue, &expression, SL("rawValue"), PH_NOISY, "phalcon/Db/Dialect.zep", 264); - ZEPHIR_OBS_VAR(&value); - zephir_array_fetch_string(&value, &expression, SL("value"), PH_NOISY, "phalcon/Db/Dialect.zep", 265); - ZEPHIR_OBS_VAR(&postTimes); - if (zephir_array_isset_fetch(&postTimes, &bindCounts, &rawValue, 0)) { - ZEPHIR_CPY_WRT(×, &postTimes); - } - ZEPHIR_CPY_WRT(&_3$$9, ×); - _2$$9 = 1; - _1$$9 = 0; - if (ZEPHIR_GE_LONG(&_3$$9, _2$$9)) { - while (1) { - if (_1$$9) { - _2$$9++; - if (!(ZEPHIR_GE_LONG(&_3$$9, _2$$9))) { - break; - } - } else { - _1$$9 = 1; - } - i = _2$$9; - ZEPHIR_INIT_NVAR(&_4$$11); - ZVAL_LONG(&_4$$11, ((i - 1))); - ZEPHIR_INIT_NVAR(&_5$$11); - ZEPHIR_CONCAT_VV(&_5$$11, &value, &_4$$11); - zephir_array_append(&placeholders, &_5$$11, PH_SEPARATE, "phalcon/Db/Dialect.zep", 272); + zephir_update_property_zval(this_ptr, ZEND_STRL("modelsManager"), &manager); + ZEPHIR_CALL_METHOD(NULL, &manager, "initialize", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&properties); + if (zephir_array_isset_string_fetch(&properties, &attributes, SL("attributes"), 0)) { + zephir_is_iterable(&properties, 0, "phalcon/Mvc/Model.zep", 2833); + if (Z_TYPE_P(&properties) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&properties), _12$$7, _13$$7, _10$$7) + { + ZEPHIR_INIT_NVAR(&key); + if (_13$$7 != NULL) { + ZVAL_STR_COPY(&key, _13$$7); + } else { + ZVAL_LONG(&key, _12$$7); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _10$$7); + zephir_update_property_zval_zval(this_ptr, &key, &value); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_11$$7, &properties, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_11$$7)) { + break; } + ZEPHIR_CALL_METHOD(&key, &properties, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &properties, "current", NULL, 0); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &key, &value); + ZEPHIR_CALL_METHOD(NULL, &properties, "next", NULL, 0); + zephir_check_call_status(); } - zephir_fast_join_str(return_value, SL(", "), &placeholders); - RETURN_MM(); } - zephir_array_fetch_string(&_6$$8, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 278); - RETURN_CTOR(&_6$$8); - } - if (ZEPHIR_IS_STRING(&type, "binary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionbinaryoperations", NULL, 44, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "unary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionunaryoperations", NULL, 45, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "parentheses")) { - zephir_array_fetch_string(&_8$$14, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 304); - ZEPHIR_CALL_METHOD(&_7$$14, this_ptr, "getsqlexpression", NULL, 46, &_8$$14, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_7$$14, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "functionCall")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionfunctioncall", NULL, 47, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "list")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionlist", NULL, 48, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "all")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionall", NULL, 49, &expression, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "select")) { - zephir_array_fetch_string(&_10$$18, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 336); - ZEPHIR_CALL_METHOD(&_9$$18, this_ptr, "select", NULL, 0, &_10$$18); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_9$$18, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "cast")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncastvalue", NULL, 50, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + } else { + ZEPHIR_INIT_NVAR(&properties); + array_init(&properties); } - if (ZEPHIR_IS_STRING(&type, "convert")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionconvertvalue", NULL, 51, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_OBS_VAR(&dirtyState); + if (zephir_array_isset_string_fetch(&dirtyState, &attributes, SL("dirtyState"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &dirtyState); } - if (ZEPHIR_IS_STRING(&type, "case")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncase", NULL, 52, &expression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_CALL_METHOD(&_5$$3, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + if (zephir_is_true(&_5$$3)) { + if (zephir_array_isset_string_fetch(&snapshot, &attributes, SL("snapshot"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &properties); + } } - } while(0); - - ZEPHIR_INIT_VAR(&_11); - object_init_ex(&_11, phalcon_db_exception_ce); - ZEPHIR_INIT_VAR(&_12); - ZEPHIR_CONCAT_SVS(&_12, "Invalid SQL expression type '", &type, "'"); - ZEPHIR_CALL_METHOD(NULL, &_11, "__construct", NULL, 29, &_12); - zephir_check_call_status(); - zephir_throw_exception_debug(&_11, "phalcon/Db/Dialect.zep", 369); + } ZEPHIR_MM_RESTORE(); - return; } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) +static PHP_METHOD(Phalcon_Mvc_Model, setConnectionService) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *table, table_sub, *escapeChar_param = NULL, tableName, schemaName, aliasName; + zval *connectionService_param = NULL, _0; + zval connectionService; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table_sub); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&aliasName); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&connectionService); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(connectionService) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table, &escapeChar_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); + zephir_fetch_params(1, 1, 0, &connectionService_param); + if (UNEXPECTED(Z_TYPE_P(connectionService_param) != IS_STRING && Z_TYPE_P(connectionService_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'connectionService' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(connectionService_param) == IS_STRING)) { + zephir_get_strval(&connectionService, connectionService_param); } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_INIT_VAR(&connectionService); } - if (Z_TYPE_P(table) == IS_ARRAY) { - ZEPHIR_OBS_VAR(&tableName); - zephir_array_fetch_long(&tableName, table, 0, PH_NOISY, "phalcon/Db/Dialect.zep", 385); - ZEPHIR_OBS_VAR(&schemaName); - zephir_array_isset_long_fetch(&schemaName, table, 1, 0); - ZEPHIR_OBS_VAR(&aliasName); - zephir_array_isset_long_fetch(&aliasName, table, 2, 0); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparetable", NULL, 0, &tableName, &schemaName, &aliasName, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, table, &escapeChar); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setconnectionservice", NULL, 0, this_ptr, &connectionService); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, limit) +static PHP_METHOD(Phalcon_Mvc_Model, setDirtyState) { - zend_bool _2$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL, *number, number_sub, _0$$3, _1$$3, _3$$3, _4$$4, _5$$4; - zval sqlQuery; + zval *dirtyState_param = NULL, _0; + zend_long dirtyState; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&number_sub); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(sqlQuery) - Z_PARAM_ZVAL(number) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(dirtyState) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - } + zephir_fetch_params_without_memory_grow(1, 0, &dirtyState_param); + dirtyState = zephir_get_intval(dirtyState_param); - if (Z_TYPE_P(number) == IS_ARRAY) { - zephir_array_fetch_long(&_0$$3, number, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 428); - ZEPHIR_INIT_VAR(&_1$$3); - ZEPHIR_CONCAT_SV(&_1$$3, " LIMIT ", &_0$$3); - zephir_concat_self(&sqlQuery, &_1$$3); - _2$$3 = zephir_array_isset_long(number, 1); - if (_2$$3) { - zephir_array_fetch_long(&_3$$3, number, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 430); - _2$$3 = ((zephir_fast_strlen_ev(&_3$$3)) ? 1 : 0); - } - if (_2$$3) { - zephir_array_fetch_long(&_4$$4, number, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 431); - ZEPHIR_INIT_VAR(&_5$$4); - ZEPHIR_CONCAT_SV(&_5$$4, " OFFSET ", &_4$$4); - zephir_concat_self(&sqlQuery, &_5$$4); - } - RETURN_CTOR(&sqlQuery); - } - ZEPHIR_CONCAT_VSV(return_value, &sqlQuery, " LIMIT ", number); - RETURN_MM(); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, dirtyState); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_0); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Dialect, registerCustomFunction) +static PHP_METHOD(Phalcon_Mvc_Model, setEventsManager) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, *customFunction, customFunction_sub; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *eventsManager, eventsManager_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&customFunction_sub); + ZVAL_UNDEF(&eventsManager_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ZVAL(customFunction) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &customFunction); - zephir_get_strval(&name, name_param); + zephir_fetch_params(1, 1, 0, &eventsManager); - zephir_update_property_array(this_ptr, SL("customFunctions"), &name, customFunction); - RETURN_THIS(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setcustomeventsmanager", NULL, 0, this_ptr, eventsManager); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, releaseSavepoint) +static PHP_METHOD(Phalcon_Mvc_Model, setReadConnectionService) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connectionService_param = NULL, _0; + zval connectionService; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&connectionService); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_STR(connectionService) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + zephir_fetch_params(1, 1, 0, &connectionService_param); + if (UNEXPECTED(Z_TYPE_P(connectionService_param) != IS_STRING && Z_TYPE_P(connectionService_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'connectionService' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(connectionService_param) == IS_STRING)) { + zephir_get_strval(&connectionService, connectionService_param); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_INIT_VAR(&connectionService); } - ZEPHIR_CONCAT_SV(return_value, "RELEASE SAVEPOINT ", &name); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setreadconnectionservice", NULL, 0, this_ptr, &connectionService); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, rollbackSavepoint) +static PHP_METHOD(Phalcon_Mvc_Model, setOldSnapshotData) { + zend_string *_3$$3; + zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL; - zval name; + zephir_fcall_cache_entry *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _4$$7, _5$$7, _6$$7, _8$$10, _9$$10, _10$$10, _11$$14, _12$$14, _13$$14, _14$$17, _15$$17, _16$$17; + zval data, snapshot; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif - + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&columnMap_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_8$$10); + ZVAL_UNDEF(&_9$$10); + ZVAL_UNDEF(&_10$$10); + ZVAL_UNDEF(&_11$$14); + ZVAL_UNDEF(&_12$$14); + ZVAL_UNDEF(&_13$$14); + ZVAL_UNDEF(&_14$$17); + ZVAL_UNDEF(&_15$$17); + ZVAL_UNDEF(&_16$$17); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(data) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(columnMap) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); + zephir_fetch_params(1, 1, 1, &data_param, &columnMap); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!columnMap) { + columnMap = &columnMap_sub; + columnMap = &__$null; } - ZEPHIR_CONCAT_SV(return_value, "ROLLBACK TO SAVEPOINT ", &name); - RETURN_MM(); + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&snapshot); + array_init(&snapshot); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 2951); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2$$3, _3$$3, _0$$3) + { + ZEPHIR_INIT_NVAR(&key); + if (_3$$3 != NULL) { + ZVAL_STR_COPY(&key, _3$$3); + } else { + ZVAL_LONG(&key, _2$$3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0$$3); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_4$$7); + object_init_ex(&_4$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_5$$7); + zephir_get_class(&_5$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_6$$7); + ZEPHIR_CONCAT_SVSVS(&_6$$7, "Column '", &key, "' doesn't make part of the column map in '", &_5$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_4$$7, "__construct", &_7, 32, &_6$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_4$$7, "phalcon/Mvc/Model.zep", 2931); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_8$$10); + object_init_ex(&_8$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$10); + zephir_get_class(&_9$$10, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$10); + ZEPHIR_CONCAT_SVSVS(&_10$$10, "Column '", &key, "' doesn't make part of the column map in '", &_9$$10, "'"); + ZEPHIR_CALL_METHOD(NULL, &_8$$10, "__construct", &_7, 32, &_10$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(&_8$$10, "phalcon/Mvc/Model.zep", 2942); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + zephir_array_update_zval(&snapshot, &attribute, &value, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_11$$14); + object_init_ex(&_11$$14, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$14); + zephir_get_class(&_12$$14, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$14); + ZEPHIR_CONCAT_SVSVS(&_13$$14, "Column '", &key, "' doesn't make part of the column map in '", &_12$$14, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$14, "__construct", &_7, 32, &_13$$14); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$14, "phalcon/Mvc/Model.zep", 2931); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_14$$17); + object_init_ex(&_14$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$17); + zephir_get_class(&_15$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$17); + ZEPHIR_CONCAT_SVSVS(&_16$$17, "Column '", &key, "' doesn't make part of the column map in '", &_15$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_14$$17, "__construct", &_7, 32, &_16$$17); + zephir_check_call_status(); + zephir_throw_exception_debug(&_14$$17, "phalcon/Mvc/Model.zep", 2942); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + zephir_array_update_zval(&snapshot, &attribute, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + } else { + ZEPHIR_CPY_WRT(&snapshot, &data); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, select) +static PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) { - zend_bool _5, _9, _12, _15, _18, _21, _23; + zend_bool _4$$4, _14$$12; + zend_string *_3$$3; + zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *definition_param = NULL, tables, columns, sql, distinct, joins, where, escapeChar, groupBy, having, orderBy, limit, forUpdate, bindCounts, _0, _1, _2, _3, _4, _6$$10, _7$$10, _8$$10, _10$$11, _11$$11, _13$$12, _14$$12, _16$$13, _17$$13, _19$$14, _20$$14; - zval definition, _22$$15; + zval *data_param = NULL, *columnMap = NULL, columnMap_sub, __$null, key, value, attribute, *_0$$3, _1$$3, _5$$6, _7$$8, _8$$8, _9$$8, _11$$11, _12$$11, _13$$11, _15$$14, _16$$16, _17$$16, _18$$16, _19$$19, _20$$19, _21$$19; + zval data, snapshot; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&_22$$15); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&distinct); - ZVAL_UNDEF(&joins); - ZVAL_UNDEF(&where); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&groupBy); - ZVAL_UNDEF(&having); - ZVAL_UNDEF(&orderBy); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&forUpdate); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6$$10); - ZVAL_UNDEF(&_7$$10); - ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&columnMap_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_7$$8); + ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_9$$8); ZVAL_UNDEF(&_11$$11); - ZVAL_UNDEF(&_13$$12); - ZVAL_UNDEF(&_14$$12); - ZVAL_UNDEF(&_16$$13); - ZVAL_UNDEF(&_17$$13); - ZVAL_UNDEF(&_19$$14); - ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_13$$11); + ZVAL_UNDEF(&_15$$14); + ZVAL_UNDEF(&_16$$16); + ZVAL_UNDEF(&_17$$16); + ZVAL_UNDEF(&_18$$16); + ZVAL_UNDEF(&_19$$19); + ZVAL_UNDEF(&_20$$19); + ZVAL_UNDEF(&_21$$19); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(data) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(columnMap) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &definition_param); - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + zephir_fetch_params(1, 1, 1, &data_param, &columnMap); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!columnMap) { + columnMap = &columnMap_sub; + columnMap = &__$null; + } - ZEPHIR_OBS_VAR(&tables); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&tables, &definition, SL("tables"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'tables' is required in the definition array", "phalcon/Db/Dialect.zep", 477); - return; - } - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/Db/Dialect.zep", 483); - return; - } - ZEPHIR_OBS_VAR(&distinct); - if (zephir_array_isset_string_fetch(&distinct, &definition, SL("distinct"), 0)) { - ZEPHIR_INIT_VAR(&sql); - if (zephir_is_true(&distinct)) { - ZVAL_STRING(&sql, "SELECT DISTINCT"); + if (Z_TYPE_P(columnMap) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&snapshot); + array_init(&snapshot); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model.zep", 3016); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2$$3, _3$$3, _0$$3) + { + ZEPHIR_INIT_NVAR(&key); + if (_3$$3 != NULL) { + ZVAL_STR_COPY(&key, _3$$3); + } else { + ZVAL_LONG(&key, _2$$3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0$$3); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + _4$$4 = !(zephir_array_isset(columnMap, &key)); + if (_4$$4) { + _4$$4 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_4$$4) { + ZEPHIR_CALL_SELF(&_5$$6, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&key, &_5$$6); + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_7$$8); + object_init_ex(&_7$$8, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_8$$8); + zephir_get_class(&_8$$8, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_9$$8); + ZEPHIR_CONCAT_SVSVS(&_9$$8, "Column '", &key, "' doesn't make part of the column map in '", &_8$$8, "'"); + ZEPHIR_CALL_METHOD(NULL, &_7$$8, "__construct", &_10, 32, &_9$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(&_7$$8, "phalcon/Mvc/Model.zep", 2996); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_11$$11); + object_init_ex(&_11$$11, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$11); + zephir_get_class(&_12$$11, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_13$$11); + ZEPHIR_CONCAT_SVSVS(&_13$$11, "Column '", &key, "' doesn't make part of the column map in '", &_12$$11, "'"); + ZEPHIR_CALL_METHOD(NULL, &_11$$11, "__construct", &_10, 32, &_13$$11); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$11, "phalcon/Mvc/Model.zep", 3007); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + zephir_array_update_zval(&snapshot, &attribute, &value, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); } else { - ZVAL_STRING(&sql, "SELECT ALL"); + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&key) != IS_STRING) { + continue; + } + _14$$12 = !(zephir_array_isset(columnMap, &key)); + if (_14$$12) { + _14$$12 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_14$$12) { + ZEPHIR_CALL_SELF(&_15$$14, "caseinsensitivecolumnmap", &_6, 422, columnMap, &key); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&key, &_15$$14); + } + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_fetch(&attribute, columnMap, &key, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_16$$16); + object_init_ex(&_16$$16, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$16); + zephir_get_class(&_17$$16, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_18$$16); + ZEPHIR_CONCAT_SVSVS(&_18$$16, "Column '", &key, "' doesn't make part of the column map in '", &_17$$16, "'"); + ZEPHIR_CALL_METHOD(NULL, &_16$$16, "__construct", &_10, 32, &_18$$16); + zephir_check_call_status(); + zephir_throw_exception_debug(&_16$$16, "phalcon/Mvc/Model.zep", 2996); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + if (Z_TYPE_P(&attribute) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attribute); + if (!(zephir_array_isset_long_fetch(&attribute, &attribute, 0, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_19$$19); + object_init_ex(&_19$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_20$$19); + zephir_get_class(&_20$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_21$$19); + ZEPHIR_CONCAT_SVSVS(&_21$$19, "Column '", &key, "' doesn't make part of the column map in '", &_20$$19, "'"); + ZEPHIR_CALL_METHOD(NULL, &_19$$19, "__construct", &_10, 32, &_21$$19); + zephir_check_call_status(); + zephir_throw_exception_debug(&_19$$19, "phalcon/Mvc/Model.zep", 3007); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } + } + zephir_array_update_zval(&snapshot, &attribute, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); } else { - ZEPHIR_INIT_NVAR(&sql); - ZVAL_STRING(&sql, "SELECT"); - } - ZEPHIR_OBS_VAR(&bindCounts); - zephir_array_isset_string_fetch(&bindCounts, &definition, SL("bindCounts"), 0); - if (Z_TYPE_P(&bindCounts) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(&bindCounts); - array_init(&bindCounts); - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("escapeChar"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&escapeChar, &_0); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &columns, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SV(&_2, " ", &_1); - zephir_concat_self(&sql, &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpressionfrom", NULL, 55, &tables, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_SV(&_4, " ", &_3); - zephir_concat_self(&sql, &_4); - ZEPHIR_OBS_VAR(&joins); - _5 = zephir_array_isset_string_fetch(&joins, &definition, SL("joins"), 0); - if (_5) { - _5 = zephir_is_true(&joins); - } - if (_5) { - zephir_array_fetch_string(&_7$$10, &definition, SL("joins"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 517); - ZEPHIR_CALL_METHOD(&_6$$10, this_ptr, "getsqlexpressionjoins", NULL, 56, &_7$$10, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_8$$10); - ZEPHIR_CONCAT_SV(&_8$$10, " ", &_6$$10); - zephir_concat_self(&sql, &_8$$10); - } - ZEPHIR_OBS_VAR(&where); - _9 = zephir_array_isset_string_fetch(&where, &definition, SL("where"), 0); - if (_9) { - _9 = zephir_is_true(&where); - } - if (_9) { - ZEPHIR_CALL_METHOD(&_10$$11, this_ptr, "getsqlexpressionwhere", NULL, 57, &where, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_11$$11); - ZEPHIR_CONCAT_SV(&_11$$11, " ", &_10$$11); - zephir_concat_self(&sql, &_11$$11); - } - ZEPHIR_OBS_VAR(&groupBy); - _12 = zephir_array_isset_string_fetch(&groupBy, &definition, SL("group"), 0); - if (_12) { - _12 = zephir_is_true(&groupBy); - } - if (_12) { - ZEPHIR_CALL_METHOD(&_13$$12, this_ptr, "getsqlexpressiongroupby", NULL, 58, &groupBy, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_14$$12); - ZEPHIR_CONCAT_SV(&_14$$12, " ", &_13$$12); - zephir_concat_self(&sql, &_14$$12); - } - ZEPHIR_OBS_VAR(&having); - _15 = zephir_array_isset_string_fetch(&having, &definition, SL("having"), 0); - if (_15) { - _15 = zephir_is_true(&having); - } - if (_15) { - ZEPHIR_CALL_METHOD(&_16$$13, this_ptr, "getsqlexpressionhaving", NULL, 59, &having, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_17$$13); - ZEPHIR_CONCAT_SV(&_17$$13, " ", &_16$$13); - zephir_concat_self(&sql, &_17$$13); - } - ZEPHIR_OBS_VAR(&orderBy); - _18 = zephir_array_isset_string_fetch(&orderBy, &definition, SL("order"), 0); - if (_18) { - _18 = zephir_is_true(&orderBy); - } - if (_18) { - ZEPHIR_CALL_METHOD(&_19$$14, this_ptr, "getsqlexpressionorderby", NULL, 60, &orderBy, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_20$$14); - ZEPHIR_CONCAT_SV(&_20$$14, " ", &_19$$14); - zephir_concat_self(&sql, &_20$$14); - } - ZEPHIR_OBS_VAR(&limit); - _21 = zephir_array_isset_string_fetch(&limit, &definition, SL("limit"), 0); - if (_21) { - _21 = zephir_is_true(&limit); - } - if (_21) { - ZEPHIR_INIT_VAR(&_22$$15); - zephir_create_array(&_22$$15, 2, 0); - zephir_array_update_string(&_22$$15, SL("sql"), &sql, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_22$$15, SL("value"), &limit, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sql, this_ptr, "getsqlexpressionlimit", NULL, 61, &_22$$15, &escapeChar, &bindCounts); - zephir_check_call_status(); - } - _23 = zephir_array_isset_string_fetch(&forUpdate, &definition, SL("forUpdate"), 1); - if (_23) { - _23 = zephir_is_true(&forUpdate); - } - if (_23) { - zephir_concat_self_str(&sql, SL(" FOR UPDATE")); + ZEPHIR_CPY_WRT(&snapshot, &data); } - RETURN_CCTOR(&sql); -} - -static PHP_METHOD(Phalcon_Db_Dialect, supportsSavepoints) -{ - zval *this_ptr = getThis(); - - - - RETURN_BOOL(1); -} - -static PHP_METHOD(Phalcon_Db_Dialect, supportsReleaseSavepoints) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, getColumnSize) +static PHP_METHOD(Phalcon_Mvc_Model, setTransaction) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; + zval *transaction, transaction_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&transaction_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_OBJECT_OF_CLASS(transaction, phalcon_mvc_model_transactioninterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params_without_memory_grow(1, 0, &transaction); - ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_0, ")"); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("transaction"), transaction); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Dialect, getColumnSizeAndScale) +static PHP_METHOD(Phalcon_Mvc_Model, getTransaction) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, column, "getscale", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(", &_0, ",", &_1, ")"); - RETURN_MM(); + RETURN_MEMBER(getThis(), "transaction"); } -static PHP_METHOD(Phalcon_Db_Dialect, checkColumnType) +static PHP_METHOD(Phalcon_Mvc_Model, setup) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; + zval *options_param = NULL, disableEvents, columnRenaming, notNullValidations, exceptionOnFailedSave, exceptionOnFailedMetaDataSave, phqlLiterals, virtualForeignKeys, lateStateBinding, castOnHydrate, ignoreUnknownColumns, updateSnapshotOnSave, disableAssignSetters, caseInsensitiveColumnMap, prefetchRecords, lastInsertId; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&options); + ZVAL_UNDEF(&disableEvents); + ZVAL_UNDEF(&columnRenaming); + ZVAL_UNDEF(¬NullValidations); + ZVAL_UNDEF(&exceptionOnFailedSave); + ZVAL_UNDEF(&exceptionOnFailedMetaDataSave); + ZVAL_UNDEF(&phqlLiterals); + ZVAL_UNDEF(&virtualForeignKeys); + ZVAL_UNDEF(&lateStateBinding); + ZVAL_UNDEF(&castOnHydrate); + ZVAL_UNDEF(&ignoreUnknownColumns); + ZVAL_UNDEF(&updateSnapshotOnSave); + ZVAL_UNDEF(&disableAssignSetters); + ZVAL_UNDEF(&caseInsensitiveColumnMap); + ZVAL_UNDEF(&prefetchRecords); + ZVAL_UNDEF(&lastInsertId); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 0, &options_param); + ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); - ZEPHIR_CALL_METHOD(&_0, column, "gettype", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&_0) == IS_STRING) { - ZEPHIR_RETURN_CALL_METHOD(column, "gettypereference", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_OBS_VAR(&disableEvents); + if (zephir_array_isset_string_fetch(&disableEvents, &options, SL("events"), 0)) { + ZEPHIR_GLOBAL(orm).events = zend_is_true(&disableEvents); } - ZEPHIR_RETURN_CALL_METHOD(column, "gettype", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_OBS_VAR(&virtualForeignKeys); + if (zephir_array_isset_string_fetch(&virtualForeignKeys, &options, SL("virtualForeignKeys"), 0)) { + ZEPHIR_GLOBAL(orm).virtual_foreign_keys = zend_is_true(&virtualForeignKeys); + } + ZEPHIR_OBS_VAR(&columnRenaming); + if (zephir_array_isset_string_fetch(&columnRenaming, &options, SL("columnRenaming"), 0)) { + ZEPHIR_GLOBAL(orm).column_renaming = zend_is_true(&columnRenaming); + } + ZEPHIR_OBS_VAR(¬NullValidations); + if (zephir_array_isset_string_fetch(¬NullValidations, &options, SL("notNullValidations"), 0)) { + ZEPHIR_GLOBAL(orm).not_null_validations = zend_is_true(¬NullValidations); + } + ZEPHIR_OBS_VAR(&exceptionOnFailedSave); + if (zephir_array_isset_string_fetch(&exceptionOnFailedSave, &options, SL("exceptionOnFailedSave"), 0)) { + ZEPHIR_GLOBAL(orm).exception_on_failed_save = zend_is_true(&exceptionOnFailedSave); + } + ZEPHIR_OBS_VAR(&exceptionOnFailedMetaDataSave); + if (zephir_array_isset_string_fetch(&exceptionOnFailedMetaDataSave, &options, SL("exceptionOnFailedMetaDataSave"), 0)) { + ZEPHIR_GLOBAL(orm).exception_on_failed_metadata_save = zend_is_true(&exceptionOnFailedMetaDataSave); + } + ZEPHIR_OBS_VAR(&phqlLiterals); + if (zephir_array_isset_string_fetch(&phqlLiterals, &options, SL("phqlLiterals"), 0)) { + ZEPHIR_GLOBAL(orm).enable_literals = zend_is_true(&phqlLiterals); + } + ZEPHIR_OBS_VAR(&lateStateBinding); + if (zephir_array_isset_string_fetch(&lateStateBinding, &options, SL("lateStateBinding"), 0)) { + ZEPHIR_GLOBAL(orm).late_state_binding = zend_is_true(&lateStateBinding); + } + ZEPHIR_OBS_VAR(&castOnHydrate); + if (zephir_array_isset_string_fetch(&castOnHydrate, &options, SL("castOnHydrate"), 0)) { + ZEPHIR_GLOBAL(orm).cast_on_hydrate = zend_is_true(&castOnHydrate); + } + ZEPHIR_OBS_VAR(&ignoreUnknownColumns); + if (zephir_array_isset_string_fetch(&ignoreUnknownColumns, &options, SL("ignoreUnknownColumns"), 0)) { + ZEPHIR_GLOBAL(orm).ignore_unknown_columns = zend_is_true(&ignoreUnknownColumns); + } + ZEPHIR_OBS_VAR(&caseInsensitiveColumnMap); + if (zephir_array_isset_string_fetch(&caseInsensitiveColumnMap, &options, SL("caseInsensitiveColumnMap"), 0)) { + ZEPHIR_GLOBAL(orm).case_insensitive_column_map = zend_is_true(&caseInsensitiveColumnMap); + } + ZEPHIR_OBS_VAR(&updateSnapshotOnSave); + if (zephir_array_isset_string_fetch(&updateSnapshotOnSave, &options, SL("updateSnapshotOnSave"), 0)) { + ZEPHIR_GLOBAL(orm).update_snapshot_on_save = zend_is_true(&updateSnapshotOnSave); + } + ZEPHIR_OBS_VAR(&disableAssignSetters); + if (zephir_array_isset_string_fetch(&disableAssignSetters, &options, SL("disableAssignSetters"), 0)) { + ZEPHIR_GLOBAL(orm).disable_assign_setters = zend_is_true(&disableAssignSetters); + } + ZEPHIR_OBS_VAR(&prefetchRecords); + if (zephir_array_isset_string_fetch(&prefetchRecords, &options, SL("prefetchRecords"), 0)) { + ZEPHIR_GLOBAL(orm).resultset_prefetch_records = ZSTR_VAL(zval_get_string(&prefetchRecords)); + } + ZEPHIR_OBS_VAR(&lastInsertId); + if (zephir_array_isset_string_fetch(&lastInsertId, &options, SL("castLastInsertIdToInt"), 0)) { + ZEPHIR_GLOBAL(orm).cast_last_insert_id_to_int = zend_is_true(&lastInsertId); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, checkColumnTypeSql) +static PHP_METHOD(Phalcon_Mvc_Model, setWriteConnectionService) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; + zval *connectionService_param = NULL, _0; + zval connectionService; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); + ZVAL_UNDEF(&connectionService); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_STR(connectionService) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 0, &connectionService_param); + if (UNEXPECTED(Z_TYPE_P(connectionService_param) != IS_STRING && Z_TYPE_P(connectionService_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'connectionService' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(connectionService_param) == IS_STRING)) { + zephir_get_strval(&connectionService, connectionService_param); + } else { + ZEPHIR_INIT_VAR(&connectionService); + } - ZEPHIR_CALL_METHOD(&_0, column, "gettype", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&_0) != IS_STRING) { - RETURN_MM_STRING(""); - } - ZEPHIR_RETURN_CALL_METHOD(column, "gettype", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setwriteconnectionservice", NULL, 0, this_ptr, &connectionService); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionAll) +static PHP_METHOD(Phalcon_Mvc_Model, skipOperation) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, domain, _0; - zval expression; + zval *skip_param = NULL, __$true, __$false; + zend_bool skip; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&escapeChar); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(skip) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } + zephir_fetch_params_without_memory_grow(1, 0, &skip_param); + skip = zephir_get_boolval(skip_param); - ZEPHIR_OBS_VAR(&domain); - zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "*"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, &_0, &domain, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); + if (skip) { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$false); + } } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations) +static PHP_METHOD(Phalcon_Mvc_Model, sum) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, left, right, _0, _1, _2; - zval expression, bindCounts; + zval *parameters = NULL, parameters_sub, __$null, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&escapeChar); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + Z_PARAM_ZVAL_OR_NULL(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + zephir_fetch_params(1, 0, 1, ¶meters); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; } - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 654); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 660); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "SUM"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "sumatory"); + ZEPHIR_RETURN_CALL_SELF("groupresult", NULL, 0, &_0, &_1, parameters); zephir_check_call_status(); - zephir_array_fetch_string(&_2, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 665); - ZEPHIR_CONCAT_VSVSV(return_value, &left, " ", &_2, " ", &right); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCase) +static PHP_METHOD(Phalcon_Mvc_Model, toArray) { + zend_bool _3$$4, _10$$14; + zval data; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar, sql; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, whenClause, _0, _1, _2, _3, *_4, _5, _6$$3, _7$$4, _8$$4, _9$$4, _10$$4, _11$$4, _12$$5, _13$$5, _14$$5, _15$$6, _16$$7, _17$$7, _18$$7, _19$$7, _20$$7, _21$$8, _22$$8, _23$$8; - zval expression, bindCounts; + zval *columns = NULL, columns_sub, __$null, metaData, columnMap, attribute, attributeField, value, _0, *_1, _2, _4$$5, _6$$7, _7$$7, _8$$7, _11$$15, _12$$17, _13$$17, _14$$17; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&whenClause); + ZVAL_UNDEF(&columns_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); - ZVAL_UNDEF(&_11$$4); - ZVAL_UNDEF(&_12$$5); - ZVAL_UNDEF(&_13$$5); - ZVAL_UNDEF(&_14$$5); - ZVAL_UNDEF(&_15$$6); - ZVAL_UNDEF(&_16$$7); - ZVAL_UNDEF(&_17$$7); - ZVAL_UNDEF(&_18$$7); - ZVAL_UNDEF(&_19$$7); - ZVAL_UNDEF(&_20$$7); - ZVAL_UNDEF(&_21$$8); - ZVAL_UNDEF(&_22$$8); - ZVAL_UNDEF(&_23$$8); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&sql); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_11$$15); + ZVAL_UNDEF(&_12$$17); + ZVAL_UNDEF(&_13$$17); + ZVAL_UNDEF(&_14$$17); + ZVAL_UNDEF(&data); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + Z_PARAM_ZVAL_OR_NULL(columns) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + zephir_fetch_params(1, 0, 1, &columns); + if (!columns) { + columns = &columns_sub; + columns = &__$null; } - zephir_array_fetch_string(&_1, &expression, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 682); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", NULL, 0, &_1, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&data); + array_init(&data); + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SV(&_2, "CASE ", &_0); - zephir_get_strval(&sql, &_2); - zephir_array_fetch_string(&_3, &expression, SL("when-clauses"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 684); - zephir_is_iterable(&_3, 0, "phalcon/Db/Dialect.zep", 695); - if (Z_TYPE_P(&_3) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_3), _4) + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &metaData, "getattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 3293); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) { - ZEPHIR_INIT_NVAR(&whenClause); - ZVAL_COPY(&whenClause, _4); - zephir_array_fetch_string(&_6$$3, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 685); - if (ZEPHIR_IS_STRING(&_6$$3, "when")) { - zephir_array_fetch_string(&_8$$4, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 687); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "getsqlexpression", NULL, 46, &_8$$4, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_10$$4, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 689); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "getsqlexpression", NULL, 46, &_10$$4, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_11$$4); - ZEPHIR_CONCAT_SVSV(&_11$$4, " WHEN ", &_7$$4, " THEN ", &_9$$4); - zephir_concat_self(&sql, &_11$$4); + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _1); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + _3$$4 = !(zephir_array_isset(&columnMap, &attribute)); + if (_3$$4) { + _3$$4 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_3$$4) { + ZEPHIR_CALL_SELF(&_4$$5, "caseinsensitivecolumnmap", &_5, 422, &columnMap, &attribute); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&attribute, &_4$$5); + } + ZEPHIR_OBS_NVAR(&attributeField); + if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_6$$7); + object_init_ex(&_6$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_7$$7); + zephir_get_class(&_7$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_8$$7); + ZEPHIR_CONCAT_SVSVS(&_8$$7, "Column '", &attribute, "' doesn't make part of the column map in '", &_7$$7, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$7, "__construct", &_9, 32, &_8$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$7, "phalcon/Mvc/Model.zep", 3271); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } } else { - zephir_array_fetch_string(&_13$$5, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 691); - ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "getsqlexpression", NULL, 46, &_13$$5, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_14$$5); - ZEPHIR_CONCAT_SV(&_14$$5, " ELSE ", &_12$$5); - zephir_concat_self(&sql, &_14$$5); + ZEPHIR_CPY_WRT(&attributeField, &attribute); + } + if (Z_TYPE_P(columns) == IS_ARRAY) { + if (!(zephir_fast_in_array(&attributeField, columns))) { + continue; + } + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_update_zval(&data, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&data, &attributeField, &__$null, PH_COPY | PH_SEPARATE); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_5)) { + if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&whenClause, &_3, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&attribute, &_0, "current", NULL, 0); zephir_check_call_status(); - zephir_array_fetch_string(&_15$$6, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 685); - if (ZEPHIR_IS_STRING(&_15$$6, "when")) { - zephir_array_fetch_string(&_17$$7, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 687); - ZEPHIR_CALL_METHOD(&_16$$7, this_ptr, "getsqlexpression", NULL, 46, &_17$$7, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_19$$7, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 689); - ZEPHIR_CALL_METHOD(&_18$$7, this_ptr, "getsqlexpression", NULL, 46, &_19$$7, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_20$$7); - ZEPHIR_CONCAT_SVSV(&_20$$7, " WHEN ", &_16$$7, " THEN ", &_18$$7); - zephir_concat_self(&sql, &_20$$7); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + _10$$14 = !(zephir_array_isset(&columnMap, &attribute)); + if (_10$$14) { + _10$$14 = ZEPHIR_GLOBAL(orm).case_insensitive_column_map; + } + if (_10$$14) { + ZEPHIR_CALL_SELF(&_11$$15, "caseinsensitivecolumnmap", &_5, 422, &columnMap, &attribute); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&attribute, &_11$$15); + } + ZEPHIR_OBS_NVAR(&attributeField); + if (!(zephir_array_isset_fetch(&attributeField, &columnMap, &attribute, 0))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_12$$17); + object_init_ex(&_12$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_13$$17); + zephir_get_class(&_13$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_14$$17); + ZEPHIR_CONCAT_SVSVS(&_14$$17, "Column '", &attribute, "' doesn't make part of the column map in '", &_13$$17, "'"); + ZEPHIR_CALL_METHOD(NULL, &_12$$17, "__construct", &_9, 32, &_14$$17); + zephir_check_call_status(); + zephir_throw_exception_debug(&_12$$17, "phalcon/Mvc/Model.zep", 3271); + ZEPHIR_MM_RESTORE(); + return; + } + continue; + } } else { - zephir_array_fetch_string(&_22$$8, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 691); - ZEPHIR_CALL_METHOD(&_21$$8, this_ptr, "getsqlexpression", NULL, 46, &_22$$8, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_23$$8); - ZEPHIR_CONCAT_SV(&_23$$8, " ELSE ", &_21$$8); - zephir_concat_self(&sql, &_23$$8); + ZEPHIR_CPY_WRT(&attributeField, &attribute); } - ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); + if (Z_TYPE_P(columns) == IS_ARRAY) { + if (!(zephir_fast_in_array(&attributeField, columns))) { + continue; + } + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_update_zval(&data, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&data, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&whenClause); - ZEPHIR_CONCAT_VS(return_value, &sql, " END"); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&attribute); + RETURN_CTOR(&data); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue) +static PHP_METHOD(Phalcon_Mvc_Model, update) { + zval _3$$4, _5$$4; + zval metaData, _0, _1$$3, _2$$3, _4$$4, _6$$4, _7$$4, _8$$4, _9$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, left, right, _0, _1; - zval expression, bindCounts; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); + ZVAL_UNDEF(&metaData); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&escapeChar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$4); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } - - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 712); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 718); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + if (zephir_is_true(&_0)) { + ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getreadconnection", NULL, 433); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "has", NULL, 0, &metaData, &_2$$3); + zephir_check_call_status(); + if (!(zephir_is_true(&_1$$3))) { + ZEPHIR_INIT_VAR(&_3$$4); + zephir_create_array(&_3$$4, 1, 0); + ZEPHIR_INIT_VAR(&_4$$4); + object_init_ex(&_4$$4, phalcon_messages_message_ce); + ZEPHIR_INIT_VAR(&_5$$4); + zephir_create_array(&_5$$4, 1, 0); + ZEPHIR_INIT_VAR(&_6$$4); + zephir_get_class(&_6$$4, this_ptr, 0); + zephir_array_update_string(&_5$$4, SL("model"), &_6$$4, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_6$$4); + ZVAL_STRING(&_6$$4, "Record cannot be updated because it does not exist"); + ZVAL_NULL(&_7$$4); + ZEPHIR_INIT_VAR(&_8$$4); + ZVAL_STRING(&_8$$4, "InvalidUpdateAttempt"); + ZVAL_LONG(&_9$$4, 0); + ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", NULL, 6, &_6$$4, &_7$$4, &_8$$4, &_9$$4, &_5$$4); + zephir_check_call_status(); + zephir_array_fast_append(&_3$$4, &_4$$4); + zephir_update_property_zval(this_ptr, ZEND_STRL("errorMessages"), &_3$$4); + RETURN_MM_BOOL(0); + } + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "save", NULL, 0); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "CAST(", &left, " AS ", &right, ")"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue) +static PHP_METHOD(Phalcon_Mvc_Model, writeAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, left, right, _0, _1; - zval expression, bindCounts; + zval *attribute_param = NULL, *value, value_sub; + zval attribute; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&value_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(attribute) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); + zephir_fetch_params(1, 2, 0, &attribute_param, &value); + if (UNEXPECTED(Z_TYPE_P(attribute_param) != IS_STRING && Z_TYPE_P(attribute_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'attribute' must be of the type string")); + RETURN_MM_NULL(); } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); + if (EXPECTED(Z_TYPE_P(attribute_param) == IS_STRING)) { + zephir_get_strval(&attribute, attribute_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + ZEPHIR_INIT_VAR(&attribute); } - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 740); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 746); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 46, &_1, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "CONVERT(", &left, " USING ", &right, ")"); - RETURN_MM(); + zephir_update_property_zval_zval(this_ptr, &attribute, value); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom) +static PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysRestrict) { + zend_string *_9$$7, *_33$$26; + zend_ulong _8$$7, _32$$26; + zend_bool error = 0, validateWithNulls = 0, _15$$3, _39$$22; + zval conditions, _17$$3, _21$$18, _41$$22, _45$$37; + zval manager, belongsTo, foreignKey, relation, position, bindParams, extraConditions, message, fields, referencedFields, field, referencedModel, value, allowNulls, _0, *_1, _2, _3$$5, _4$$3, _16$$3, _18$$3, *_6$$7, _7$$7, _10$$8, _11$$8, _12$$10, _13$$10, _14$$12, _19$$20, _20$$18, _22$$18, _23$$18, _24$$18, _27$$24, _28$$22, _40$$22, _42$$22, *_30$$26, _31$$26, _34$$27, _35$$27, _36$$29, _37$$29, _38$$31, _43$$39, _44$$37, _46$$37, _47$$37, _48$$37, _49$$42; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, table, tables, *_0$$3, _1$$3, _5$$3, _2$$4, _4$$5; + zephir_fcall_cache_entry *_5 = NULL, *_25 = NULL, *_26 = NULL, *_29 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, action = 0, numberNull = 0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&escapeChar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&belongsTo); + ZVAL_UNDEF(&foreignKey); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&position); + ZVAL_UNDEF(&bindParams); + ZVAL_UNDEF(&extraConditions); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&fields); + ZVAL_UNDEF(&referencedFields); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&allowNulls); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_16$$3); + ZVAL_UNDEF(&_18$$3); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$10); + ZVAL_UNDEF(&_13$$10); + ZVAL_UNDEF(&_14$$12); + ZVAL_UNDEF(&_19$$20); + ZVAL_UNDEF(&_20$$18); + ZVAL_UNDEF(&_22$$18); + ZVAL_UNDEF(&_23$$18); + ZVAL_UNDEF(&_24$$18); + ZVAL_UNDEF(&_27$$24); + ZVAL_UNDEF(&_28$$22); + ZVAL_UNDEF(&_40$$22); + ZVAL_UNDEF(&_42$$22); + ZVAL_UNDEF(&_31$$26); + ZVAL_UNDEF(&_34$$27); + ZVAL_UNDEF(&_35$$27); + ZVAL_UNDEF(&_36$$29); + ZVAL_UNDEF(&_37$$29); + ZVAL_UNDEF(&_38$$31); + ZVAL_UNDEF(&_43$$39); + ZVAL_UNDEF(&_44$$37); + ZVAL_UNDEF(&_46$$37); + ZVAL_UNDEF(&_47$$37); + ZVAL_UNDEF(&_48$$37); + ZVAL_UNDEF(&_49$$42); + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&_17$$3); + ZVAL_UNDEF(&_21$$18); + ZVAL_UNDEF(&_41$$22); + ZVAL_UNDEF(&_45$$37); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&tables); - array_init(&tables); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 768); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) - { - ZEPHIR_INIT_NVAR(&table); - ZVAL_COPY(&table, _0$$3); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqltable", &_3, 62, &table, &escapeChar); - zephir_check_call_status(); - zephir_array_append(&tables, &_2$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 765); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_CALL_METHOD(&belongsTo, &manager, "getbelongsto", NULL, 0, this_ptr); + zephir_check_call_status(); + error = 0; + zephir_is_iterable(&belongsTo, 0, "phalcon/Mvc/Model.zep", 3513); + if (Z_TYPE_P(&belongsTo) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&belongsTo), _1) + { + ZEPHIR_INIT_NVAR(&relation); + ZVAL_COPY(&relation, _1); + validateWithNulls = 0; + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; + } + action = 1; + if (zephir_array_isset_string(&foreignKey, SL("action"))) { + ZEPHIR_OBS_NVAR(&_3$$5); + zephir_array_fetch_string(&_3$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3399); + action = zephir_get_intval(&_3$$5); + } + if (action != 1) { + continue; + } + ZEPHIR_CALL_METHOD(&_4$$3, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedModel, &manager, "load", &_5, 0, &_4$$3); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&conditions); + array_init(&conditions); + ZEPHIR_INIT_NVAR(&bindParams); + array_init(&bindParams); + numberNull = 0; + ZEPHIR_CALL_METHOD(&fields, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3442); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&fields), _8$$7, _9$$7, _6$$7) + { + ZEPHIR_INIT_NVAR(&position); + if (_9$$7 != NULL) { + ZVAL_STR_COPY(&position, _9$$7); + } else { + ZVAL_LONG(&position, _8$$7); + } + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _6$$7); + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); + zephir_array_fetch(&_10$$8, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_11$$8); + ZEPHIR_CONCAT_SVSV(&_11$$8, "[", &_10$$8, "] = ?", &position); + zephir_array_append(&conditions, &_11$$8, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); + if (Z_TYPE_P(&value) == IS_NULL) { + numberNull++; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_7$$7, &fields, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_7$$7)) { + break; + } + ZEPHIR_CALL_METHOD(&position, &fields, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&field, &fields, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); + zephir_array_fetch(&_12$$10, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_13$$10); + ZEPHIR_CONCAT_SVSV(&_13$$10, "[", &_12$$10, "] = ?", &position); + zephir_array_append(&conditions, &_13$$10, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); + if (Z_TYPE_P(&value) == IS_NULL) { + numberNull++; + } + ZEPHIR_CALL_METHOD(NULL, &fields, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); + ZEPHIR_INIT_NVAR(&position); + validateWithNulls = numberNull == zephir_fast_count_int(&fields); + } else { + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &fields, PH_SILENT_CC); + ZEPHIR_INIT_NVAR(&_14$$12); + ZEPHIR_CONCAT_SVS(&_14$$12, "[", &referencedFields, "] = ?0"); + zephir_array_append(&conditions, &_14$$12, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3446); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3447); + if (Z_TYPE_P(&value) == IS_NULL) { + validateWithNulls = 1; + } + } + ZEPHIR_OBS_NVAR(&extraConditions); + if (zephir_array_isset_string_fetch(&extraConditions, &foreignKey, SL("conditions"), 0)) { + zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3458); + } + if (validateWithNulls) { + ZEPHIR_OBS_NVAR(&allowNulls); + if (zephir_array_isset_string_fetch(&allowNulls, &foreignKey, SL("allowNulls"), 0)) { + validateWithNulls = zephir_get_boolval(&allowNulls); + } else { + validateWithNulls = 0; + } + } + _15$$3 = !validateWithNulls; + if (_15$$3) { + ZEPHIR_INIT_NVAR(&_17$$3); + zephir_create_array(&_17$$3, 2, 0); + ZEPHIR_INIT_NVAR(&_18$$3); + zephir_fast_join_str(&_18$$3, SL(" AND "), &conditions); + zephir_array_fast_append(&_17$$3, &_18$$3); + zephir_array_update_string(&_17$$3, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_16$$3, &referencedModel, "count", NULL, 0, &_17$$3); zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; + _15$$3 = !zephir_is_true(&_16$$3); + } + if (_15$$3) { + ZEPHIR_OBS_NVAR(&message); + if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { + ZEPHIR_INIT_NVAR(&message); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_19$$20); + zephir_fast_join_str(&_19$$20, SL(", "), &fields); + ZEPHIR_CONCAT_SVS(&message, "Value of fields \"", &_19$$20, "\" does not exist on referenced table"); + } else { + ZEPHIR_CONCAT_SVS(&message, "Value of field \"", &fields, "\" does not exist on referenced table"); + } } - ZEPHIR_CALL_METHOD(&table, expression, "current", NULL, 0); + ZEPHIR_INIT_NVAR(&_20$$18); + object_init_ex(&_20$$18, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_21$$18); + zephir_create_array(&_21$$18, 2, 0); + ZEPHIR_INIT_NVAR(&_22$$18); + zephir_get_class(&_22$$18, this_ptr, 0); + zephir_array_update_string(&_21$$18, SL("model"), &_22$$18, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_23$$18, &relation, "getreferencedmodel", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqltable", &_3, 62, &table, &escapeChar); - zephir_check_call_status(); - zephir_array_append(&tables, &_4$$5, PH_SEPARATE, "phalcon/Db/Dialect.zep", 765); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); + zephir_array_update_string(&_21$$18, SL("referenceModel"), &_23$$18, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_22$$18); + ZVAL_STRING(&_22$$18, "ConstraintViolation"); + ZVAL_LONG(&_24$$18, 0); + ZEPHIR_CALL_METHOD(NULL, &_20$$18, "__construct", &_25, 6, &message, &fields, &_22$$18, &_24$$18, &_21$$18); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &_20$$18); zephir_check_call_status(); + error = 1; + break; } - } - ZEPHIR_INIT_NVAR(&table); - ZEPHIR_INIT_VAR(&_5$$3); - zephir_fast_join_str(&_5$$3, SL(", "), &tables); - ZEPHIR_CPY_WRT(&tables, &_5$$3); + } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CPY_WRT(&tables, expression); + ZEPHIR_CALL_METHOD(NULL, &belongsTo, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &belongsTo, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&relation, &belongsTo, "current", NULL, 0); + zephir_check_call_status(); + validateWithNulls = 0; + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; + } + action = 1; + if (zephir_array_isset_string(&foreignKey, SL("action"))) { + ZEPHIR_OBS_NVAR(&_27$$24); + zephir_array_fetch_string(&_27$$24, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3399); + action = zephir_get_intval(&_27$$24); + } + if (action != 1) { + continue; + } + ZEPHIR_CALL_METHOD(&_28$$22, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedModel, &manager, "load", &_29, 0, &_28$$22); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&conditions); + array_init(&conditions); + ZEPHIR_INIT_NVAR(&bindParams); + array_init(&bindParams); + numberNull = 0; + ZEPHIR_CALL_METHOD(&fields, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + zephir_is_iterable(&fields, 0, "phalcon/Mvc/Model.zep", 3442); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&fields), _32$$26, _33$$26, _30$$26) + { + ZEPHIR_INIT_NVAR(&position); + if (_33$$26 != NULL) { + ZVAL_STR_COPY(&position, _33$$26); + } else { + ZVAL_LONG(&position, _32$$26); + } + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _30$$26); + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); + zephir_array_fetch(&_34$$27, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_35$$27); + ZEPHIR_CONCAT_SVSV(&_35$$27, "[", &_34$$27, "] = ?", &position); + zephir_array_append(&conditions, &_35$$27, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); + if (Z_TYPE_P(&value) == IS_NULL) { + numberNull++; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_31$$26, &fields, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_31$$26)) { + break; + } + ZEPHIR_CALL_METHOD(&position, &fields, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&field, &fields, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &field, PH_SILENT_CC); + zephir_array_fetch(&_36$$29, &referencedFields, &position, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3434); + ZEPHIR_INIT_NVAR(&_37$$29); + ZEPHIR_CONCAT_SVSV(&_37$$29, "[", &_36$$29, "] = ?", &position); + zephir_array_append(&conditions, &_37$$29, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3434); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3435); + if (Z_TYPE_P(&value) == IS_NULL) { + numberNull++; + } + ZEPHIR_CALL_METHOD(NULL, &fields, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); + ZEPHIR_INIT_NVAR(&position); + validateWithNulls = numberNull == zephir_fast_count_int(&fields); + } else { + ZEPHIR_OBS_NVAR(&value); + zephir_fetch_property_zval(&value, this_ptr, &fields, PH_SILENT_CC); + ZEPHIR_INIT_NVAR(&_38$$31); + ZEPHIR_CONCAT_SVS(&_38$$31, "[", &referencedFields, "] = ?0"); + zephir_array_append(&conditions, &_38$$31, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3446); + zephir_array_append(&bindParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3447); + if (Z_TYPE_P(&value) == IS_NULL) { + validateWithNulls = 1; + } + } + ZEPHIR_OBS_NVAR(&extraConditions); + if (zephir_array_isset_string_fetch(&extraConditions, &foreignKey, SL("conditions"), 0)) { + zephir_array_append(&conditions, &extraConditions, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3458); + } + if (validateWithNulls) { + ZEPHIR_OBS_NVAR(&allowNulls); + if (zephir_array_isset_string_fetch(&allowNulls, &foreignKey, SL("allowNulls"), 0)) { + validateWithNulls = zephir_get_boolval(&allowNulls); + } else { + validateWithNulls = 0; + } + } + _39$$22 = !validateWithNulls; + if (_39$$22) { + ZEPHIR_INIT_NVAR(&_41$$22); + zephir_create_array(&_41$$22, 2, 0); + ZEPHIR_INIT_NVAR(&_42$$22); + zephir_fast_join_str(&_42$$22, SL(" AND "), &conditions); + zephir_array_fast_append(&_41$$22, &_42$$22); + zephir_array_update_string(&_41$$22, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_40$$22, &referencedModel, "count", NULL, 0, &_41$$22); + zephir_check_call_status(); + _39$$22 = !zephir_is_true(&_40$$22); + } + if (_39$$22) { + ZEPHIR_OBS_NVAR(&message); + if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { + ZEPHIR_INIT_NVAR(&message); + if (Z_TYPE_P(&fields) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_43$$39); + zephir_fast_join_str(&_43$$39, SL(", "), &fields); + ZEPHIR_CONCAT_SVS(&message, "Value of fields \"", &_43$$39, "\" does not exist on referenced table"); + } else { + ZEPHIR_CONCAT_SVS(&message, "Value of field \"", &fields, "\" does not exist on referenced table"); + } + } + ZEPHIR_INIT_NVAR(&_44$$37); + object_init_ex(&_44$$37, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_45$$37); + zephir_create_array(&_45$$37, 2, 0); + ZEPHIR_INIT_NVAR(&_46$$37); + zephir_get_class(&_46$$37, this_ptr, 0); + zephir_array_update_string(&_45$$37, SL("model"), &_46$$37, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_47$$37, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + zephir_array_update_string(&_45$$37, SL("referenceModel"), &_47$$37, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_46$$37); + ZVAL_STRING(&_46$$37, "ConstraintViolation"); + ZVAL_LONG(&_48$$37, 0); + ZEPHIR_CALL_METHOD(NULL, &_44$$37, "__construct", &_25, 6, &message, &fields, &_46$$37, &_48$$37, &_45$$37); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_26, 0, &_44$$37); + zephir_check_call_status(); + error = 1; + break; + } + ZEPHIR_CALL_METHOD(NULL, &belongsTo, "next", NULL, 0); + zephir_check_call_status(); + } } - ZEPHIR_CONCAT_SV(return_value, "FROM ", &tables); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&relation); + if (error) { + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_INIT_VAR(&_49$$42); + ZVAL_STRING(&_49$$42, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_49$$42); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); + zephir_check_call_status(); + } + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFunctionCall) +static PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseCascade) { - zend_bool _1, _3$$4; + zend_bool _3$$3, _7$$9; + zval manager, relations, relation, foreignKey, related, _0, *_1, _2, _4$$5, _6$$7, _8$$11, _10$$13; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, __$false, name, customFunction, arguments, _0, _4$$4; - zval expression, bindCounts, _2$$4; + zephir_fcall_cache_entry *_5 = NULL, *_9 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, action = 0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&_2$$4); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&customFunction); - ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&foreignKey); + ZVAL_UNDEF(&related); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&escapeChar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_8$$11); + ZVAL_UNDEF(&_10$$13); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } - - ZEPHIR_OBS_VAR(&name); - zephir_array_fetch_string(&name, &expression, SL("name"), PH_NOISY, "phalcon/Db/Dialect.zep", 789); - ZEPHIR_OBS_VAR(&customFunction); - zephir_read_property(&_0, this_ptr, ZEND_STRL("customFunctions"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&customFunction, &_0, &name, 0)) { - ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(&customFunction, NULL, 0, this_ptr, &expression, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&arguments); - _1 = zephir_array_isset_string_fetch(&arguments, &expression, SL("arguments"), 0); - if (_1) { - _1 = Z_TYPE_P(&arguments) == IS_ARRAY; - } - if (_1) { - ZEPHIR_INIT_VAR(&_2$$4); - zephir_create_array(&_2$$4, 3, 0); - add_assoc_stringl_ex(&_2$$4, SL("type"), SL("list")); - zephir_array_update_string(&_2$$4, SL("parentheses"), &__$false, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_2$$4, SL("value"), &arguments, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "getsqlexpression", NULL, 0, &_2$$4, &escapeChar, &bindCounts); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_CALL_METHOD(&relations, &manager, "gethasoneandhasmany", NULL, 0, this_ptr); + zephir_check_call_status(); + zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3589); + if (Z_TYPE_P(&relations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relations), _1) + { + ZEPHIR_INIT_NVAR(&relation); + ZVAL_COPY(&relation, _1); + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; + } + action = 0; + _3$$3 = Z_TYPE_P(&foreignKey) == IS_ARRAY; + if (_3$$3) { + _3$$3 = zephir_array_isset_string(&foreignKey, SL("action")); + } + if (_3$$3) { + ZEPHIR_OBS_NVAR(&_4$$5); + zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3563); + action = zephir_get_intval(&_4$$5); + } + if (action != 2) { + continue; + } + ZEPHIR_CALL_METHOD(&related, &manager, "getrelationrecords", &_5, 0, &relation, this_ptr); + zephir_check_call_status(); + if (zephir_is_true(&related)) { + ZEPHIR_CALL_METHOD(&_6$$7, &related, "delete", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_6$$7)) { + RETURN_MM_BOOL(0); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relations, "rewind", NULL, 0); zephir_check_call_status(); - _3$$4 = zephir_array_isset_string(&expression, SL("distinct")); - if (_3$$4) { - zephir_array_fetch_string(&_4$$4, &expression, SL("distinct"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 806); - _3$$4 = zephir_is_true(&_4$$4); - } - if (_3$$4) { - ZEPHIR_CONCAT_VSVS(return_value, &name, "(DISTINCT ", &arguments, ")"); - RETURN_MM(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &relations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&relation, &relations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; + } + action = 0; + _7$$9 = Z_TYPE_P(&foreignKey) == IS_ARRAY; + if (_7$$9) { + _7$$9 = zephir_array_isset_string(&foreignKey, SL("action")); + } + if (_7$$9) { + ZEPHIR_OBS_NVAR(&_8$$11); + zephir_array_fetch_string(&_8$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3563); + action = zephir_get_intval(&_8$$11); + } + if (action != 2) { + continue; + } + ZEPHIR_CALL_METHOD(&related, &manager, "getrelationrecords", &_9, 0, &relation, this_ptr); + zephir_check_call_status(); + if (zephir_is_true(&related)) { + ZEPHIR_CALL_METHOD(&_10$$13, &related, "delete", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_10$$13)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_CALL_METHOD(NULL, &relations, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_CONCAT_VSVS(return_value, &name, "(", &arguments, ")"); - RETURN_MM(); } - ZEPHIR_CONCAT_VS(return_value, &name, "()"); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&relation); + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy) +static PHP_METHOD(Phalcon_Mvc_Model, checkForeignKeysReverseRestrict) { + zval _10$$7, _22$$13; + zval manager, relations, foreignKey, relation, relationClass, fields, message, _0, *_1, _2, _5$$3, _6$$3, _7$$3, _4$$5, _9$$7, _11$$7, _12$$7, _17$$9, _18$$9, _19$$9, _16$$11, _21$$13, _23$$13, _24$$13, _25$$16; + zend_bool error = 0, _3$$3, _15$$9; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, field, fields, *_0$$3, _1$$3, _5$$3, _2$$4, _4$$6; + zephir_fcall_cache_entry *_8 = NULL, *_13 = NULL, *_14 = NULL, *_20 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, action = 0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&field); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&foreignKey); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relationClass); ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&bindCounts); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_12$$7); + ZVAL_UNDEF(&_17$$9); + ZVAL_UNDEF(&_18$$9); + ZVAL_UNDEF(&_19$$9); + ZVAL_UNDEF(&_16$$11); + ZVAL_UNDEF(&_21$$13); + ZVAL_UNDEF(&_23$$13); + ZVAL_UNDEF(&_24$$13); + ZVAL_UNDEF(&_25$$16); + ZVAL_UNDEF(&_10$$7); + ZVAL_UNDEF(&_22$$13); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } - - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 844); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _0$$3); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/Db/Dialect.zep", 834); - return; + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_CALL_METHOD(&relations, &manager, "gethasoneandhasmany", NULL, 0, this_ptr); + zephir_check_call_status(); + error = 0; + zephir_is_iterable(&relations, 0, "phalcon/Mvc/Model.zep", 3680); + if (Z_TYPE_P(&relations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relations), _1) + { + ZEPHIR_INIT_NVAR(&relation); + ZVAL_COPY(&relation, _1); + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; + } + action = 1; + _3$$3 = Z_TYPE_P(&foreignKey) == IS_ARRAY; + if (_3$$3) { + _3$$3 = zephir_array_isset_string(&foreignKey, SL("action")); + } + if (_3$$3) { + ZEPHIR_OBS_NVAR(&_4$$5); + zephir_array_fetch_string(&_4$$5, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3634); + action = zephir_get_intval(&_4$$5); + } + if (action != 1) { + continue; + } + ZEPHIR_CALL_METHOD(&relationClass, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&fields, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZVAL_NULL(&_6$$3); + ZEPHIR_INIT_NVAR(&_7$$3); + ZVAL_STRING(&_7$$3, "count"); + ZEPHIR_CALL_METHOD(&_5$$3, &manager, "getrelationrecords", &_8, 0, &relation, this_ptr, &_6$$3, &_7$$3); + zephir_check_call_status(); + if (zephir_is_true(&_5$$3)) { + ZEPHIR_OBS_NVAR(&message); + if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { + ZEPHIR_INIT_NVAR(&message); + ZEPHIR_CONCAT_SV(&message, "Record is referenced by model ", &relationClass); } - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqlexpression", &_3, 0, &field, &escapeChar, &bindCounts); + ZEPHIR_INIT_NVAR(&_9$$7); + object_init_ex(&_9$$7, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_10$$7); + zephir_create_array(&_10$$7, 2, 0); + ZEPHIR_INIT_NVAR(&_11$$7); + zephir_get_class(&_11$$7, this_ptr, 0); + zephir_array_update_string(&_10$$7, SL("model"), &_11$$7, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_10$$7, SL("referenceModel"), &relationClass, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_11$$7); + ZVAL_STRING(&_11$$7, "ConstraintViolation"); + ZVAL_LONG(&_12$$7, 0); + ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_13, 6, &message, &fields, &_11$$7, &_12$$7, &_10$$7); zephir_check_call_status(); - zephir_array_append(&fields, &_2$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_14, 0, &_9$$7); + zephir_check_call_status(); + error = 1; + break; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &relations, "valid", NULL, 0); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&relation, &relations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&foreignKey, &relation, "getforeignkey", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; + if (ZEPHIR_IS_FALSE_IDENTICAL(&foreignKey)) { + continue; } - ZEPHIR_CALL_METHOD(&field, expression, "current", NULL, 0); + action = 1; + _15$$9 = Z_TYPE_P(&foreignKey) == IS_ARRAY; + if (_15$$9) { + _15$$9 = zephir_array_isset_string(&foreignKey, SL("action")); + } + if (_15$$9) { + ZEPHIR_OBS_NVAR(&_16$$11); + zephir_array_fetch_string(&_16$$11, &foreignKey, SL("action"), PH_NOISY, "phalcon/Mvc/Model.zep", 3634); + action = zephir_get_intval(&_16$$11); + } + if (action != 1) { + continue; + } + ZEPHIR_CALL_METHOD(&relationClass, &relation, "getreferencedmodel", NULL, 0); zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/Db/Dialect.zep", 834); - return; + ZEPHIR_CALL_METHOD(&fields, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZVAL_NULL(&_18$$9); + ZEPHIR_INIT_NVAR(&_19$$9); + ZVAL_STRING(&_19$$9, "count"); + ZEPHIR_CALL_METHOD(&_17$$9, &manager, "getrelationrecords", &_20, 0, &relation, this_ptr, &_18$$9, &_19$$9); + zephir_check_call_status(); + if (zephir_is_true(&_17$$9)) { + ZEPHIR_OBS_NVAR(&message); + if (!(zephir_array_isset_string_fetch(&message, &foreignKey, SL("message"), 0))) { + ZEPHIR_INIT_NVAR(&message); + ZEPHIR_CONCAT_SV(&message, "Record is referenced by model ", &relationClass); } - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getsqlexpression", &_3, 46, &field, &escapeChar, &bindCounts); + ZEPHIR_INIT_NVAR(&_21$$13); + object_init_ex(&_21$$13, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_22$$13); + zephir_create_array(&_22$$13, 2, 0); + ZEPHIR_INIT_NVAR(&_23$$13); + zephir_get_class(&_23$$13, this_ptr, 0); + zephir_array_update_string(&_22$$13, SL("model"), &_23$$13, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_22$$13, SL("referenceModel"), &relationClass, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_23$$13); + ZVAL_STRING(&_23$$13, "ConstraintViolation"); + ZVAL_LONG(&_24$$13, 0); + ZEPHIR_CALL_METHOD(NULL, &_21$$13, "__construct", &_13, 6, &message, &fields, &_23$$13, &_24$$13, &_22$$13); zephir_check_call_status(); - zephir_array_append(&fields, &_4$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_14, 0, &_21$$13); + zephir_check_call_status(); + error = 1; + break; + } + ZEPHIR_CALL_METHOD(NULL, &relations, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_INIT_VAR(&_5$$3); - zephir_fast_join_str(&_5$$3, SL(", "), &fields); - ZEPHIR_CPY_WRT(&fields, &_5$$3); - } else { - ZEPHIR_CPY_WRT(&fields, expression); } - ZEPHIR_CONCAT_SV(return_value, "GROUP BY ", &fields); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&relation); + if (error) { + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_INIT_VAR(&_25$$16); + ZVAL_STRING(&_25$$16, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_25$$16); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); + zephir_check_call_status(); + } + RETURN_MM_BOOL(0); + } + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionHaving) +static PHP_METHOD(Phalcon_Mvc_Model, doLowInsert) { + zend_string *_58$$56; + zend_ulong _57$$56; + zend_bool useExplicitIdentity = 0, _51, _7$$11, _25$$26, _44$$40, _60$$56; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_6 = NULL, *_11 = NULL, *_12 = NULL, *_19 = NULL, *_21 = NULL, *_29 = NULL, *_30 = NULL, *_37 = NULL, *_39 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, _0; - zval expression, bindCounts; + zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, *identityField, identityField_sub, __$null, attributeField, attributes, automaticAttributes, bindDataTypes, bindSkip, bindType, bindTypes, columnMap, defaultValue, defaultValues, field, fields, lastInsertedId, manager, sequenceName, schema, snapshot, source, success, unsetDefaultValues, value, values, _0, *_1, _2, _3$$7, _4$$7, _5$$7, _8$$12, _9$$12, _10$$12, _13$$15, _14$$15, _15$$15, _16$$17, _17$$17, _18$$17, _20$$17, _22$$22, _23$$22, _24$$22, _26$$27, _27$$27, _28$$27, _31$$30, _32$$30, _33$$30, _34$$32, _35$$32, _36$$32, _38$$32, _40$$35, _41$$38, _42$$38, _43$$38, _45$$45, _46$$45, _47$$45, _48$$48, _49$$48, _50$$48, _52$$49, _53$$55, _54$$55, *_55$$56, _56$$56, _59$$56; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); + ZVAL_UNDEF(&metaData_sub); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&table_sub); + ZVAL_UNDEF(&identityField_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&automaticAttributes); + ZVAL_UNDEF(&bindDataTypes); + ZVAL_UNDEF(&bindSkip); + ZVAL_UNDEF(&bindType); + ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&defaultValue); + ZVAL_UNDEF(&defaultValues); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&fields); + ZVAL_UNDEF(&lastInsertedId); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&sequenceName); + ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&source); + ZVAL_UNDEF(&success); + ZVAL_UNDEF(&unsetDefaultValues); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&values); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_8$$12); + ZVAL_UNDEF(&_9$$12); + ZVAL_UNDEF(&_10$$12); + ZVAL_UNDEF(&_13$$15); + ZVAL_UNDEF(&_14$$15); + ZVAL_UNDEF(&_15$$15); + ZVAL_UNDEF(&_16$$17); + ZVAL_UNDEF(&_17$$17); + ZVAL_UNDEF(&_18$$17); + ZVAL_UNDEF(&_20$$17); + ZVAL_UNDEF(&_22$$22); + ZVAL_UNDEF(&_23$$22); + ZVAL_UNDEF(&_24$$22); + ZVAL_UNDEF(&_26$$27); + ZVAL_UNDEF(&_27$$27); + ZVAL_UNDEF(&_28$$27); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$30); + ZVAL_UNDEF(&_33$$30); + ZVAL_UNDEF(&_34$$32); + ZVAL_UNDEF(&_35$$32); + ZVAL_UNDEF(&_36$$32); + ZVAL_UNDEF(&_38$$32); + ZVAL_UNDEF(&_40$$35); + ZVAL_UNDEF(&_41$$38); + ZVAL_UNDEF(&_42$$38); + ZVAL_UNDEF(&_43$$38); + ZVAL_UNDEF(&_45$$45); + ZVAL_UNDEF(&_46$$45); + ZVAL_UNDEF(&_47$$45); + ZVAL_UNDEF(&_48$$48); + ZVAL_UNDEF(&_49$$48); + ZVAL_UNDEF(&_50$$48); + ZVAL_UNDEF(&_52$$49); + ZVAL_UNDEF(&_53$$55); + ZVAL_UNDEF(&_54$$55); + ZVAL_UNDEF(&_56$$56); + ZVAL_UNDEF(&_59$$56); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_OBJECT_OF_CLASS(metaData, phalcon_mvc_model_metadatainterface_ce) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) + Z_PARAM_ZVAL(table) + Z_PARAM_ZVAL(identityField) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 4, 0, &metaData, &connection, &table, &identityField); + ZEPHIR_SEPARATE_PARAM(table); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", NULL, 0, &expression, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&bindSkip); + ZVAL_LONG(&bindSkip, 1024); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_INIT_VAR(&fields); + array_init(&fields); + ZEPHIR_INIT_VAR(&values); + array_init(&values); + ZEPHIR_INIT_VAR(&snapshot); + array_init(&snapshot); + ZEPHIR_INIT_VAR(&bindTypes); + array_init(&bindTypes); + ZEPHIR_INIT_VAR(&unsetDefaultValues); + array_init(&unsetDefaultValues); + ZEPHIR_CALL_METHOD(&attributes, metaData, "getattributes", NULL, 0, this_ptr); zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, "HAVING ", &_0); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) -{ - zend_bool _2$$3, _9$$3, _13$$11, _19$$11; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL, *_11 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts; - zval escapeChar, sql; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, condition, join, joinCondition, joinTable, joinType, joinConditionsArray, *_0, _1, _10$$3, _12$$3, *_4$$6, _5$$6, _8$$6, _6$$7, _7$$8, _20$$11, _21$$11, *_14$$14, _15$$14, _18$$14, _16$$15, _17$$16; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&join); - ZVAL_UNDEF(&joinCondition); - ZVAL_UNDEF(&joinTable); - ZVAL_UNDEF(&joinType); - ZVAL_UNDEF(&joinConditionsArray); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$8); - ZVAL_UNDEF(&_20$$11); - ZVAL_UNDEF(&_21$$11); - ZVAL_UNDEF(&_15$$14); - ZVAL_UNDEF(&_18$$14); - ZVAL_UNDEF(&_16$$15); - ZVAL_UNDEF(&_17$$16); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&bindCounts); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&automaticAttributes, metaData, "getautomaticcreateattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&defaultValues, metaData, "getdefaultvalues", NULL, 0, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); } - - - ZEPHIR_INIT_VAR(&joinType); - ZVAL_STRING(&joinType, ""); - ZEPHIR_INIT_VAR(&sql); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 918); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0) + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 3802); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _1) { - ZEPHIR_INIT_NVAR(&join); - ZVAL_COPY(&join, _0); - ZEPHIR_OBS_NVAR(&joinConditionsArray); - _2$$3 = zephir_array_isset_string_fetch(&joinConditionsArray, &join, SL("conditions"), 0); - if (_2$$3) { - _2$$3 = !(ZEPHIR_IS_EMPTY(&joinConditionsArray)); - } - if (_2$$3) { - if (!(zephir_array_isset_long(&joinConditionsArray, 0))) { - ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 0, &joinConditionsArray, &escapeChar, &bindCounts); + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _1); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_3$$7); + object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_4$$7); + zephir_get_class(&_4$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_5$$7); + ZEPHIR_CONCAT_SVSVS(&_5$$7, "Column '", &field, "' in '", &_4$$7, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", &_6, 32, &_5$$7); zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - array_init(&joinCondition); - zephir_is_iterable(&joinConditionsArray, 0, "phalcon/Db/Dialect.zep", 903); - if (Z_TYPE_P(&joinConditionsArray) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&joinConditionsArray), _4$$6) - { - ZEPHIR_INIT_NVAR(&condition); - ZVAL_COPY(&condition, _4$$6); - ZEPHIR_CALL_METHOD(&_6$$7, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 3736); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + if (!ZEPHIR_IS_EQUAL(&field, identityField)) { + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + _7$$11 = Z_TYPE_P(&value) == IS_NULL; + if (_7$$11) { + _7$$11 = zephir_array_isset(&defaultValues, &field); + } + if (_7$$11) { + zephir_array_fetch(&_8$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3753); + zephir_array_update_zval(&snapshot, &attributeField, &_8$$12, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_9$$12, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3754); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_9$$12, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_10$$12, connection, "supportsdefaultvalue", &_11, 0); zephir_check_call_status(); - zephir_array_append(&joinCondition, &_6$$7, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); - } ZEND_HASH_FOREACH_END(); + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_10$$12))) { + continue; + } + ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_12, 0); + zephir_check_call_status(); + } else { + zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_13$$15); + object_init_ex(&_13$$15, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_14$$15); + zephir_get_class(&_14$$15, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_15$$15); + ZEPHIR_CONCAT_SVSVS(&_15$$15, "Column '", &field, "' in '", &_14$$15, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_13$$15, "__construct", &_6, 32, &_15$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(&_13$$15, "phalcon/Mvc/Model.zep", 3771); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3774); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3775); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3776); } else { - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5$$6, &joinConditionsArray, "valid", NULL, 0); + if (zephir_array_isset(&defaultValues, &field)) { + zephir_array_fetch(&_16$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3779); + zephir_array_update_zval(&snapshot, &attributeField, &_16$$17, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_17$$17, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3780); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_17$$17, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_18$$17, connection, "supportsdefaultvalue", &_19, 0); zephir_check_call_status(); - if (!zend_is_true(&_5$$6)) { - break; + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_18$$17))) { + continue; } - ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_7$$8, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); + ZEPHIR_CALL_METHOD(&_20$$17, connection, "getdefaultvalue", &_21, 0); zephir_check_call_status(); + zephir_array_append(&values, &_20$$17, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3786); + } else { + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3788); + zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3792); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3793); } - ZEPHIR_INIT_NVAR(&condition); - ZEPHIR_INIT_NVAR(&_8$$6); - zephir_fast_join_str(&_8$$6, SL(" AND "), &joinCondition); - ZEPHIR_CPY_WRT(&joinCondition, &_8$$6); } - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - ZVAL_LONG(&joinCondition, 1); - } - ZEPHIR_OBS_NVAR(&joinType); - _9$$3 = zephir_array_isset_string_fetch(&joinType, &join, SL("type"), 0); - if (_9$$3) { - _9$$3 = zephir_is_true(&joinType); } - if (_9$$3) { - zephir_concat_self_str(&joinType, SL(" ")); - } - zephir_array_fetch_string(&_10$$3, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 913); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 62, &_10$$3, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_12$$3); - ZEPHIR_CONCAT_SVSVSV(&_12$$3, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); - zephir_concat_self(&sql, &_12$$3); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, expression, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &attributes, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&join, expression, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&field, &attributes, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&joinConditionsArray); - _13$$11 = zephir_array_isset_string_fetch(&joinConditionsArray, &join, SL("conditions"), 0); - if (_13$$11) { - _13$$11 = !(ZEPHIR_IS_EMPTY(&joinConditionsArray)); - } - if (_13$$11) { - if (!(zephir_array_isset_long(&joinConditionsArray, 0))) { - ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 46, &joinConditionsArray, &escapeChar, &bindCounts); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_22$$22); + object_init_ex(&_22$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_23$$22); + zephir_get_class(&_23$$22, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_24$$22); + ZEPHIR_CONCAT_SVSVS(&_24$$22, "Column '", &field, "' in '", &_23$$22, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_22$$22, "__construct", &_6, 32, &_24$$22); zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - array_init(&joinCondition); - zephir_is_iterable(&joinConditionsArray, 0, "phalcon/Db/Dialect.zep", 903); - if (Z_TYPE_P(&joinConditionsArray) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&joinConditionsArray), _14$$14) - { - ZEPHIR_INIT_NVAR(&condition); - ZVAL_COPY(&condition, _14$$14); - ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); + zephir_throw_exception_debug(&_22$$22, "phalcon/Mvc/Model.zep", 3736); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + if (!ZEPHIR_IS_EQUAL(&field, identityField)) { + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + _25$$26 = Z_TYPE_P(&value) == IS_NULL; + if (_25$$26) { + _25$$26 = zephir_array_isset(&defaultValues, &field); + } + if (_25$$26) { + zephir_array_fetch(&_26$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3753); + zephir_array_update_zval(&snapshot, &attributeField, &_26$$27, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_27$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3754); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_27$$27, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_28$$27, connection, "supportsdefaultvalue", &_29, 0); zephir_check_call_status(); - zephir_array_append(&joinCondition, &_16$$15, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_15$$14, &joinConditionsArray, "valid", NULL, 0); + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_28$$27))) { + continue; + } + ZEPHIR_CALL_METHOD(&value, connection, "getdefaultvalue", &_30, 0); zephir_check_call_status(); - if (!zend_is_true(&_15$$14)) { - break; - } - ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); + } else { + zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_31$$30); + object_init_ex(&_31$$30, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_32$$30); + zephir_get_class(&_32$$30, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_33$$30); + ZEPHIR_CONCAT_SVSVS(&_33$$30, "Column '", &field, "' in '", &_32$$30, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_31$$30, "__construct", &_6, 32, &_33$$30); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_17$$16, this_ptr, "getsqlexpression", &_3, 46, &condition, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_17$$16, PH_SEPARATE, "phalcon/Db/Dialect.zep", 900); - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); + zephir_throw_exception_debug(&_31$$30, "phalcon/Mvc/Model.zep", 3771); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3774); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3775); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3776); + } else { + if (zephir_array_isset(&defaultValues, &field)) { + zephir_array_fetch(&_34$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3779); + zephir_array_update_zval(&snapshot, &attributeField, &_34$$32, PH_COPY | PH_SEPARATE); + zephir_array_fetch(&_35$$32, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3780); + zephir_array_update_zval(&unsetDefaultValues, &attributeField, &_35$$32, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&_36$$32, connection, "supportsdefaultvalue", &_37, 0); + zephir_check_call_status(); + if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_36$$32))) { + continue; + } + ZEPHIR_CALL_METHOD(&_38$$32, connection, "getdefaultvalue", &_39, 0); zephir_check_call_status(); + zephir_array_append(&values, &_38$$32, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3786); + } else { + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3788); + zephir_array_update_zval(&snapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); } + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3792); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3793); } - ZEPHIR_INIT_NVAR(&condition); - ZEPHIR_INIT_NVAR(&_18$$14); - zephir_fast_join_str(&_18$$14, SL(" AND "), &joinCondition); - ZEPHIR_CPY_WRT(&joinCondition, &_18$$14); } - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - ZVAL_LONG(&joinCondition, 1); - } - ZEPHIR_OBS_NVAR(&joinType); - _19$$11 = zephir_array_isset_string_fetch(&joinType, &join, SL("type"), 0); - if (_19$$11) { - _19$$11 = zephir_is_true(&joinType); - } - if (_19$$11) { - zephir_concat_self_str(&joinType, SL(" ")); } - zephir_array_fetch_string(&_20$$11, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 913); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 62, &_20$$11, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_21$$11); - ZEPHIR_CONCAT_SVSVSV(&_21$$11, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); - zephir_concat_self(&sql, &_21$$11); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&join); - RETURN_CTOR(&sql); -} - -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit) -{ - zend_bool _2$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts, _4; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, sql, value, limit, offset, _0$$4, _1$$5, _3$$7; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&offset); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_3$$7); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_INIT_NVAR(&field); + if (!ZEPHIR_IS_FALSE_IDENTICAL(identityField)) { + ZEPHIR_CALL_METHOD(&defaultValue, connection, "getdefaultidvalue", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_40$$35, connection, "useexplicitidvalue", NULL, 0); + zephir_check_call_status(); + useExplicitIdentity = zephir_get_boolval(&_40$$35); + if (useExplicitIdentity) { + zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3812); + } + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, identityField, 0)))) { + ZEPHIR_INIT_VAR(&_41$$38); + object_init_ex(&_41$$38, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_42$$38); + zephir_get_class(&_42$$38, this_ptr, 0); + ZEPHIR_INIT_VAR(&_43$$38); + ZEPHIR_CONCAT_SVSVS(&_43$$38, "Identity column '", identityField, "' isn't part of the column map in '", &_42$$38, "'"); + ZEPHIR_CALL_METHOD(NULL, &_41$$38, "__construct", &_6, 32, &_43$$38); + zephir_check_call_status(); + zephir_throw_exception_debug(&_41$$38, "phalcon/Mvc/Model.zep", 3822); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, identityField); + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + _44$$40 = Z_TYPE_P(&value) == IS_NULL; + if (!(_44$$40)) { + _44$$40 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + } + if (_44$$40) { + if (useExplicitIdentity) { + zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3834); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3834); + } + } else { + if (!(useExplicitIdentity)) { + zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3842); + } + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, identityField, 0)))) { + ZEPHIR_INIT_VAR(&_45$$45); + object_init_ex(&_45$$45, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_46$$45); + zephir_get_class(&_46$$45, this_ptr, 0); + ZEPHIR_INIT_VAR(&_47$$45); + ZEPHIR_CONCAT_SVSVS(&_47$$45, "Identity column '", identityField, "' isn\'t part of the table columns in '", &_46$$45, "'"); + ZEPHIR_CALL_METHOD(NULL, &_45$$45, "__construct", &_6, 32, &_47$$45); + zephir_check_call_status(); + zephir_throw_exception_debug(&_45$$45, "phalcon/Mvc/Model.zep", 3851); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3854); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3855); + } + } else { + if (useExplicitIdentity) { + zephir_array_append(&values, &defaultValue, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3859); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 3860); + } + } } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + if (Z_TYPE_P(table) == IS_ARRAY) { + zephir_array_fetch_long(&_48$$48, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3869); + zephir_array_fetch_long(&_49$$48, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 3869); + ZEPHIR_INIT_VAR(&_50$$48); + ZEPHIR_CONCAT_VSV(&_50$$48, &_48$$48, ".", &_49$$48); + ZEPHIR_CPY_WRT(table, &_50$$48); } - - - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, ""); - ZEPHIR_INIT_VAR(&offset); - ZVAL_NULL(&offset); - ZEPHIR_OBS_VAR(&value); - zephir_array_fetch_string(&value, expression, SL("value"), PH_NOISY, "phalcon/Db/Dialect.zep", 934); - if (zephir_array_isset_string(expression, SL("sql"))) { - ZEPHIR_OBS_NVAR(&sql); - zephir_array_fetch_string(&sql, expression, SL("sql"), PH_NOISY, "phalcon/Db/Dialect.zep", 937); + ZEPHIR_CALL_METHOD(&success, connection, "insert", NULL, 0, table, &values, &fields, &bindTypes); + zephir_check_call_status(); + _51 = zephir_is_true(&success); + if (_51) { + _51 = !ZEPHIR_IS_FALSE_IDENTICAL(identityField); } - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_array_fetch_string(&_0$$4, &value, SL("number"), PH_NOISY, "phalcon/Db/Dialect.zep", 941); - if (Z_TYPE_P(&_0$$4) == IS_ARRAY) { - zephir_array_fetch_string(&_1$$5, &value, SL("number"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 943); - ZEPHIR_CALL_METHOD(&limit, this_ptr, "getsqlexpression", NULL, 0, &_1$$5, &escapeChar, &bindCounts); + if (_51) { + ZEPHIR_INIT_VAR(&sequenceName); + ZVAL_NULL(&sequenceName); + ZEPHIR_CALL_METHOD(&_52$$49, connection, "supportsequences", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(&_52$$49)) { + if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("getsequencename")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(&sequenceName, this_ptr, "getsequencename", NULL, 0); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&sequenceName); + if (ZEPHIR_IS_EMPTY(&schema)) { + ZEPHIR_CONCAT_VSVS(&sequenceName, &source, "_", identityField, "_seq"); + } else { + ZEPHIR_CONCAT_VSVSVS(&sequenceName, &schema, ".", &source, "_", identityField, "_seq"); + } + } + } + ZEPHIR_CALL_METHOD(&lastInsertedId, connection, "lastinsertid", NULL, 0, &sequenceName); + zephir_check_call_status(); + if (UNEXPECTED(ZEPHIR_GLOBAL(orm).cast_last_insert_id_to_int)) { + ZVAL_LONG(&_53$$55, 10); + ZEPHIR_CALL_FUNCTION(&_54$$55, "intval", NULL, 41, &lastInsertedId, &_53$$55); zephir_check_call_status(); + ZEPHIR_CPY_WRT(&lastInsertedId, &_54$$55); + } + zephir_update_property_zval_zval(this_ptr, &attributeField, &lastInsertedId); + zephir_array_update_zval(&snapshot, &attributeField, &lastInsertedId, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, ZEND_STRL("uniqueParams"), &__$null); + } + if (zephir_is_true(&success)) { + zephir_is_iterable(&unsetDefaultValues, 0, "phalcon/Mvc/Model.zep", 3930); + if (Z_TYPE_P(&unsetDefaultValues) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&unsetDefaultValues), _57$$56, _58$$56, _55$$56) + { + ZEPHIR_INIT_NVAR(&attributeField); + if (_58$$56 != NULL) { + ZVAL_STR_COPY(&attributeField, _58$$56); + } else { + ZVAL_LONG(&attributeField, _57$$56); + } + ZEPHIR_INIT_NVAR(&defaultValue); + ZVAL_COPY(&defaultValue, _55$$56); + zephir_update_property_zval_zval(this_ptr, &attributeField, &defaultValue); + } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_OBS_NVAR(&limit); - zephir_array_fetch_string(&limit, &value, SL("number"), PH_NOISY, "phalcon/Db/Dialect.zep", 948); + ZEPHIR_CALL_METHOD(NULL, &unsetDefaultValues, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_56$$56, &unsetDefaultValues, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_56$$56)) { + break; + } + ZEPHIR_CALL_METHOD(&attributeField, &unsetDefaultValues, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&defaultValue, &unsetDefaultValues, "current", NULL, 0); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &attributeField, &defaultValue); + ZEPHIR_CALL_METHOD(NULL, &unsetDefaultValues, "next", NULL, 0); + zephir_check_call_status(); + } } - ZEPHIR_OBS_NVAR(&offset); - _2$$4 = zephir_array_isset_string_fetch(&offset, &value, SL("offset"), 0); - if (_2$$4) { - _2$$4 = Z_TYPE_P(&offset) == IS_ARRAY; + ZEPHIR_INIT_NVAR(&defaultValue); + ZEPHIR_INIT_NVAR(&attributeField); + ZEPHIR_CALL_METHOD(&_59$$56, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + _60$$56 = zephir_is_true(&_59$$56); + if (_60$$56) { + _60$$56 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; } - if (_2$$4) { - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "getsqlexpression", NULL, 46, &offset, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&offset, &_3$$7); + if (_60$$56) { + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &snapshot); } - } else { - ZEPHIR_CPY_WRT(&limit, &value); } - ZEPHIR_INIT_VAR(&_4); - zephir_create_array(&_4, 2, 0); - zephir_array_fast_append(&_4, &limit); - zephir_array_fast_append(&_4, &offset); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "limit", NULL, 0, &sql, &_4); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CCTOR(&success); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList) +static PHP_METHOD(Phalcon_Mvc_Model, doLowUpdate) { - zend_bool _0, _1, _7$$4; + zval _21$$25, _22$$25, _37$$48, _38$$48; + zval _67; + zend_bool changed = 0, useDynamicUpdate = 0, _2, _69, _70, _15$$19, _17$$19, _32$$42, _34$$42; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_19 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, item, values, separator, *_2$$4, _3$$4, _8$$4, _9$$4, _4$$5, _6$$6; - zval expression, bindCounts, items; + zval *metaData, metaData_sub, *connection, connection_sub, *table = NULL, table_sub, __$null, automaticAttributes, attributeField, bindSkip, bindDataTypes, bindType, bindTypes, columnMap, dataType, dataTypes, field, fields, manager, nonPrimary, newSnapshot, success, primaryKeys, snapshot, snapshotValue, uniqueKey, uniqueParams, value, values, updateValue, _0, _1, _68, *_3$$5, _4$$5, _5$$9, _6$$9, _7$$9, _9$$12, _10$$12, _11$$12, _12$$20, _13$$20, _14$$20, _16$$21, _18$$24, _20$$24, _23$$32, _24$$32, _25$$32, _26$$35, _27$$35, _28$$35, _29$$43, _30$$43, _31$$43, _33$$44, _35$$47, _36$$47, *_39$$53, _40$$53, _41$$57, _42$$57, _43$$57, _44$$60, _45$$60, _46$$60, _47$$66, _48$$66, _49$$66, _50$$69, _51$$69, _52$$69, _53$$74, _54$$74, _55$$74, *_56$$73, _57$$73, _58$$77, _59$$77, _60$$77, _61$$83, _62$$83, _63$$83, _64$$87, _65$$87, _66$$87, _71$$89, _72$$90; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&items); - ZVAL_UNDEF(&item); + ZVAL_UNDEF(&metaData_sub); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&table_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&automaticAttributes); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&bindSkip); + ZVAL_UNDEF(&bindDataTypes); + ZVAL_UNDEF(&bindType); + ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&dataType); + ZVAL_UNDEF(&dataTypes); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&fields); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&nonPrimary); + ZVAL_UNDEF(&newSnapshot); + ZVAL_UNDEF(&success); + ZVAL_UNDEF(&primaryKeys); + ZVAL_UNDEF(&snapshot); + ZVAL_UNDEF(&snapshotValue); + ZVAL_UNDEF(&uniqueKey); + ZVAL_UNDEF(&uniqueParams); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&values); - ZVAL_UNDEF(&separator); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&updateValue); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_68); ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&_5$$9); + ZVAL_UNDEF(&_6$$9); + ZVAL_UNDEF(&_7$$9); + ZVAL_UNDEF(&_9$$12); + ZVAL_UNDEF(&_10$$12); + ZVAL_UNDEF(&_11$$12); + ZVAL_UNDEF(&_12$$20); + ZVAL_UNDEF(&_13$$20); + ZVAL_UNDEF(&_14$$20); + ZVAL_UNDEF(&_16$$21); + ZVAL_UNDEF(&_18$$24); + ZVAL_UNDEF(&_20$$24); + ZVAL_UNDEF(&_23$$32); + ZVAL_UNDEF(&_24$$32); + ZVAL_UNDEF(&_25$$32); + ZVAL_UNDEF(&_26$$35); + ZVAL_UNDEF(&_27$$35); + ZVAL_UNDEF(&_28$$35); + ZVAL_UNDEF(&_29$$43); + ZVAL_UNDEF(&_30$$43); + ZVAL_UNDEF(&_31$$43); + ZVAL_UNDEF(&_33$$44); + ZVAL_UNDEF(&_35$$47); + ZVAL_UNDEF(&_36$$47); + ZVAL_UNDEF(&_40$$53); + ZVAL_UNDEF(&_41$$57); + ZVAL_UNDEF(&_42$$57); + ZVAL_UNDEF(&_43$$57); + ZVAL_UNDEF(&_44$$60); + ZVAL_UNDEF(&_45$$60); + ZVAL_UNDEF(&_46$$60); + ZVAL_UNDEF(&_47$$66); + ZVAL_UNDEF(&_48$$66); + ZVAL_UNDEF(&_49$$66); + ZVAL_UNDEF(&_50$$69); + ZVAL_UNDEF(&_51$$69); + ZVAL_UNDEF(&_52$$69); + ZVAL_UNDEF(&_53$$74); + ZVAL_UNDEF(&_54$$74); + ZVAL_UNDEF(&_55$$74); + ZVAL_UNDEF(&_57$$73); + ZVAL_UNDEF(&_58$$77); + ZVAL_UNDEF(&_59$$77); + ZVAL_UNDEF(&_60$$77); + ZVAL_UNDEF(&_61$$83); + ZVAL_UNDEF(&_62$$83); + ZVAL_UNDEF(&_63$$83); + ZVAL_UNDEF(&_64$$87); + ZVAL_UNDEF(&_65$$87); + ZVAL_UNDEF(&_66$$87); + ZVAL_UNDEF(&_71$$89); + ZVAL_UNDEF(&_72$$90); + ZVAL_UNDEF(&_67); + ZVAL_UNDEF(&_21$$25); + ZVAL_UNDEF(&_22$$25); + ZVAL_UNDEF(&_37$$48); + ZVAL_UNDEF(&_38$$48); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_OBJECT_OF_CLASS(metaData, phalcon_mvc_model_metadatainterface_ce) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) + Z_PARAM_ZVAL(table) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 3, 0, &metaData, &connection, &table); + ZEPHIR_SEPARATE_PARAM(table); - ZEPHIR_INIT_VAR(&items); - array_init(&items); - ZEPHIR_INIT_VAR(&separator); - ZVAL_STRING(&separator, ", "); - if (zephir_array_isset_string(&expression, SL("separator"))) { - ZEPHIR_OBS_NVAR(&separator); - zephir_array_fetch_string(&separator, &expression, SL("separator"), PH_NOISY, "phalcon/Db/Dialect.zep", 987); - } - ZEPHIR_OBS_VAR(&values); - _0 = zephir_array_isset_long_fetch(&values, &expression, 0, 0); - if (!(_0)) { - ZEPHIR_OBS_NVAR(&values); - _0 = zephir_array_isset_string_fetch(&values, &expression, SL("value"), 0); + ZEPHIR_INIT_VAR(&bindSkip); + ZVAL_LONG(&bindSkip, 1024); + ZEPHIR_INIT_VAR(&fields); + array_init(&fields); + ZEPHIR_INIT_VAR(&values); + array_init(&values); + ZEPHIR_INIT_VAR(&bindTypes); + array_init(&bindTypes); + ZEPHIR_INIT_VAR(&newSnapshot); + array_init(&newSnapshot); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_CALL_METHOD(&_1, &manager, "isusingdynamicupdate", NULL, 0, this_ptr); + zephir_check_call_status(); + useDynamicUpdate = zephir_get_boolval(&_1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&snapshot, &_0); + ZEPHIR_CALL_METHOD(&dataTypes, metaData, "getdatatypes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&nonPrimary, metaData, "getnonprimarykeyattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&automaticAttributes, metaData, "getautomaticupdateattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); } - _1 = _0; - if (_1) { - _1 = Z_TYPE_P(&values) == IS_ARRAY; + _2 = useDynamicUpdate; + if (_2) { + _2 = Z_TYPE_P(&snapshot) == IS_ARRAY; } - if (_1) { - zephir_is_iterable(&values, 0, "phalcon/Db/Dialect.zep", 996); - if (Z_TYPE_P(&values) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&values), _2$$4) + if (EXPECTED(_2)) { + zephir_is_iterable(&nonPrimary, 0, "phalcon/Mvc/Model.zep", 4090); + if (Z_TYPE_P(&nonPrimary) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&nonPrimary), _3$$5) { - ZEPHIR_INIT_NVAR(&item); - ZVAL_COPY(&item, _2$$4); - ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqlexpression", &_5, 0, &item, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_append(&items, &_4$$5, PH_SEPARATE, "phalcon/Db/Dialect.zep", 993); + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _3$$5); + changed = 0; + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_5$$9); + object_init_ex(&_5$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_6$$9); + zephir_get_class(&_6$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_7$$9); + ZEPHIR_CONCAT_SVSVS(&_7$$9, "Column '", &field, "' in '", &_6$$9, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", &_8, 32, &_7$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(&_5$$9, "phalcon/Mvc/Model.zep", 3984); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_9$$12); + object_init_ex(&_9$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_10$$12); + zephir_get_class(&_10$$12, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_11$$12); + ZEPHIR_CONCAT_SVSVS(&_11$$12, "Column '", &field, "' in '", &_10$$12, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_9$$12, "__construct", &_8, 32, &_11$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(&_9$$12, "phalcon/Mvc/Model.zep", 3997); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + ZEPHIR_OBS_NVAR(&snapshotValue); + if (!(zephir_array_isset_fetch(&snapshotValue, &snapshot, &attributeField, 0))) { + changed = 1; + } else { + if (Z_TYPE_P(&value) == IS_NULL) { + changed = Z_TYPE_P(&snapshotValue) != IS_NULL; + } else { + if (Z_TYPE_P(&snapshotValue) == IS_NULL) { + changed = 1; + } else { + ZEPHIR_OBS_NVAR(&dataType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&dataType, &dataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_12$$20); + object_init_ex(&_12$$20, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_13$$20); + zephir_get_class(&_13$$20, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_14$$20); + ZEPHIR_CONCAT_SVSVS(&_14$$20, "Column '", &field, "' in '", &_13$$20, "' have not defined a data type"); + ZEPHIR_CALL_METHOD(NULL, &_12$$20, "__construct", &_8, 32, &_14$$20); + zephir_check_call_status(); + zephir_throw_exception_debug(&_12$$20, "phalcon/Mvc/Model.zep", 4027); + ZEPHIR_MM_RESTORE(); + return; + } + _15$$19 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; + if (_15$$19) { + _15$$19 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); + } + if (_15$$19) { + ZEPHIR_CALL_METHOD(&_16$$21, &snapshotValue, "getvalue", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&snapshotValue, &_16$$21); + } + ZEPHIR_CPY_WRT(&updateValue, &value); + _17$$19 = Z_TYPE_P(&value) == IS_OBJECT; + if (_17$$19) { + _17$$19 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); + } + if (_17$$19) { + ZEPHIR_CALL_METHOD(&updateValue, &value, "getvalue", NULL, 0); + zephir_check_call_status(); + } + do { + if (ZEPHIR_IS_LONG(&dataType, 8)) { + changed = zephir_get_boolval(&snapshotValue) != zephir_get_boolval(&updateValue); + break; + } + if (ZEPHIR_IS_LONG(&dataType, 3) || ZEPHIR_IS_LONG(&dataType, 7)) { + ZEPHIR_CALL_FUNCTION(&_18$$24, "floatval", &_19, 18, &snapshotValue); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&_20$$24, "floatval", &_19, 18, &updateValue); + zephir_check_call_status(); + changed = !ZEPHIR_IS_IDENTICAL(&_18$$24, &_20$$24); + break; + } + if (ZEPHIR_IS_LONG(&dataType, 0) || ZEPHIR_IS_LONG(&dataType, 1) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 4) || ZEPHIR_IS_LONG(&dataType, 5) || ZEPHIR_IS_LONG(&dataType, 6) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 14)) { + zephir_cast_to_string(&_21$$25, &snapshotValue); + zephir_cast_to_string(&_22$$25, &updateValue); + changed = !ZEPHIR_IS_IDENTICAL(&_21$$25, &_22$$25); + break; + } + changed = !ZEPHIR_IS_EQUAL(&updateValue, &snapshotValue); + } while(0); + + } + } + } + if (changed) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); + } + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + } + } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_3$$4, &values, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_4$$5, &nonPrimary, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_3$$4)) { + if (!zend_is_true(&_4$$5)) { break; } - ZEPHIR_CALL_METHOD(&item, &values, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&field, &nonPrimary, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "getsqlexpression", &_5, 46, &item, &escapeChar, &bindCounts); - zephir_check_call_status(); - zephir_array_append(&items, &_6$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 993); - ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); + changed = 0; + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_23$$32); + object_init_ex(&_23$$32, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_24$$32); + zephir_get_class(&_24$$32, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_25$$32); + ZEPHIR_CONCAT_SVSVS(&_25$$32, "Column '", &field, "' in '", &_24$$32, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_23$$32, "__construct", &_8, 32, &_25$$32); + zephir_check_call_status(); + zephir_throw_exception_debug(&_23$$32, "phalcon/Mvc/Model.zep", 3984); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_26$$35); + object_init_ex(&_26$$35, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_27$$35); + zephir_get_class(&_27$$35, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_28$$35); + ZEPHIR_CONCAT_SVSVS(&_28$$35, "Column '", &field, "' in '", &_27$$35, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_26$$35, "__construct", &_8, 32, &_28$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(&_26$$35, "phalcon/Mvc/Model.zep", 3997); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + ZEPHIR_OBS_NVAR(&snapshotValue); + if (!(zephir_array_isset_fetch(&snapshotValue, &snapshot, &attributeField, 0))) { + changed = 1; + } else { + if (Z_TYPE_P(&value) == IS_NULL) { + changed = Z_TYPE_P(&snapshotValue) != IS_NULL; + } else { + if (Z_TYPE_P(&snapshotValue) == IS_NULL) { + changed = 1; + } else { + ZEPHIR_OBS_NVAR(&dataType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&dataType, &dataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_29$$43); + object_init_ex(&_29$$43, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_30$$43); + zephir_get_class(&_30$$43, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_31$$43); + ZEPHIR_CONCAT_SVSVS(&_31$$43, "Column '", &field, "' in '", &_30$$43, "' have not defined a data type"); + ZEPHIR_CALL_METHOD(NULL, &_29$$43, "__construct", &_8, 32, &_31$$43); + zephir_check_call_status(); + zephir_throw_exception_debug(&_29$$43, "phalcon/Mvc/Model.zep", 4027); + ZEPHIR_MM_RESTORE(); + return; + } + _32$$42 = Z_TYPE_P(&snapshotValue) == IS_OBJECT; + if (_32$$42) { + _32$$42 = zephir_instance_of_ev(&snapshotValue, phalcon_db_rawvalue_ce); + } + if (_32$$42) { + ZEPHIR_CALL_METHOD(&_33$$44, &snapshotValue, "getvalue", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&snapshotValue, &_33$$44); + } + ZEPHIR_CPY_WRT(&updateValue, &value); + _34$$42 = Z_TYPE_P(&value) == IS_OBJECT; + if (_34$$42) { + _34$$42 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); + } + if (_34$$42) { + ZEPHIR_CALL_METHOD(&updateValue, &value, "getvalue", NULL, 0); + zephir_check_call_status(); + } + do { + if (ZEPHIR_IS_LONG(&dataType, 8)) { + changed = zephir_get_boolval(&snapshotValue) != zephir_get_boolval(&updateValue); + break; + } + if (ZEPHIR_IS_LONG(&dataType, 3) || ZEPHIR_IS_LONG(&dataType, 7)) { + ZEPHIR_CALL_FUNCTION(&_35$$47, "floatval", &_19, 18, &snapshotValue); + zephir_check_call_status(); + ZEPHIR_CALL_FUNCTION(&_36$$47, "floatval", &_19, 18, &updateValue); + zephir_check_call_status(); + changed = !ZEPHIR_IS_IDENTICAL(&_35$$47, &_36$$47); + break; + } + if (ZEPHIR_IS_LONG(&dataType, 0) || ZEPHIR_IS_LONG(&dataType, 1) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 4) || ZEPHIR_IS_LONG(&dataType, 5) || ZEPHIR_IS_LONG(&dataType, 6) || ZEPHIR_IS_LONG(&dataType, 2) || ZEPHIR_IS_LONG(&dataType, 14)) { + zephir_cast_to_string(&_37$$48, &snapshotValue); + zephir_cast_to_string(&_38$$48, &updateValue); + changed = !ZEPHIR_IS_IDENTICAL(&_37$$48, &_38$$48); + break; + } + changed = !ZEPHIR_IS_EQUAL(&updateValue, &snapshotValue); + } while(0); + + } + } + } + if (changed) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4077); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4078); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4079); + } + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + } + } + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&item); - _7$$4 = zephir_array_isset_string(&expression, SL("parentheses")); - if (_7$$4) { - zephir_array_fetch_string(&_8$$4, &expression, SL("parentheses"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 996); - _7$$4 = ZEPHIR_IS_FALSE_IDENTICAL(&_8$$4); + ZEPHIR_INIT_NVAR(&field); + if (!(zephir_fast_count_int(&fields))) { + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); + RETURN_MM_BOOL(1); } - if (_7$$4) { - zephir_fast_join(return_value, &separator, &items); - RETURN_MM(); + } else { + zephir_is_iterable(&nonPrimary, 0, "phalcon/Mvc/Model.zep", 4145); + if (Z_TYPE_P(&nonPrimary) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&nonPrimary), _39$$53) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _39$$53); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_41$$57); + object_init_ex(&_41$$57, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_42$$57); + zephir_get_class(&_42$$57, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_43$$57); + ZEPHIR_CONCAT_SVSVS(&_43$$57, "Column '", &field, "' in '", &_42$$57, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_41$$57, "__construct", &_8, 32, &_43$$57); + zephir_check_call_status(); + zephir_throw_exception_debug(&_41$$57, "phalcon/Mvc/Model.zep", 4108); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_44$$60); + object_init_ex(&_44$$60, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_45$$60); + zephir_get_class(&_45$$60, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_46$$60); + ZEPHIR_CONCAT_SVSVS(&_46$$60, "Column '", &field, "' in '", &_45$$60, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_44$$60, "__construct", &_8, 32, &_46$$60); + zephir_check_call_status(); + zephir_throw_exception_debug(&_44$$60, "phalcon/Mvc/Model.zep", 4122); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4133); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4135); + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4139); + zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4140); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4141); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_40$$53, &nonPrimary, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_40$$53)) { + break; + } + ZEPHIR_CALL_METHOD(&field, &nonPrimary, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_47$$66); + object_init_ex(&_47$$66, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_48$$66); + zephir_get_class(&_48$$66, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_49$$66); + ZEPHIR_CONCAT_SVSVS(&_49$$66, "Column '", &field, "' in '", &_48$$66, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_47$$66, "__construct", &_8, 32, &_49$$66); + zephir_check_call_status(); + zephir_throw_exception_debug(&_47$$66, "phalcon/Mvc/Model.zep", 4108); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + ZEPHIR_OBS_NVAR(&bindType); + if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_50$$69); + object_init_ex(&_50$$69, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_51$$69); + zephir_get_class(&_51$$69, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_52$$69); + ZEPHIR_CONCAT_SVSVS(&_52$$69, "Column '", &field, "' in '", &_51$$69, "' have not defined a bind data type"); + ZEPHIR_CALL_METHOD(NULL, &_50$$69, "__construct", &_8, 32, &_52$$69); + zephir_check_call_status(); + zephir_throw_exception_debug(&_50$$69, "phalcon/Mvc/Model.zep", 4122); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4133); + zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4134); + zephir_array_append(&bindTypes, &bindType, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4135); + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4139); + zephir_array_append(&values, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4140); + zephir_array_append(&bindTypes, &bindSkip, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4141); + } + } + ZEPHIR_CALL_METHOD(NULL, &nonPrimary, "next", NULL, 0); + zephir_check_call_status(); + } } - ZEPHIR_INIT_VAR(&_9$$4); - zephir_fast_join(&_9$$4, &separator, &items); - ZEPHIR_CONCAT_SVS(return_value, "(", &_9$$4, ")"); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&field); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-list expression", "phalcon/Db/Dialect.zep", 1003); - return; -} - -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionObject) -{ - zend_bool _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, domain, objectExpression; - zval expression, bindCounts; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&objectExpression); - ZVAL_UNDEF(&escapeChar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); + if (!(zephir_fast_count_int(&fields))) { + RETURN_MM_BOOL(1); } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + zephir_read_property(&_0, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueParams, &_0); + if (Z_TYPE_P(&uniqueParams) != IS_ARRAY) { + ZEPHIR_CALL_METHOD(&primaryKeys, metaData, "getprimarykeyattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + if (UNEXPECTED(!(zephir_fast_count_int(&primaryKeys)))) { + ZEPHIR_INIT_VAR(&_53$$74); + object_init_ex(&_53$$74, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_54$$74); + zephir_get_class(&_54$$74, this_ptr, 0); + ZEPHIR_INIT_VAR(&_55$$74); + ZEPHIR_CONCAT_SVS(&_55$$74, "A primary key must be defined in the model in order to perform the operation in '", &_54$$74, "'"); + ZEPHIR_CALL_METHOD(NULL, &_53$$74, "__construct", &_8, 32, &_55$$74); + zephir_check_call_status(); + zephir_throw_exception_debug(&_53$$74, "phalcon/Mvc/Model.zep", 4168); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_NVAR(&uniqueParams); + array_init(&uniqueParams); + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4195); + if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _56$$73) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _56$$73); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_58$$77); + object_init_ex(&_58$$77, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_59$$77); + zephir_get_class(&_59$$77, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_60$$77); + ZEPHIR_CONCAT_SVSVS(&_60$$77, "Column '", &field, "' in '", &_59$$77, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_58$$77, "__construct", &_8, 32, &_60$$77); + zephir_check_call_status(); + zephir_throw_exception_debug(&_58$$77, "phalcon/Mvc/Model.zep", 4181); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4189); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4192); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_57$$73, &primaryKeys, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_57$$73)) { + break; + } + ZEPHIR_CALL_METHOD(&field, &primaryKeys, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_61$$83); + object_init_ex(&_61$$83, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_62$$83); + zephir_get_class(&_62$$83, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_63$$83); + ZEPHIR_CONCAT_SVSVS(&_63$$83, "Column '", &field, "' in '", &_62$$83, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_61$$83, "__construct", &_8, 32, &_63$$83); + zephir_check_call_status(); + zephir_throw_exception_debug(&_61$$83, "phalcon/Mvc/Model.zep", 4181); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + zephir_array_update_zval(&newSnapshot, &attributeField, &value, PH_COPY | PH_SEPARATE); + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4189); + } else { + zephir_array_update_zval(&newSnapshot, &attributeField, &__$null, PH_COPY | PH_SEPARATE); + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4192); + } + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); } - - - ZEPHIR_INIT_VAR(&domain); - ZVAL_NULL(&domain); - ZEPHIR_INIT_VAR(&objectExpression); - zephir_create_array(&objectExpression, 1, 0); - add_assoc_stringl_ex(&objectExpression, SL("type"), SL("all")); - ZEPHIR_OBS_NVAR(&domain); - _0 = zephir_array_isset_string_fetch(&domain, &expression, SL("column"), 0); - if (!(_0)) { - ZEPHIR_OBS_NVAR(&domain); - _0 = zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0); + if (Z_TYPE_P(table) == IS_ARRAY) { + zephir_array_fetch_long(&_64$$87, table, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4201); + zephir_array_fetch_long(&_65$$87, table, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4201); + ZEPHIR_INIT_VAR(&_66$$87); + ZEPHIR_CONCAT_VSV(&_66$$87, &_64$$87, ".", &_65$$87); + ZEPHIR_CPY_WRT(table, &_66$$87); + } + ZEPHIR_INIT_VAR(&_67); + zephir_create_array(&_67, 3, 0); + zephir_array_update_string(&_67, SL("conditions"), &uniqueKey, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_67, SL("bind"), &uniqueParams, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_VAR(&_68); + zephir_read_property(&_68, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC); + zephir_array_update_string(&_67, SL("bindTypes"), &_68, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&success, connection, "update", NULL, 0, table, &fields, &values, &_67, &bindTypes); + zephir_check_call_status(); + _69 = zephir_is_true(&success); + if (_69) { + ZEPHIR_CALL_METHOD(&_1, &manager, "iskeepingsnapshots", NULL, 0, this_ptr); + zephir_check_call_status(); + _69 = zephir_is_true(&_1); } - _1 = _0; - if (_1) { - _1 = !ZEPHIR_IS_STRING(&domain, ""); + _70 = _69; + if (_70) { + _70 = ZEPHIR_GLOBAL(orm).update_snapshot_on_save; } - if (_1) { - zephir_array_update_string(&objectExpression, SL("domain"), &domain, PH_COPY | PH_SEPARATE); + if (_70) { + if (Z_TYPE_P(&snapshot) == IS_ARRAY) { + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &snapshot); + ZEPHIR_INIT_VAR(&_71$$89); + zephir_fast_array_merge(&_71$$89, &snapshot, &newSnapshot); + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &_71$$89); + } else { + ZEPHIR_INIT_VAR(&_72$$90); + array_init(&_72$$90); + zephir_update_property_zval(this_ptr, ZEND_STRL("oldSnapshot"), &_72$$90); + zephir_update_property_zval(this_ptr, ZEND_STRL("snapshot"), &newSnapshot); + } } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, 0, &objectExpression, &escapeChar, &bindCounts); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CCTOR(&success); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy) +static PHP_METHOD(Phalcon_Mvc_Model, has) { - zend_bool _4$$4, _7$$7; + zend_bool _7$$11, _17$$19; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, field, fields, type, fieldSql, *_0$$3, _1$$3, _9$$3, _2$$4, _5$$6, _6$$7, _8$$9; + zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_22 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, numberEmpty = 0, numberPrimary = 0; + zval *metaData, metaData_sub, *connection, connection_sub, __$null, attributeField, bindDataTypes, columnMap, field, joinWhere, num, primaryKeys, schema, source, table, type, uniqueKey, uniqueParams, uniqueTypes, value, wherePk, _0, _27, _28, _29, _30, *_1$$3, _2$$3, _3$$9, _4$$9, _5$$9, _8$$14, _9$$14, _10$$14, _11$$7, _13$$7, _14$$17, _15$$17, _16$$17, _18$$22, _19$$22, _20$$22, _21$$15, _23$$15, _24$$25, _25$$26, _26$$27, _31$$30, _32$$31; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression_sub); + ZVAL_UNDEF(&metaData_sub); + ZVAL_UNDEF(&connection_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&bindDataTypes); + ZVAL_UNDEF(&columnMap); ZVAL_UNDEF(&field); - ZVAL_UNDEF(&fields); + ZVAL_UNDEF(&joinWhere); + ZVAL_UNDEF(&num); + ZVAL_UNDEF(&primaryKeys); + ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&source); + ZVAL_UNDEF(&table); ZVAL_UNDEF(&type); - ZVAL_UNDEF(&fieldSql); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_8$$9); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&bindCounts); + ZVAL_UNDEF(&uniqueKey); + ZVAL_UNDEF(&uniqueParams); + ZVAL_UNDEF(&uniqueTypes); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&wherePk); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_27); + ZVAL_UNDEF(&_28); + ZVAL_UNDEF(&_29); + ZVAL_UNDEF(&_30); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$9); + ZVAL_UNDEF(&_4$$9); + ZVAL_UNDEF(&_5$$9); + ZVAL_UNDEF(&_8$$14); + ZVAL_UNDEF(&_9$$14); + ZVAL_UNDEF(&_10$$14); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_13$$7); + ZVAL_UNDEF(&_14$$17); + ZVAL_UNDEF(&_15$$17); + ZVAL_UNDEF(&_16$$17); + ZVAL_UNDEF(&_18$$22); + ZVAL_UNDEF(&_19$$22); + ZVAL_UNDEF(&_20$$22); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_23$$15); + ZVAL_UNDEF(&_24$$25); + ZVAL_UNDEF(&_25$$26); + ZVAL_UNDEF(&_26$$27); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$31); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(metaData, phalcon_mvc_model_metadatainterface_ce) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 2, 0, &metaData, &connection); - ZEPHIR_INIT_VAR(&fieldSql); - ZVAL_NULL(&fieldSql); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 1068); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) + ZEPHIR_INIT_VAR(&uniqueParams); + ZVAL_NULL(&uniqueParams); + ZEPHIR_INIT_VAR(&uniqueTypes); + ZVAL_NULL(&uniqueTypes); + zephir_read_property(&_0, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_0); + if (Z_TYPE_P(&uniqueKey) == IS_NULL) { + ZEPHIR_CALL_METHOD(&primaryKeys, metaData, "getprimarykeyattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, this_ptr); + zephir_check_call_status(); + numberPrimary = zephir_fast_count_int(&primaryKeys); + if (!(numberPrimary)) { + RETURN_MM_BOOL(0); + } + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); + } + numberEmpty = 0; + ZEPHIR_INIT_VAR(&wherePk); + array_init(&wherePk); + ZEPHIR_INIT_NVAR(&uniqueParams); + array_init(&uniqueParams); + ZEPHIR_INIT_NVAR(&uniqueTypes); + array_init(&uniqueTypes); + zephir_is_iterable(&primaryKeys, 0, "phalcon/Mvc/Model.zep", 4325); + if (Z_TYPE_P(&primaryKeys) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&primaryKeys), _1$$3) { ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _0$$3); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-ORDER-BY expression", "phalcon/Db/Dialect.zep", 1049); - return; + ZVAL_COPY(&field, _1$$3); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_3$$9); + object_init_ex(&_3$$9, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_4$$9); + zephir_get_class(&_4$$9, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_5$$9); + ZEPHIR_CONCAT_SVSVS(&_5$$9, "Column '", &field, "' in '", &_4$$9, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_3$$9, "__construct", &_6, 32, &_5$$9); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$9, "phalcon/Mvc/Model.zep", 4284); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); } - zephir_array_fetch_long(&_2$$4, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1053); - ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 0, &_2$$4, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&type); - _4$$4 = zephir_array_isset_long_fetch(&type, &field, 1, 0); - if (_4$$4) { - _4$$4 = !ZEPHIR_IS_STRING(&type, ""); + ZEPHIR_INIT_NVAR(&value); + ZVAL_NULL(&value); + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + _7$$11 = Z_TYPE_P(&value) == IS_NULL; + if (!(_7$$11)) { + _7$$11 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + } + if (_7$$11) { + numberEmpty++; + } + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4305); + } else { + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4307); + numberEmpty++; } - if (_4$$4) { - ZEPHIR_INIT_NVAR(&_5$$6); - ZEPHIR_CONCAT_SV(&_5$$6, " ", &type); - zephir_concat_self(&fieldSql, &_5$$6); + ZEPHIR_OBS_NVAR(&type); + if (UNEXPECTED(!(zephir_array_isset_fetch(&type, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_8$$14); + object_init_ex(&_8$$14, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$14); + zephir_get_class(&_9$$14, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_10$$14); + ZEPHIR_CONCAT_SVSVS(&_10$$14, "Column '", &field, "' in '", &_9$$14, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, &_8$$14, "__construct", &_6, 32, &_10$$14); + zephir_check_call_status(); + zephir_throw_exception_debug(&_8$$14, "phalcon/Mvc/Model.zep", 4314); + ZEPHIR_MM_RESTORE(); + return; } - zephir_array_append(&fields, &fieldSql, PH_SEPARATE, "phalcon/Db/Dialect.zep", 1065); + zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4317); + ZEPHIR_CALL_METHOD(&_11$$7, connection, "escapeidentifier", &_12, 0, &field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_13$$7); + ZEPHIR_CONCAT_VS(&_13$$7, &_11$$7, " = ?"); + zephir_array_append(&wherePk, &_13$$7, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4318); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2$$3, &primaryKeys, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { + if (!zend_is_true(&_2$$3)) { break; } - ZEPHIR_CALL_METHOD(&field, expression, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&field, &primaryKeys, "current", NULL, 0); zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-ORDER-BY expression", "phalcon/Db/Dialect.zep", 1049); - return; + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_14$$17); + object_init_ex(&_14$$17, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_15$$17); + zephir_get_class(&_15$$17, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_16$$17); + ZEPHIR_CONCAT_SVSVS(&_16$$17, "Column '", &field, "' in '", &_15$$17, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_14$$17, "__construct", &_6, 32, &_16$$17); + zephir_check_call_status(); + zephir_throw_exception_debug(&_14$$17, "phalcon/Mvc/Model.zep", 4284); + ZEPHIR_MM_RESTORE(); + return; + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); } - zephir_array_fetch_long(&_6$$7, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1053); - ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 46, &_6$$7, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&type); - _7$$7 = zephir_array_isset_long_fetch(&type, &field, 1, 0); - if (_7$$7) { - _7$$7 = !ZEPHIR_IS_STRING(&type, ""); + ZEPHIR_INIT_NVAR(&value); + ZVAL_NULL(&value); + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + _17$$19 = Z_TYPE_P(&value) == IS_NULL; + if (!(_17$$19)) { + _17$$19 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + } + if (_17$$19) { + numberEmpty++; + } + zephir_array_append(&uniqueParams, &value, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4305); + } else { + zephir_array_append(&uniqueParams, &__$null, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4307); + numberEmpty++; } - if (_7$$7) { - ZEPHIR_INIT_NVAR(&_8$$9); - ZEPHIR_CONCAT_SV(&_8$$9, " ", &type); - zephir_concat_self(&fieldSql, &_8$$9); + ZEPHIR_OBS_NVAR(&type); + if (UNEXPECTED(!(zephir_array_isset_fetch(&type, &bindDataTypes, &field, 0)))) { + ZEPHIR_INIT_NVAR(&_18$$22); + object_init_ex(&_18$$22, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_19$$22); + zephir_get_class(&_19$$22, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_20$$22); + ZEPHIR_CONCAT_SVSVS(&_20$$22, "Column '", &field, "' in '", &_19$$22, "' isn't part of the table columns"); + ZEPHIR_CALL_METHOD(NULL, &_18$$22, "__construct", &_6, 32, &_20$$22); + zephir_check_call_status(); + zephir_throw_exception_debug(&_18$$22, "phalcon/Mvc/Model.zep", 4314); + ZEPHIR_MM_RESTORE(); + return; } - zephir_array_append(&fields, &fieldSql, PH_SEPARATE, "phalcon/Db/Dialect.zep", 1065); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); + zephir_array_append(&uniqueTypes, &type, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4317); + ZEPHIR_CALL_METHOD(&_21$$15, connection, "escapeidentifier", &_22, 0, &field); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_23$$15); + ZEPHIR_CONCAT_VS(&_23$$15, &_21$$15, " = ?"); + zephir_array_append(&wherePk, &_23$$15, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4318); + ZEPHIR_CALL_METHOD(NULL, &primaryKeys, "next", NULL, 0); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(&field); - ZEPHIR_INIT_VAR(&_9$$3); - zephir_fast_join_str(&_9$$3, SL(", "), &fields); - ZEPHIR_CPY_WRT(&fields, &_9$$3); + if (numberPrimary == numberEmpty) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(&joinWhere); + zephir_fast_join_str(&joinWhere, SL(" AND "), &wherePk); + zephir_update_property_zval(this_ptr, ZEND_STRL("uniqueKey"), &joinWhere); + zephir_update_property_zval(this_ptr, ZEND_STRL("uniqueParams"), &uniqueParams); + zephir_update_property_zval(this_ptr, ZEND_STRL("uniqueTypes"), &uniqueTypes); + ZEPHIR_CPY_WRT(&uniqueKey, &joinWhere); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_is_true(&_0))) { + RETURN_MM_BOOL(1); + } + if (Z_TYPE_P(&uniqueKey) == IS_NULL) { + zephir_read_property(&_24$$25, this_ptr, ZEND_STRL("uniqueKey"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueKey, &_24$$25); + } + if (Z_TYPE_P(&uniqueParams) == IS_NULL) { + zephir_read_property(&_25$$26, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueParams, &_25$$26); + } + if (Z_TYPE_P(&uniqueTypes) == IS_NULL) { + zephir_read_property(&_26$$27, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&uniqueTypes, &_26$$27); + } + ZEPHIR_CALL_METHOD(&schema, this_ptr, "getschema", NULL, 425); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL, 426); + zephir_check_call_status(); + if (zephir_is_true(&schema)) { + ZEPHIR_INIT_VAR(&table); + zephir_create_array(&table, 2, 0); + zephir_array_fast_append(&table, &schema); + zephir_array_fast_append(&table, &source); } else { - ZEPHIR_CPY_WRT(&fields, expression); + ZEPHIR_CPY_WRT(&table, &source); } - ZEPHIR_CONCAT_SV(return_value, "ORDER BY ", &fields); - RETURN_MM(); + ZEPHIR_CALL_METHOD(&_27, connection, "escapeidentifier", NULL, 0, &table); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_28); + ZEPHIR_CONCAT_SVSV(&_28, "SELECT COUNT(*) \"rowcount\" FROM ", &_27, " WHERE ", &uniqueKey); + ZVAL_NULL(&_29); + ZEPHIR_CALL_METHOD(&num, connection, "fetchone", NULL, 0, &_28, &_29, &uniqueParams, &uniqueTypes); + zephir_check_call_status(); + zephir_array_fetch_string(&_30, &num, SL("rowcount"), PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4379); + if (zephir_is_true(&_30)) { + ZEPHIR_INIT_ZVAL_NREF(_31$$30); + ZVAL_LONG(&_31$$30, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_31$$30); + RETURN_MM_BOOL(1); + } else { + ZEPHIR_INIT_ZVAL_NREF(_32$$31); + ZVAL_LONG(&_32$$31, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("dirtyState"), &_32$$31); + } + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionQualified) +static PHP_METHOD(Phalcon_Mvc_Model, getRelatedRecords) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, column, domain; - zval expression; + zval arguments; + zval *modelName_param = NULL, *method_param = NULL, *arguments_param = NULL, manager, relation, queryMethod, extraArgs, alias, _0, _1$$3, _2$$3, _3$$5, _4$$5, _5$$5; + zval modelName, method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&queryMethod); + ZVAL_UNDEF(&extraArgs); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&arguments); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_STR(modelName) + Z_PARAM_STR(method) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); + zephir_fetch_params(1, 3, 0, &modelName_param, &method_param, &arguments_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_INIT_VAR(&modelName); + } + if (UNEXPECTED(Z_TYPE_P(method_param) != IS_STRING && Z_TYPE_P(method_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'method' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(method_param) == IS_STRING)) { + zephir_get_strval(&method, method_param); + } else { + ZEPHIR_INIT_VAR(&method); } + ZEPHIR_OBS_COPY_OR_DUP(&arguments, arguments_param); - ZEPHIR_OBS_VAR(&column); - zephir_array_fetch_string(&column, &expression, SL("name"), PH_NOISY, "phalcon/Db/Dialect.zep", 1083); - ZEPHIR_OBS_VAR(&domain); - if (!(zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0))) { - ZEPHIR_INIT_NVAR(&domain); - ZVAL_NULL(&domain); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&manager, &_0); + ZEPHIR_INIT_VAR(&relation); + ZVAL_BOOL(&relation, 0); + ZEPHIR_INIT_VAR(&queryMethod); + ZVAL_NULL(&queryMethod); + ZEPHIR_OBS_VAR(&extraArgs); + zephir_array_isset_long_fetch(&extraArgs, &arguments, 0, 0); + if (zephir_start_with_str(&method, SL("get"))) { + ZVAL_LONG(&_1$$3, 3); + ZEPHIR_INIT_VAR(&alias); + zephir_substr(&alias, &method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + ZEPHIR_CALL_METHOD(&_2$$3, &manager, "getrelationbyalias", NULL, 0, &modelName, &alias); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_2$$3); + if (Z_TYPE_P(&relation) != IS_OBJECT) { + RETURN_MM_BOOL(0); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getrelated", NULL, 0, &alias, &extraArgs); + zephir_check_call_status(); + RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, &column, &domain, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); + if (zephir_start_with_str(&method, SL("count"))) { + ZEPHIR_INIT_NVAR(&queryMethod); + ZVAL_STRING(&queryMethod, "count"); + ZVAL_LONG(&_4$$5, 5); + ZEPHIR_INIT_VAR(&_5$$5); + zephir_substr(&_5$$5, &method, 5 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + ZEPHIR_CALL_METHOD(&_3$$5, &manager, "getrelationbyalias", NULL, 0, &modelName, &_5$$5); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_3$$5); + if (Z_TYPE_P(&relation) != IS_OBJECT) { + RETURN_MM_BOOL(0); + } + ZEPHIR_RETURN_CALL_METHOD(&manager, "getrelationrecords", NULL, 0, &relation, this_ptr, &extraArgs, &queryMethod); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar) +static PHP_METHOD(Phalcon_Mvc_Model, groupResult) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, value, _0$$3; - zval expression, bindCounts; + zephir_fcall_cache_entry *_0 = NULL; + zval *functionName_param = NULL, *alias_param = NULL, *parameters = NULL, parameters_sub, __$null, params, distinctColumn, groupColumn, columns, resultset, cache, firstRow, groupColumns, builder, query, container, manager, transaction, bindParams, bindTypes, _1, _2, _3; + zval functionName, alias; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&functionName); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&distinctColumn); + ZVAL_UNDEF(&groupColumn); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&resultset); + ZVAL_UNDEF(&cache); + ZVAL_UNDEF(&firstRow); + ZVAL_UNDEF(&groupColumns); + ZVAL_UNDEF(&builder); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&transaction); + ZVAL_UNDEF(&bindParams); + ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(functionName) + Z_PARAM_STR(alias) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + Z_PARAM_ZVAL_OR_NULL(parameters) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); + zephir_fetch_params(1, 2, 1, &functionName_param, &alias_param, ¶meters); + if (UNEXPECTED(Z_TYPE_P(functionName_param) != IS_STRING && Z_TYPE_P(functionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'functionName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(functionName_param) == IS_STRING)) { + zephir_get_strval(&functionName, functionName_param); } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_INIT_VAR(&functionName); } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); + if (UNEXPECTED(Z_TYPE_P(alias_param) != IS_STRING && Z_TYPE_P(alias_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'alias' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(alias_param) == IS_STRING)) { + zephir_get_strval(&alias, alias_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); + ZEPHIR_INIT_VAR(&alias); + } + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; } - if (zephir_array_isset_string(&expression, SL("column"))) { - zephir_array_fetch_string(&_0$$3, &expression, SL("column"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1107); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlcolumn", NULL, 40, &_0$$3); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&bindParams); + array_init(&bindParams); + ZEPHIR_INIT_VAR(&bindTypes); + array_init(&bindTypes); + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "modelsManager"); + ZEPHIR_CALL_METHOD(&_1, &container, "getshared", NULL, 0, &_2); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + if (Z_TYPE_P(parameters) != IS_ARRAY) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + if (Z_TYPE_P(parameters) != IS_NULL) { + zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/Mvc/Model.zep", 4484); + } + } else { + ZEPHIR_CPY_WRT(¶ms, parameters); } - ZEPHIR_OBS_VAR(&value); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&value, &expression, SL("value"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/Db/Dialect.zep", 1111); - return; + ZEPHIR_OBS_VAR(&groupColumn); + if (!(zephir_array_isset_string_fetch(&groupColumn, ¶ms, SL("column"), 0))) { + ZEPHIR_INIT_NVAR(&groupColumn); + ZVAL_STRING(&groupColumn, "*"); } - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, 0, &value, &escapeChar, &bindCounts); + ZEPHIR_OBS_VAR(&distinctColumn); + if (zephir_array_isset_string_fetch(&distinctColumn, ¶ms, SL("distinct"), 0)) { + ZEPHIR_INIT_VAR(&columns); + ZEPHIR_CONCAT_VSVSV(&columns, &functionName, "(DISTINCT ", &distinctColumn, ") AS ", &alias); + } else { + ZEPHIR_OBS_VAR(&groupColumns); + ZEPHIR_INIT_NVAR(&columns); + if (zephir_array_isset_string_fetch(&groupColumns, ¶ms, SL("group"), 0)) { + ZEPHIR_CONCAT_VSVSVSV(&columns, &groupColumns, ", ", &functionName, "(", &groupColumn, ") AS ", &alias); + } else { + ZEPHIR_CONCAT_VSVSV(&columns, &functionName, "(", &groupColumn, ") AS ", &alias); + } + } + ZEPHIR_CALL_METHOD(&_1, &manager, "createbuilder", NULL, 0, ¶ms); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&builder, &_1); + ZEPHIR_CALL_METHOD(NULL, &builder, "columns", NULL, 0, &columns); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_2); + zephir_get_called_class(&_2); + ZEPHIR_CALL_METHOD(NULL, &builder, "from", NULL, 0, &_2); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, &builder, "getquery", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&query, &_1); + ZEPHIR_OBS_VAR(&transaction); + if (zephir_array_isset_string_fetch(&transaction, ¶ms, SL("transaction"), 0)) { + if (zephir_instance_of_ev(&transaction, phalcon_mvc_model_transactioninterface_ce)) { + ZEPHIR_CALL_METHOD(NULL, &query, "settransaction", NULL, 0, &transaction); + zephir_check_call_status(); + } + } + if (zephir_array_isset_string(¶ms, SL("bind"))) { + ZEPHIR_OBS_NVAR(&bindParams); + zephir_array_fetch_string(&bindParams, ¶ms, SL("bind"), PH_NOISY, "phalcon/Mvc/Model.zep", 4527); + if (zephir_array_isset_string(¶ms, SL("bindTypes"))) { + ZEPHIR_OBS_NVAR(&bindTypes); + zephir_array_fetch_string(&bindTypes, ¶ms, SL("bindTypes"), PH_NOISY, "phalcon/Mvc/Model.zep", 4530); + } + } + ZEPHIR_OBS_VAR(&cache); + if (zephir_array_isset_string_fetch(&cache, ¶ms, SL("cache"), 0)) { + ZEPHIR_CALL_METHOD(NULL, &query, "cache", NULL, 0, &cache); zephir_check_call_status(); - RETURN_MM(); } - RETURN_CCTOR(&value); + ZEPHIR_CALL_METHOD(&resultset, &query, "execute", NULL, 0, &bindParams, &bindTypes); + zephir_check_call_status(); + if (zephir_array_isset_string(¶ms, SL("group"))) { + RETURN_CCTOR(&resultset); + } + ZEPHIR_CALL_METHOD(&firstRow, &resultset, "getfirst", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&_3); + zephir_read_property_zval(&_3, &firstRow, &alias, PH_NOISY_CC); + RETURN_CCTOR(&_3); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations) +static PHP_METHOD(Phalcon_Mvc_Model, invokeFinder) { + zend_class_entry *_15; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts_param = NULL, left, right, _0$$3, _1$$3, _2$$4, _3$$4; - zval expression, bindCounts; + zval arguments, _11$$14; + zval *method_param = NULL, *arguments_param = NULL, extraMethod, type, modelName, value, model, attributes, field, extraMethodFirst, metaData, params, _14, _0$$3, _1$$4, _2$$5, _3$$7, _4$$7, _5$$7, _6$$13, _7$$13, _8$$13, _9$$14, _10$$14, _12$$15, _13$$15; + zval method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&extraMethod); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&extraMethodFirst); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_14); ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$7); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_6$$13); + ZVAL_UNDEF(&_7$$13); + ZVAL_UNDEF(&_8$$13); + ZVAL_UNDEF(&_9$$14); + ZVAL_UNDEF(&_10$$14); + ZVAL_UNDEF(&_12$$15); + ZVAL_UNDEF(&_13$$15); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_11$$14); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ARRAY(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(method) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts_param); - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 2, 0, &method_param, &arguments_param); + zephir_get_strval(&method, method_param); + zephir_get_arrval(&arguments, arguments_param); - ZEPHIR_OBS_VAR(&left); - if (zephir_array_isset_string_fetch(&left, &expression, SL("left"), 0)) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getsqlexpression", NULL, 0, &left, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&extraMethod); + ZVAL_NULL(&extraMethod); + if (zephir_start_with_str(&method, SL("findFirstBy"))) { + ZEPHIR_INIT_VAR(&type); + ZVAL_STRING(&type, "findFirst"); + ZVAL_LONG(&_0$$3, 11); + ZEPHIR_INIT_NVAR(&extraMethod); + zephir_substr(&extraMethod, &method, 11 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + } else if (zephir_start_with_str(&method, SL("findBy"))) { + ZEPHIR_INIT_NVAR(&type); + ZVAL_STRING(&type, "find"); + ZVAL_LONG(&_1$$4, 6); + ZEPHIR_INIT_NVAR(&extraMethod); + zephir_substr(&extraMethod, &method, 6 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + } else if (zephir_start_with_str(&method, SL("countBy"))) { + ZEPHIR_INIT_NVAR(&type); + ZVAL_STRING(&type, "count"); + ZVAL_LONG(&_2$$5, 7); + ZEPHIR_INIT_NVAR(&extraMethod); + zephir_substr(&extraMethod, &method, 7 , 0, ZEPHIR_SUBSTR_NO_LENGTH); + } + ZEPHIR_INIT_VAR(&modelName); + zephir_get_called_class(&modelName); + if (!(zephir_is_true(&extraMethod))) { + RETURN_MM_BOOL(0); + } + if (UNEXPECTED(!(zephir_array_isset_long(&arguments, 0)))) { + ZEPHIR_INIT_VAR(&_3$$7); + object_init_ex(&_3$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_4$$7); + zephir_get_called_class(&_4$$7); + ZEPHIR_INIT_VAR(&_5$$7); + ZEPHIR_CONCAT_SVSVS(&_5$$7, "The static method '", &method, "' in '", &_4$$7, "' requires one argument"); + ZEPHIR_CALL_METHOD(NULL, &_3$$7, "__construct", NULL, 32, &_5$$7); zephir_check_call_status(); - zephir_array_fetch_string(&_1$$3, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1138); - ZEPHIR_CONCAT_VSV(return_value, &_0$$3, " ", &_1$$3); - RETURN_MM(); + zephir_throw_exception_debug(&_3$$7, "phalcon/Mvc/Model.zep", 4609); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_OBS_VAR(&right); - if (zephir_array_isset_string_fetch(&right, &expression, SL("right"), 0)) { - zephir_array_fetch_string(&_2$$4, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1145); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "getsqlexpression", NULL, 46, &right, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&model); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&model, &modelName); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&metaData, &model, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&attributes, &metaData, "getreversecolumnmap", NULL, 0, &model); + zephir_check_call_status(); + if (Z_TYPE_P(&attributes) != IS_ARRAY) { + ZEPHIR_CALL_METHOD(&attributes, &metaData, "getdatatypes", NULL, 0, &model); zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, &_2$$4, " ", &_3$$4); - RETURN_MM(); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-unary expression", "phalcon/Db/Dialect.zep", 1148); - return; + if (zephir_array_isset(&attributes, &extraMethod)) { + ZEPHIR_CPY_WRT(&field, &extraMethod); + } else { + ZEPHIR_CALL_FUNCTION(&extraMethodFirst, "lcfirst", NULL, 76, &extraMethod); + zephir_check_call_status(); + if (zephir_array_isset(&attributes, &extraMethodFirst)) { + ZEPHIR_CPY_WRT(&field, &extraMethodFirst); + } else { + ZEPHIR_INIT_NVAR(&field); + zephir_uncamelize(&field, &extraMethod, NULL ); + if (UNEXPECTED(!(zephir_array_isset(&attributes, &field)))) { + ZEPHIR_INIT_VAR(&_6$$13); + object_init_ex(&_6$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_VAR(&_7$$13); + zephir_get_called_class(&_7$$13); + ZEPHIR_INIT_VAR(&_8$$13); + ZEPHIR_CONCAT_SVSVS(&_8$$13, "Cannot resolve attribute '", &extraMethod, "' in the model '", &_7$$13, "'"); + ZEPHIR_CALL_METHOD(NULL, &_6$$13, "__construct", NULL, 32, &_8$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$13, "phalcon/Mvc/Model.zep", 4646); + ZEPHIR_MM_RESTORE(); + return; + } + } + } + ZEPHIR_OBS_VAR(&value); + zephir_array_isset_long_fetch(&value, &arguments, 0, 0); + ZEPHIR_INIT_VAR(¶ms); + if (Z_TYPE_P(&value) != IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$14); + zephir_create_array(&_9$$14, 2, 0); + ZEPHIR_INIT_VAR(&_10$$14); + ZEPHIR_CONCAT_SVS(&_10$$14, "[", &field, "] = ?0"); + zephir_array_update_string(&_9$$14, SL("conditions"), &_10$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&_11$$14); + zephir_create_array(&_11$$14, 1, 0); + zephir_array_fast_append(&_11$$14, &value); + zephir_array_update_string(&_9$$14, SL("bind"), &_11$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(¶ms, &_9$$14); + } else { + ZEPHIR_INIT_VAR(&_12$$15); + zephir_create_array(&_12$$15, 1, 0); + ZEPHIR_INIT_VAR(&_13$$15); + ZEPHIR_CONCAT_SVS(&_13$$15, "[", &field, "] IS NULL"); + zephir_array_update_string(&_12$$15, SL("conditions"), &_13$$15, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(¶ms, &_12$$15); + } + zephir_array_unset_long(&arguments, 0, PH_SEPARATE); + zephir_array_unset_string(&arguments, SL("conditions"), PH_SEPARATE); + zephir_array_unset_string(&arguments, SL("bind"), PH_SEPARATE); + ZEPHIR_INIT_VAR(&_14); + zephir_fast_array_merge(&_14, ¶ms, &arguments); + ZEPHIR_CPY_WRT(¶ms, &_14); + _15 = zephir_fetch_class(&modelName); + ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(_15, type, NULL, 0, ¶ms); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionWhere) +static PHP_METHOD(Phalcon_Mvc_Model, possibleSetter) { + zval localMethods; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindCounts; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts_param = NULL, whereSql; + zval *property_param = NULL, *value, value_sub, possibleSetter, _0; + zval property; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&whereSql); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&bindCounts); + ZVAL_UNDEF(&property); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&possibleSetter); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&localMethods); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(expression) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(escapeChar) - Z_PARAM_ARRAY(bindCounts) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(property) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts_param) { - ZEPHIR_INIT_VAR(&bindCounts); - array_init(&bindCounts); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindCounts, bindCounts_param); - } + zephir_fetch_params(1, 2, 0, &property_param, &value); + zephir_get_strval(&property, property_param); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&whereSql, this_ptr, "getsqlexpression", NULL, 0, expression, &escapeChar, &bindCounts); + ZEPHIR_INIT_VAR(&localMethods); + zephir_create_array(&localMethods, 10, 0); + add_assoc_long_ex(&localMethods, SL("setConnectionService"), 1); + add_assoc_long_ex(&localMethods, SL("setDirtyState"), 1); + add_assoc_long_ex(&localMethods, SL("setEventsManager"), 1); + add_assoc_long_ex(&localMethods, SL("setReadConnectionService"), 1); + add_assoc_long_ex(&localMethods, SL("setOldSnapshotData"), 1); + add_assoc_long_ex(&localMethods, SL("setSchema"), 1); + add_assoc_long_ex(&localMethods, SL("setSnapshotData"), 1); + add_assoc_long_ex(&localMethods, SL("setSource"), 1); + add_assoc_long_ex(&localMethods, SL("setTransaction"), 1); + add_assoc_long_ex(&localMethods, SL("setWriteConnectionService"), 1); + ZEPHIR_INIT_VAR(&_0); + zephir_camelize(&_0, &property, NULL ); + ZEPHIR_INIT_VAR(&possibleSetter); + ZEPHIR_CONCAT_SV(&possibleSetter, "set", &_0); + if (!((zephir_method_exists(this_ptr, &possibleSetter) == SUCCESS))) { + RETURN_MM_BOOL(0); + } + if (!(zephir_array_isset(&localMethods, &possibleSetter))) { + ZEPHIR_CALL_METHOD_ZVAL(NULL, this_ptr, &possibleSetter, NULL, 0, value); zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&whereSql, expression); } - ZEPHIR_CONCAT_SV(return_value, "WHERE ", &whereSql); - RETURN_MM(); + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias) +static PHP_METHOD(Phalcon_Mvc_Model, preSave) { + zval _16$$32, _29$$52; + zval eventName; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_9 = NULL, *_19 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *qualified_param = NULL, *alias_param = NULL, *escapeChar_param = NULL, _0$$3; - zval qualified, alias, escapeChar; + zend_bool exists, error = 0, isNull = 0, _10$$27, _11$$27, _12$$27, _23$$47, _24$$47, _25$$47; + zval *metaData, metaData_sub, *exists_param = NULL, *identityField, identityField_sub, __$true, __$false, notNull, columnMap, dataTypeNumeric, automaticAttributes, defaultValues, field, attributeField, value, emptyStringValues, _33, _34, _0$$3, _1$$3, _2$$3, _3$$8, *_4$$11, _5$$11, _6$$19, _7$$19, _8$$19, _13$$27, _14$$32, _15$$32, _17$$32, _18$$32, _20$$39, _21$$39, _22$$39, _26$$47, _27$$52, _28$$52, _30$$52, _31$$52, _32$$57, _35$$59, _36$$60, _37$$60, _38$$60, _39$$60, _40$$60, _41$$60; zval *this_ptr = getThis(); - ZVAL_UNDEF(&qualified); - ZVAL_UNDEF(&alias); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&metaData_sub); + ZVAL_UNDEF(&identityField_sub); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(¬Null); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&dataTypeNumeric); + ZVAL_UNDEF(&automaticAttributes); + ZVAL_UNDEF(&defaultValues); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&attributeField); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&emptyStringValues); + ZVAL_UNDEF(&_33); + ZVAL_UNDEF(&_34); ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$8); + ZVAL_UNDEF(&_5$$11); + ZVAL_UNDEF(&_6$$19); + ZVAL_UNDEF(&_7$$19); + ZVAL_UNDEF(&_8$$19); + ZVAL_UNDEF(&_13$$27); + ZVAL_UNDEF(&_14$$32); + ZVAL_UNDEF(&_15$$32); + ZVAL_UNDEF(&_17$$32); + ZVAL_UNDEF(&_18$$32); + ZVAL_UNDEF(&_20$$39); + ZVAL_UNDEF(&_21$$39); + ZVAL_UNDEF(&_22$$39); + ZVAL_UNDEF(&_26$$47); + ZVAL_UNDEF(&_27$$52); + ZVAL_UNDEF(&_28$$52); + ZVAL_UNDEF(&_30$$52); + ZVAL_UNDEF(&_31$$52); + ZVAL_UNDEF(&_32$$57); + ZVAL_UNDEF(&_35$$59); + ZVAL_UNDEF(&_36$$60); + ZVAL_UNDEF(&_37$$60); + ZVAL_UNDEF(&_38$$60); + ZVAL_UNDEF(&_39$$60); + ZVAL_UNDEF(&_40$$60); + ZVAL_UNDEF(&_41$$60); + ZVAL_UNDEF(&eventName); + ZVAL_UNDEF(&_16$$32); + ZVAL_UNDEF(&_29$$52); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(qualified) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(alias) - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_OBJECT_OF_CLASS(metaData, phalcon_mvc_model_metadatainterface_ce) + Z_PARAM_BOOL(exists) + Z_PARAM_ZVAL(identityField) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &qualified_param, &alias_param, &escapeChar_param); - if (UNEXPECTED(Z_TYPE_P(qualified_param) != IS_STRING && Z_TYPE_P(qualified_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'qualified' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 3, 0, &metaData, &exists_param, &identityField); + exists = zephir_get_boolval(exists_param); + + + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "beforeValidation"); + ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "fireeventcancel", NULL, 0, &_1$$3); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_0$$3)) { + RETURN_MM_BOOL(0); + } + if (exists) { + ZEPHIR_INIT_VAR(&eventName); + ZVAL_STRING(&eventName, "beforeValidationOnUpdate"); + } else { + ZEPHIR_INIT_NVAR(&eventName); + ZVAL_STRING(&eventName, "beforeValidationOnCreate"); + } + ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "fireeventcancel", NULL, 0, &eventName); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_2$$3)) { + RETURN_MM_BOOL(0); + } } - if (EXPECTED(Z_TYPE_P(qualified_param) == IS_STRING)) { - zephir_get_strval(&qualified, qualified_param); - } else { - ZEPHIR_INIT_VAR(&qualified); + if (ZEPHIR_GLOBAL(orm).virtual_foreign_keys) { + ZEPHIR_CALL_METHOD(&_3$$8, this_ptr, "checkforeignkeysrestrict", NULL, 435); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_3$$8)) { + RETURN_MM_BOOL(0); + } } - if (!alias_param) { - ZEPHIR_INIT_VAR(&alias); - } else { - zephir_get_strval(&alias, alias_param); + if (ZEPHIR_GLOBAL(orm).not_null_validations) { + ZEPHIR_CALL_METHOD(¬Null, metaData, "getnotnullattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + if (Z_TYPE_P(¬Null) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&dataTypeNumeric, metaData, "getdatatypesnumeric", NULL, 0, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_GLOBAL(orm).column_renaming) { + ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&columnMap); + ZVAL_NULL(&columnMap); + } + if (exists) { + ZEPHIR_CALL_METHOD(&automaticAttributes, metaData, "getautomaticupdateattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_METHOD(&automaticAttributes, metaData, "getautomaticcreateattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&defaultValues, metaData, "getdefaultvalues", NULL, 0, this_ptr); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&emptyStringValues, metaData, "getemptystringattributes", NULL, 0, this_ptr); + zephir_check_call_status(); + error = 0; + zephir_is_iterable(¬Null, 0, "phalcon/Mvc/Model.zep", 4887); + if (Z_TYPE_P(¬Null) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(¬Null), _4$$11) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _4$$11); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_6$$19); + object_init_ex(&_6$$19, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_7$$19); + zephir_get_class(&_7$$19, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_8$$19); + ZEPHIR_CONCAT_SVSVS(&_8$$19, "Column '", &field, "' in '", &_7$$19, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_6$$19, "__construct", &_9, 32, &_8$$19); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$19, "phalcon/Mvc/Model.zep", 4807); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + isNull = 0; + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + if (Z_TYPE_P(&value) != IS_OBJECT) { + if (!(zephir_array_isset(&dataTypeNumeric, &field))) { + if (zephir_array_isset(&emptyStringValues, &field)) { + if (Z_TYPE_P(&value) == IS_NULL) { + isNull = 1; + } + } else { + _10$$27 = Z_TYPE_P(&value) == IS_NULL; + if (!(_10$$27)) { + _11$$27 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + if (_11$$27) { + _12$$27 = !(zephir_array_isset(&defaultValues, &field)); + if (!(_12$$27)) { + zephir_array_fetch(&_13$$27, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4837); + _12$$27 = !ZEPHIR_IS_IDENTICAL(&value, &_13$$27); + } + _11$$27 = _12$$27; + } + _10$$27 = _11$$27; + } + if (_10$$27) { + isNull = 1; + } + } + } else { + if (!(zephir_is_numeric(&value))) { + isNull = 1; + } + } + } + } else { + isNull = 1; + } + if (isNull) { + if (!(exists)) { + if (ZEPHIR_IS_EQUAL(&field, identityField)) { + continue; + } + if (zephir_array_isset(&defaultValues, &field)) { + continue; + } + } + ZEPHIR_INIT_NVAR(&_14$$32); + object_init_ex(&_14$$32, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_15$$32); + ZEPHIR_CONCAT_VS(&_15$$32, &attributeField, " is required"); + ZEPHIR_INIT_NVAR(&_16$$32); + zephir_create_array(&_16$$32, 1, 0); + ZEPHIR_INIT_NVAR(&_17$$32); + zephir_get_class(&_17$$32, this_ptr, 0); + zephir_array_update_string(&_16$$32, SL("model"), &_17$$32, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_17$$32); + ZVAL_STRING(&_17$$32, "PresenceOf"); + ZVAL_LONG(&_18$$32, 0); + ZEPHIR_CALL_METHOD(NULL, &_14$$32, "__construct", &_19, 6, &_15$$32, &attributeField, &_17$$32, &_18$$32, &_16$$32); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_14$$32); + error = 1; + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, ¬Null, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_5$$11, ¬Null, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_5$$11)) { + break; + } + ZEPHIR_CALL_METHOD(&field, ¬Null, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&columnMap) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&attributeField); + if (UNEXPECTED(!(zephir_array_isset_fetch(&attributeField, &columnMap, &field, 0)))) { + if (UNEXPECTED(!(ZEPHIR_GLOBAL(orm).ignore_unknown_columns))) { + ZEPHIR_INIT_NVAR(&_20$$39); + object_init_ex(&_20$$39, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$39); + zephir_get_class(&_21$$39, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_22$$39); + ZEPHIR_CONCAT_SVSVS(&_22$$39, "Column '", &field, "' in '", &_21$$39, "' isn't part of the column map"); + ZEPHIR_CALL_METHOD(NULL, &_20$$39, "__construct", &_9, 32, &_22$$39); + zephir_check_call_status(); + zephir_throw_exception_debug(&_20$$39, "phalcon/Mvc/Model.zep", 4807); + ZEPHIR_MM_RESTORE(); + return; + } + } + } else { + ZEPHIR_CPY_WRT(&attributeField, &field); + } + if (!(zephir_array_isset(&automaticAttributes, &attributeField))) { + isNull = 0; + ZEPHIR_OBS_NVAR(&value); + if (zephir_fetch_property_zval(&value, this_ptr, &attributeField, PH_SILENT_CC)) { + if (Z_TYPE_P(&value) != IS_OBJECT) { + if (!(zephir_array_isset(&dataTypeNumeric, &field))) { + if (zephir_array_isset(&emptyStringValues, &field)) { + if (Z_TYPE_P(&value) == IS_NULL) { + isNull = 1; + } + } else { + _23$$47 = Z_TYPE_P(&value) == IS_NULL; + if (!(_23$$47)) { + _24$$47 = ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + if (_24$$47) { + _25$$47 = !(zephir_array_isset(&defaultValues, &field)); + if (!(_25$$47)) { + zephir_array_fetch(&_26$$47, &defaultValues, &field, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model.zep", 4837); + _25$$47 = !ZEPHIR_IS_IDENTICAL(&value, &_26$$47); + } + _24$$47 = _25$$47; + } + _23$$47 = _24$$47; + } + if (_23$$47) { + isNull = 1; + } + } + } else { + if (!(zephir_is_numeric(&value))) { + isNull = 1; + } + } + } + } else { + isNull = 1; + } + if (isNull) { + if (!(exists)) { + if (ZEPHIR_IS_EQUAL(&field, identityField)) { + continue; + } + if (zephir_array_isset(&defaultValues, &field)) { + continue; + } + } + ZEPHIR_INIT_NVAR(&_27$$52); + object_init_ex(&_27$$52, phalcon_messages_message_ce); + ZEPHIR_INIT_NVAR(&_28$$52); + ZEPHIR_CONCAT_VS(&_28$$52, &attributeField, " is required"); + ZEPHIR_INIT_NVAR(&_29$$52); + zephir_create_array(&_29$$52, 1, 0); + ZEPHIR_INIT_NVAR(&_30$$52); + zephir_get_class(&_30$$52, this_ptr, 0); + zephir_array_update_string(&_29$$52, SL("model"), &_30$$52, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_30$$52); + ZVAL_STRING(&_30$$52, "PresenceOf"); + ZVAL_LONG(&_31$$52, 0); + ZEPHIR_CALL_METHOD(NULL, &_27$$52, "__construct", &_19, 6, &_28$$52, &attributeField, &_30$$52, &_31$$52, &_29$$52); + zephir_check_call_status(); + zephir_update_property_array_append(this_ptr, SL("errorMessages"), &_27$$52); + error = 1; + } + } + ZEPHIR_CALL_METHOD(NULL, ¬Null, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); + if (error) { + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_INIT_VAR(&_32$$57); + ZVAL_STRING(&_32$$57, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_32$$57); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "canceloperation", NULL, 0); + zephir_check_call_status(); + } + RETURN_MM_BOOL(0); + } + } } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); + ZEPHIR_INIT_VAR(&_34); + ZVAL_STRING(&_34, "validation"); + ZEPHIR_CALL_METHOD(&_33, this_ptr, "fireeventcancel", NULL, 0, &_34); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_33)) { + if (ZEPHIR_GLOBAL(orm).events) { + ZEPHIR_INIT_VAR(&_35$$59); + ZVAL_STRING(&_35$$59, "onValidationFails"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_35$$59); + zephir_check_call_status(); + } + RETURN_MM_BOOL(0); } - - - if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "escape", NULL, 53, &alias, &escapeChar); + if (ZEPHIR_GLOBAL(orm).events) { + if (exists) { + ZEPHIR_INIT_NVAR(&eventName); + ZVAL_STRING(&eventName, "afterValidationOnUpdate"); + } else { + ZEPHIR_INIT_NVAR(&eventName); + ZVAL_STRING(&eventName, "afterValidationOnCreate"); + } + ZEPHIR_CALL_METHOD(&_36$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, &qualified, " AS ", &_0$$3); - RETURN_MM(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_36$$60)) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_VAR(&_38$$60); + ZVAL_STRING(&_38$$60, "afterValidation"); + ZEPHIR_CALL_METHOD(&_37$$60, this_ptr, "fireeventcancel", NULL, 0, &_38$$60); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_37$$60)) { + RETURN_MM_BOOL(0); + } + ZEPHIR_INIT_NVAR(&_38$$60); + ZVAL_STRING(&_38$$60, "beforeSave"); + ZEPHIR_CALL_METHOD(&_39$$60, this_ptr, "fireeventcancel", NULL, 0, &_38$$60); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_39$$60)) { + RETURN_MM_BOOL(0); + } + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("skipped"), &__$false); + } + if (exists) { + ZEPHIR_INIT_NVAR(&eventName); + ZVAL_STRING(&eventName, "beforeUpdate"); + } else { + ZEPHIR_INIT_NVAR(&eventName); + ZVAL_STRING(&eventName, "beforeCreate"); + } + ZEPHIR_CALL_METHOD(&_40$$60, this_ptr, "fireeventcancel", NULL, 0, &eventName); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_40$$60)) { + RETURN_MM_BOOL(0); + } + zephir_read_property(&_41$$60, this_ptr, ZEND_STRL("skipped"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_TRUE_IDENTICAL(&_41$$60)) { + RETURN_MM_BOOL(1); + } } - RETURN_CTOR(&qualified); + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, prepareTable) +static PHP_METHOD(Phalcon_Mvc_Model, preSaveRelatedRecords) { + zend_string *_5; + zend_ulong _4; + zend_bool nesting = 0, _20$$5, _39$$11; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL, *_13 = NULL, *_15 = NULL, *_22 = NULL, *_24 = NULL, *_27 = NULL, *_29 = NULL, *_34 = NULL, *_42 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, *alias_param = NULL, *escapeChar_param = NULL, _0, _1$$3, _2$$3, _3$$4, _4$$4; - zval table, schema, alias, escapeChar; + zval *connection, connection_sub, *related, related_sub, className, manager, type, relation, columns, referencedFields, name, record, _0, _1, *_2, _3, _6$$3, _8$$6, _10$$6, _11$$6, _12$$6, _14$$7, _16$$7, _17$$7, _18$$7, _19$$5, _21$$5, _25$$5, _23$$8, _26$$9, _28$$12, _30$$12, _31$$12, _32$$12, _33$$13, _35$$13, _36$$13, _37$$13, _38$$11, _40$$11, _43$$11, _41$$14; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&alias); - ZVAL_UNDEF(&escapeChar); + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&related_sub); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&referencedFields); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&record); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_8$$6); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$7); + ZVAL_UNDEF(&_16$$7); + ZVAL_UNDEF(&_17$$7); + ZVAL_UNDEF(&_18$$7); + ZVAL_UNDEF(&_19$$5); + ZVAL_UNDEF(&_21$$5); + ZVAL_UNDEF(&_25$$5); + ZVAL_UNDEF(&_23$$8); + ZVAL_UNDEF(&_26$$9); + ZVAL_UNDEF(&_28$$12); + ZVAL_UNDEF(&_30$$12); + ZVAL_UNDEF(&_31$$12); + ZVAL_UNDEF(&_32$$12); + ZVAL_UNDEF(&_33$$13); + ZVAL_UNDEF(&_35$$13); + ZVAL_UNDEF(&_36$$13); + ZVAL_UNDEF(&_37$$13); + ZVAL_UNDEF(&_38$$11); + ZVAL_UNDEF(&_40$$11); + ZVAL_UNDEF(&_43$$11); + ZVAL_UNDEF(&_41$$14); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - Z_PARAM_STR_OR_NULL(alias) - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) + Z_PARAM_ZVAL(related) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &table_param, &schema_param, &alias_param, &escapeChar_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } - if (!alias_param) { - ZEPHIR_INIT_VAR(&alias); - } else { - zephir_get_strval(&alias, alias_param); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } + zephir_fetch_params(1, 2, 0, &connection, &related); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 53, &table, &escapeChar); - zephir_check_call_status(); - zephir_get_strval(&table, &_0); - if (!ZEPHIR_IS_STRING(&schema, "")) { - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "escapeschema", NULL, 63, &schema, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_VSV(&_2$$3, &_1$$3, ".", &table); - zephir_get_strval(&table, &_2$$3); + nesting = 0; + if (nesting) { + ZVAL_BOOL(&_0, 1); + } else { + ZVAL_BOOL(&_0, 0); } - if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "escape", NULL, 53, &alias, &escapeChar); + ZEPHIR_CALL_METHOD(NULL, connection, "begin", NULL, 0, &_0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&className); + zephir_get_class(&className, this_ptr, 0); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5050); + if (Z_TYPE_P(related) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(related), _4, _5, _2) + { + ZEPHIR_INIT_NVAR(&name); + if (_5 != NULL) { + ZVAL_STR_COPY(&name, _5); + } else { + ZVAL_LONG(&name, _4); + } + ZEPHIR_INIT_NVAR(&record); + ZVAL_COPY(&record, _2); + ZEPHIR_CALL_METHOD(&_6$$3, &manager, "getrelationbyalias", &_7, 0, &className, &name); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_6$$3); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&type, &relation, "gettype", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&type, 0)) { + if (UNEXPECTED(Z_TYPE_P(&record) != IS_OBJECT)) { + if (nesting) { + ZVAL_BOOL(&_8$$6, 1); + } else { + ZVAL_BOOL(&_8$$6, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_9, 0, &_8$$6); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_10$$6); + object_init_ex(&_10$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$6); + zephir_get_class(&_11$$6, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_12$$6); + ZEPHIR_CONCAT_SVSV(&_12$$6, "Only objects can be stored as part of belongs-to relations in '", &_11$$6, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_10$$6, "__construct", &_13, 32, &_12$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_10$$6, "phalcon/Mvc/Model.zep", 5007); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_14$$7, 1); + } else { + ZVAL_BOOL(&_14$$7, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_15, 0, &_14$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_16$$7); + object_init_ex(&_16$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$7); + zephir_get_class(&_17$$7, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_18$$7); + ZEPHIR_CONCAT_SVSV(&_18$$7, "Not implemented in '", &_17$$7, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_16$$7, "__construct", &_13, 32, &_18$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_16$$7, "phalcon/Mvc/Model.zep", 5019); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_read_property(&_19$$5, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + _20$$5 = !ZEPHIR_IS_LONG_IDENTICAL(&_19$$5, 0); + if (_20$$5) { + ZEPHIR_CALL_METHOD(&_21$$5, &record, "save", NULL, 0); + zephir_check_call_status(); + _20$$5 = !zephir_is_true(&_21$$5); + } + if (_20$$5) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_22, 0, &record); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_23$$8, 1); + } else { + ZVAL_BOOL(&_23$$8, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_24, 0, &_23$$8); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_25$$5, &record, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &columns, &_25$$5); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, related, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4$$4); - ZEPHIR_CONCAT_VSV(&_4$$4, &table, " AS ", &_3$$4); - zephir_get_strval(&table, &_4$$4); + while (1) { + ZEPHIR_CALL_METHOD(&_3, related, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&name, related, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&record, related, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_26$$9, &manager, "getrelationbyalias", &_27, 0, &className, &name); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_26$$9); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&type, &relation, "gettype", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&type, 0)) { + if (UNEXPECTED(Z_TYPE_P(&record) != IS_OBJECT)) { + if (nesting) { + ZVAL_BOOL(&_28$$12, 1); + } else { + ZVAL_BOOL(&_28$$12, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_29, 0, &_28$$12); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_30$$12); + object_init_ex(&_30$$12, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_31$$12); + zephir_get_class(&_31$$12, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_32$$12); + ZEPHIR_CONCAT_SVSV(&_32$$12, "Only objects can be stored as part of belongs-to relations in '", &_31$$12, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_30$$12, "__construct", &_13, 32, &_32$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(&_30$$12, "phalcon/Mvc/Model.zep", 5007); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_33$$13, 1); + } else { + ZVAL_BOOL(&_33$$13, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_34, 0, &_33$$13); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_35$$13); + object_init_ex(&_35$$13, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_36$$13); + zephir_get_class(&_36$$13, this_ptr, 0); + ZEPHIR_INIT_NVAR(&_37$$13); + ZEPHIR_CONCAT_SVSV(&_37$$13, "Not implemented in '", &_36$$13, "' Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_35$$13, "__construct", &_13, 32, &_37$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(&_35$$13, "phalcon/Mvc/Model.zep", 5019); + ZEPHIR_MM_RESTORE(); + return; + } + zephir_read_property(&_38$$11, &record, ZEND_STRL("dirtyState"), PH_NOISY_CC | PH_READONLY); + _39$$11 = !ZEPHIR_IS_LONG_IDENTICAL(&_38$$11, 0); + if (_39$$11) { + ZEPHIR_CALL_METHOD(&_40$$11, &record, "save", NULL, 0); + zephir_check_call_status(); + _39$$11 = !zephir_is_true(&_40$$11); + } + if (_39$$11) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_22, 0, &record); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_41$$14, 1); + } else { + ZVAL_BOOL(&_41$$14, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_42, 0, &_41$$14); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_43$$11, &record, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &columns, &_43$$11); + } + } + ZEPHIR_CALL_METHOD(NULL, related, "next", NULL, 0); + zephir_check_call_status(); + } } - RETURN_CTOR(&table); + ZEPHIR_INIT_NVAR(&record); + ZEPHIR_INIT_NVAR(&name); + RETURN_MM_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect, prepareQualified) +static PHP_METHOD(Phalcon_Mvc_Model, postSave) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *domain_param = NULL, *escapeChar_param = NULL; - zval column, domain, escapeChar, _0$$3; + zval *success_param = NULL, *exists_param = NULL, _0$$4, _1$$5; + zend_bool success, exists; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_1$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(column) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(domain) - Z_PARAM_STR_OR_NULL(escapeChar) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_BOOL(success) + Z_PARAM_BOOL(exists) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column_param, &domain_param, &escapeChar_param); - if (UNEXPECTED(Z_TYPE_P(column_param) != IS_STRING && Z_TYPE_P(column_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'column' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(column_param) == IS_STRING)) { - zephir_get_strval(&column, column_param); - } else { - ZEPHIR_INIT_VAR(&column); - } - if (!domain_param) { - ZEPHIR_INIT_VAR(&domain); - } else { - zephir_get_strval(&domain, domain_param); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } + zephir_fetch_params(1, 2, 0, &success_param, &exists_param); + success = zephir_get_boolval(success_param); + exists = zephir_get_boolval(exists_param); - if (!ZEPHIR_IS_STRING(&domain, "")) { - ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_CONCAT_VSV(&_0$$3, &domain, ".", &column); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, &_0$$3, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); + if (success) { + if (exists) { + ZEPHIR_INIT_VAR(&_0$$4); + ZVAL_STRING(&_0$$4, "afterUpdate"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_0$$4); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(&_1$$5); + ZVAL_STRING(&_1$$5, "afterCreate"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_1$$5); + zephir_check_call_status(); + } } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 53, &column, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MM_BOOL(success); } -zend_object *zephir_init_properties_Phalcon_Db_Dialect(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Mvc_Model, postSaveRelatedRecords) { - zval _0, _1$$3; + zval _32$$14, _34$$14, _44$$19, _46$$19, _88$$40, _90$$40, _100$$45, _102$$45; + zend_string *_4; + zend_ulong _3; + zend_bool nesting = 0, isThrough = 0, _8$$4, _65$$30; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("customFunctions"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("customFunctions"), &_1$$3); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } -} - - - + zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL, *_13 = NULL, *_15 = NULL, *_19 = NULL, *_26 = NULL, *_28 = NULL, *_30 = NULL, *_31 = NULL, *_37 = NULL, *_40 = NULL, *_42 = NULL, *_43 = NULL, *_49 = NULL, *_54 = NULL, *_57 = NULL, *_59 = NULL, *_63 = NULL, *_67 = NULL, *_71 = NULL, *_76 = NULL, *_84 = NULL, *_86 = NULL, *_87 = NULL, *_93 = NULL, *_96 = NULL, *_98 = NULL, *_99 = NULL, *_105 = NULL, *_110 = NULL, *_113 = NULL, *_115 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *connection, connection_sub, *related, related_sub, className, manager, relation, name, record, columns, referencedModel, referencedFields, relatedRecords, value, recordAfter, intermediateModel, intermediateFields, intermediateValue, intermediateModelName, intermediateReferencedFields, existingIntermediateModel, _0, *_1, _2, _118, _5$$3, _7$$4, _22$$4, _9$$6, _11$$6, _12$$6, _14$$7, _16$$7, _17$$7, _18$$10, _20$$10, _21$$10, *_23$$11, _24$$11, _25$$12, _29$$12, _35$$12, _27$$13, _33$$14, _36$$16, _38$$17, _41$$17, _47$$17, _39$$18, _45$$19, _48$$21, *_50$$22, _51$$22, _52$$23, _53$$24, _55$$25, _56$$26, _58$$28, _60$$28, _61$$28, _62$$29, _64$$30, _79$$30, _66$$32, _68$$32, _69$$32, _70$$33, _72$$33, _73$$33, _74$$34, _75$$36, _77$$36, _78$$36, *_80$$37, _81$$37, _82$$38, _85$$38, _91$$38, _83$$39, _89$$40, _92$$42, _94$$43, _97$$43, _103$$43, _95$$44, _101$$45, _104$$47, *_106$$48, _107$$48, _108$$49, _109$$50, _111$$51, _112$$52, _114$$54, _116$$54, _117$$54; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&connection_sub); + ZVAL_UNDEF(&related_sub); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&record); + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&referencedFields); + ZVAL_UNDEF(&relatedRecords); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&recordAfter); + ZVAL_UNDEF(&intermediateModel); + ZVAL_UNDEF(&intermediateFields); + ZVAL_UNDEF(&intermediateValue); + ZVAL_UNDEF(&intermediateModelName); + ZVAL_UNDEF(&intermediateReferencedFields); + ZVAL_UNDEF(&existingIntermediateModel); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_118); + ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_22$$4); + ZVAL_UNDEF(&_9$$6); + ZVAL_UNDEF(&_11$$6); + ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&_14$$7); + ZVAL_UNDEF(&_16$$7); + ZVAL_UNDEF(&_17$$7); + ZVAL_UNDEF(&_18$$10); + ZVAL_UNDEF(&_20$$10); + ZVAL_UNDEF(&_21$$10); + ZVAL_UNDEF(&_24$$11); + ZVAL_UNDEF(&_25$$12); + ZVAL_UNDEF(&_29$$12); + ZVAL_UNDEF(&_35$$12); + ZVAL_UNDEF(&_27$$13); + ZVAL_UNDEF(&_33$$14); + ZVAL_UNDEF(&_36$$16); + ZVAL_UNDEF(&_38$$17); + ZVAL_UNDEF(&_41$$17); + ZVAL_UNDEF(&_47$$17); + ZVAL_UNDEF(&_39$$18); + ZVAL_UNDEF(&_45$$19); + ZVAL_UNDEF(&_48$$21); + ZVAL_UNDEF(&_51$$22); + ZVAL_UNDEF(&_52$$23); + ZVAL_UNDEF(&_53$$24); + ZVAL_UNDEF(&_55$$25); + ZVAL_UNDEF(&_56$$26); + ZVAL_UNDEF(&_58$$28); + ZVAL_UNDEF(&_60$$28); + ZVAL_UNDEF(&_61$$28); + ZVAL_UNDEF(&_62$$29); + ZVAL_UNDEF(&_64$$30); + ZVAL_UNDEF(&_79$$30); + ZVAL_UNDEF(&_66$$32); + ZVAL_UNDEF(&_68$$32); + ZVAL_UNDEF(&_69$$32); + ZVAL_UNDEF(&_70$$33); + ZVAL_UNDEF(&_72$$33); + ZVAL_UNDEF(&_73$$33); + ZVAL_UNDEF(&_74$$34); + ZVAL_UNDEF(&_75$$36); + ZVAL_UNDEF(&_77$$36); + ZVAL_UNDEF(&_78$$36); + ZVAL_UNDEF(&_81$$37); + ZVAL_UNDEF(&_82$$38); + ZVAL_UNDEF(&_85$$38); + ZVAL_UNDEF(&_91$$38); + ZVAL_UNDEF(&_83$$39); + ZVAL_UNDEF(&_89$$40); + ZVAL_UNDEF(&_92$$42); + ZVAL_UNDEF(&_94$$43); + ZVAL_UNDEF(&_97$$43); + ZVAL_UNDEF(&_103$$43); + ZVAL_UNDEF(&_95$$44); + ZVAL_UNDEF(&_101$$45); + ZVAL_UNDEF(&_104$$47); + ZVAL_UNDEF(&_107$$48); + ZVAL_UNDEF(&_108$$49); + ZVAL_UNDEF(&_109$$50); + ZVAL_UNDEF(&_111$$51); + ZVAL_UNDEF(&_112$$52); + ZVAL_UNDEF(&_114$$54); + ZVAL_UNDEF(&_116$$54); + ZVAL_UNDEF(&_117$$54); + ZVAL_UNDEF(&_32$$14); + ZVAL_UNDEF(&_34$$14); + ZVAL_UNDEF(&_44$$19); + ZVAL_UNDEF(&_46$$19); + ZVAL_UNDEF(&_88$$40); + ZVAL_UNDEF(&_90$$40); + ZVAL_UNDEF(&_100$$45); + ZVAL_UNDEF(&_102$$45); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) + Z_PARAM_ZVAL(related) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &connection, &related); - -ZEPHIR_INIT_CLASS(Phalcon_Db_DialectInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, DialectInterface, phalcon, db_dialectinterface, phalcon_db_dialectinterface_method_entry); - - return SUCCESS; + nesting = 0; + ZEPHIR_INIT_VAR(&className); + zephir_get_class(&className, this_ptr, 0); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmodelsmanager", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_0); + zephir_is_iterable(related, 0, "phalcon/Mvc/Model.zep", 5277); + if (Z_TYPE_P(related) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(related), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&name); + if (_4 != NULL) { + ZVAL_STR_COPY(&name, _4); + } else { + ZVAL_LONG(&name, _3); + } + ZEPHIR_INIT_NVAR(&record); + ZVAL_COPY(&record, _1); + ZEPHIR_CALL_METHOD(&_5$$3, &manager, "getrelationbyalias", &_6, 0, &className, &name); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_5$$3); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_7$$4, &relation, "gettype", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_7$$4, 0)) { + continue; + } + _8$$4 = Z_TYPE_P(&record) != IS_OBJECT; + if (_8$$4) { + _8$$4 = Z_TYPE_P(&record) != IS_ARRAY; + } + if (UNEXPECTED(_8$$4)) { + if (nesting) { + ZVAL_BOOL(&_9$$6, 1); + } else { + ZVAL_BOOL(&_9$$6, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_10, 0, &_9$$6); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_11$$6); + object_init_ex(&_11$$6, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$6); + ZEPHIR_CONCAT_SVSV(&_12$$6, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations on model ", &className, " on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_11$$6, "__construct", &_13, 32, &_12$$6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$6, "phalcon/Mvc/Model.zep", 5112); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedModel, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_14$$7, 1); + } else { + ZVAL_BOOL(&_14$$7, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_15, 0, &_14$$7); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_16$$7); + object_init_ex(&_16$$7, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_17$$7); + ZEPHIR_CONCAT_SVSV(&_17$$7, "Not implemented in '", &className, "' on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_16$$7, "__construct", &_13, 32, &_17$$7); + zephir_check_call_status(); + zephir_throw_exception_debug(&_16$$7, "phalcon/Mvc/Model.zep", 5122); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(&record) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&relatedRecords); + zephir_create_array(&relatedRecords, 1, 0); + zephir_array_fast_append(&relatedRecords, &record); + } else { + ZEPHIR_CPY_WRT(&relatedRecords, &record); + } + ZEPHIR_OBS_NVAR(&value); + if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &columns, PH_SILENT_CC)))) { + if (nesting) { + ZVAL_BOOL(&_18$$10, 1); + } else { + ZVAL_BOOL(&_18$$10, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_19, 0, &_18$$10); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_20$$10); + object_init_ex(&_20$$10, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$10); + ZEPHIR_CONCAT_SVSVS(&_21$$10, "The column '", &columns, "' needs to be present in the model '", &className, "'"); + ZEPHIR_CALL_METHOD(NULL, &_20$$10, "__construct", &_13, 32, &_21$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(&_20$$10, "phalcon/Mvc/Model.zep", 5139); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&_22$$4, &relation, "isthrough", NULL, 0); + zephir_check_call_status(); + isThrough = zephir_get_boolval(&_22$$4); + if (isThrough) { + ZEPHIR_CALL_METHOD(&intermediateModelName, &relation, "getintermediatemodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateFields, &relation, "getintermediatefields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateReferencedFields, &relation, "getintermediatereferencedfields", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5238); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _23$$11) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _23$$11); + ZEPHIR_CALL_METHOD(&_25$$12, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_25$$12))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_27$$13, 1); + } else { + ZVAL_BOOL(&_27$$13, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_28, 0, &_27$$13); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_29$$12, &manager, "load", &_30, 0, &intermediateModelName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&intermediateModel, &_29$$12); + ZEPHIR_CALL_METHOD(&_29$$12, &relation, "gettype", &_31, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_29$$12, 3)) { + ZEPHIR_INIT_NVAR(&_32$$14); + zephir_create_array(&_32$$14, 2, 0); + ZEPHIR_INIT_NVAR(&_33$$14); + ZEPHIR_CONCAT_SVS(&_33$$14, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_32$$14, &_33$$14); + ZEPHIR_INIT_NVAR(&_34$$14); + zephir_create_array(&_34$$14, 1, 0); + zephir_array_fast_append(&_34$$14, &value); + zephir_array_update_string(&_32$$14, SL("bind"), &_34$$14, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_32$$14); + zephir_check_call_status(); + if (zephir_is_true(&existingIntermediateModel)) { + ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); + } + } + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateValue, &recordAfter, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_35$$12, &intermediateModel, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_35$$12))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_36$$16, 1); + } else { + ZVAL_BOOL(&_36$$16, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_37, 0, &_36$$16); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_24$$11, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_24$$11)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_38$$17, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_38$$17))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_39$$18, 1); + } else { + ZVAL_BOOL(&_39$$18, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_40, 0, &_39$$18); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_41$$17, &manager, "load", &_42, 0, &intermediateModelName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&intermediateModel, &_41$$17); + ZEPHIR_CALL_METHOD(&_41$$17, &relation, "gettype", &_43, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_41$$17, 3)) { + ZEPHIR_INIT_NVAR(&_44$$19); + zephir_create_array(&_44$$19, 2, 0); + ZEPHIR_INIT_NVAR(&_45$$19); + ZEPHIR_CONCAT_SVS(&_45$$19, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_44$$19, &_45$$19); + ZEPHIR_INIT_NVAR(&_46$$19); + zephir_create_array(&_46$$19, 1, 0); + zephir_array_fast_append(&_46$$19, &value); + zephir_array_update_string(&_44$$19, SL("bind"), &_46$$19, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_44$$19); + zephir_check_call_status(); + if (zephir_is_true(&existingIntermediateModel)) { + ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); + } + } + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateValue, &recordAfter, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_47$$17, &intermediateModel, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_47$$17))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_48$$21, 1); + } else { + ZVAL_BOOL(&_48$$21, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_49, 0, &_48$$21); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } else { + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5262); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _50$$22) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _50$$22); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_52$$23, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_52$$23))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_53$$24, 1); + } else { + ZVAL_BOOL(&_53$$24, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_54, 0, &_53$$24); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_51$$22, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_51$$22)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_55$$25, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_55$$25))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_56$$26, 1); + } else { + ZVAL_BOOL(&_56$$26, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_57, 0, &_56$$26); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } + } else { + if (UNEXPECTED(Z_TYPE_P(&record) != IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_58$$28, 1); + } else { + ZVAL_BOOL(&_58$$28, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_59, 0, &_58$$28); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_60$$28); + object_init_ex(&_60$$28, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_61$$28); + ZEPHIR_CONCAT_SVSVS(&_61$$28, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_60$$28, "__construct", &_13, 32, &_61$$28); + zephir_check_call_status(); + zephir_throw_exception_debug(&_60$$28, "phalcon/Mvc/Model.zep", 5269); + ZEPHIR_MM_RESTORE(); + return; + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, related, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, related, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&name, related, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&record, related, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_62$$29, &manager, "getrelationbyalias", &_63, 0, &className, &name); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&relation, &_62$$29); + if (Z_TYPE_P(&relation) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&_64$$30, &relation, "gettype", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_64$$30, 0)) { + continue; + } + _65$$30 = Z_TYPE_P(&record) != IS_OBJECT; + if (_65$$30) { + _65$$30 = Z_TYPE_P(&record) != IS_ARRAY; + } + if (UNEXPECTED(_65$$30)) { + if (nesting) { + ZVAL_BOOL(&_66$$32, 1); + } else { + ZVAL_BOOL(&_66$$32, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_67, 0, &_66$$32); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_68$$32); + object_init_ex(&_68$$32, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_69$$32); + ZEPHIR_CONCAT_SVSV(&_69$$32, "Only objects/arrays can be stored as part of has-many/has-one/has-one-through/has-many-to-many relations on model ", &className, " on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_68$$32, "__construct", &_13, 32, &_69$$32); + zephir_check_call_status(); + zephir_throw_exception_debug(&_68$$32, "phalcon/Mvc/Model.zep", 5112); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&columns, &relation, "getfields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedModel, &relation, "getreferencedmodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&referencedFields, &relation, "getreferencedfields", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&columns) == IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_70$$33, 1); + } else { + ZVAL_BOOL(&_70$$33, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_71, 0, &_70$$33); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_72$$33); + object_init_ex(&_72$$33, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_73$$33); + ZEPHIR_CONCAT_SVSV(&_73$$33, "Not implemented in '", &className, "' on Relation ", &name); + ZEPHIR_CALL_METHOD(NULL, &_72$$33, "__construct", &_13, 32, &_73$$33); + zephir_check_call_status(); + zephir_throw_exception_debug(&_72$$33, "phalcon/Mvc/Model.zep", 5122); + ZEPHIR_MM_RESTORE(); + return; + } + if (Z_TYPE_P(&record) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_74$$34); + zephir_create_array(&_74$$34, 1, 0); + zephir_array_fast_append(&_74$$34, &record); + ZEPHIR_CPY_WRT(&relatedRecords, &_74$$34); + } else { + ZEPHIR_CPY_WRT(&relatedRecords, &record); + } + ZEPHIR_OBS_NVAR(&value); + if (UNEXPECTED(!(zephir_fetch_property_zval(&value, this_ptr, &columns, PH_SILENT_CC)))) { + if (nesting) { + ZVAL_BOOL(&_75$$36, 1); + } else { + ZVAL_BOOL(&_75$$36, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_76, 0, &_75$$36); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_77$$36); + object_init_ex(&_77$$36, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_78$$36); + ZEPHIR_CONCAT_SVSVS(&_78$$36, "The column '", &columns, "' needs to be present in the model '", &className, "'"); + ZEPHIR_CALL_METHOD(NULL, &_77$$36, "__construct", &_13, 32, &_78$$36); + zephir_check_call_status(); + zephir_throw_exception_debug(&_77$$36, "phalcon/Mvc/Model.zep", 5139); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&_79$$30, &relation, "isthrough", NULL, 0); + zephir_check_call_status(); + isThrough = zephir_get_boolval(&_79$$30); + if (isThrough) { + ZEPHIR_CALL_METHOD(&intermediateModelName, &relation, "getintermediatemodel", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateFields, &relation, "getintermediatefields", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateReferencedFields, &relation, "getintermediatereferencedfields", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5238); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _80$$37) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _80$$37); + ZEPHIR_CALL_METHOD(&_82$$38, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_82$$38))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_83$$39, 1); + } else { + ZVAL_BOOL(&_83$$39, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_84, 0, &_83$$39); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_85$$38, &manager, "load", &_86, 0, &intermediateModelName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&intermediateModel, &_85$$38); + ZEPHIR_CALL_METHOD(&_85$$38, &relation, "gettype", &_87, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_85$$38, 3)) { + ZEPHIR_INIT_NVAR(&_88$$40); + zephir_create_array(&_88$$40, 2, 0); + ZEPHIR_INIT_NVAR(&_89$$40); + ZEPHIR_CONCAT_SVS(&_89$$40, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_88$$40, &_89$$40); + ZEPHIR_INIT_NVAR(&_90$$40); + zephir_create_array(&_90$$40, 1, 0); + zephir_array_fast_append(&_90$$40, &value); + zephir_array_update_string(&_88$$40, SL("bind"), &_90$$40, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_88$$40); + zephir_check_call_status(); + if (zephir_is_true(&existingIntermediateModel)) { + ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); + } + } + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateValue, &recordAfter, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_91$$38, &intermediateModel, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_91$$38))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_92$$42, 1); + } else { + ZVAL_BOOL(&_92$$42, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_93, 0, &_92$$42); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_81$$37, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_81$$37)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_94$$43, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_94$$43))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_95$$44, 1); + } else { + ZVAL_BOOL(&_95$$44, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_96, 0, &_95$$44); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(&_97$$43, &manager, "load", &_98, 0, &intermediateModelName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&intermediateModel, &_97$$43); + ZEPHIR_CALL_METHOD(&_97$$43, &relation, "gettype", &_99, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_LONG(&_97$$43, 3)) { + ZEPHIR_INIT_NVAR(&_100$$45); + zephir_create_array(&_100$$45, 2, 0); + ZEPHIR_INIT_NVAR(&_101$$45); + ZEPHIR_CONCAT_SVS(&_101$$45, "[", &intermediateFields, "] = ?0"); + zephir_array_fast_append(&_100$$45, &_101$$45); + ZEPHIR_INIT_NVAR(&_102$$45); + zephir_create_array(&_102$$45, 1, 0); + zephir_array_fast_append(&_102$$45, &value); + zephir_array_update_string(&_100$$45, SL("bind"), &_102$$45, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(&existingIntermediateModel, &intermediateModel, "findfirst", NULL, 0, &_100$$45); + zephir_check_call_status(); + if (zephir_is_true(&existingIntermediateModel)) { + ZEPHIR_CPY_WRT(&intermediateModel, &existingIntermediateModel); + } + } + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&intermediateValue, &recordAfter, "readattribute", NULL, 0, &referencedFields); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &intermediateModel, "writeattribute", NULL, 0, &intermediateReferencedFields, &intermediateValue); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_103$$43, &intermediateModel, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_103$$43))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &intermediateModel); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_104$$47, 1); + } else { + ZVAL_BOOL(&_104$$47, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_105, 0, &_104$$47); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } else { + zephir_is_iterable(&relatedRecords, 0, "phalcon/Mvc/Model.zep", 5262); + if (Z_TYPE_P(&relatedRecords) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&relatedRecords), _106$$48) + { + ZEPHIR_INIT_NVAR(&recordAfter); + ZVAL_COPY(&recordAfter, _106$$48); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_108$$49, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_108$$49))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_109$$50, 1); + } else { + ZVAL_BOOL(&_109$$50, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_110, 0, &_109$$50); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_107$$48, &relatedRecords, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_107$$48)) { + break; + } + ZEPHIR_CALL_METHOD(&recordAfter, &relatedRecords, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &recordAfter, "writeattribute", NULL, 0, &referencedFields, &value); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_111$$51, &recordAfter, "save", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&_111$$51))) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessagesfrom", &_26, 0, &recordAfter); + zephir_check_call_status(); + if (nesting) { + ZVAL_BOOL(&_112$$52, 1); + } else { + ZVAL_BOOL(&_112$$52, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_113, 0, &_112$$52); + zephir_check_call_status(); + RETURN_MM_BOOL(0); + } + ZEPHIR_CALL_METHOD(NULL, &relatedRecords, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&recordAfter); + } + } else { + if (UNEXPECTED(Z_TYPE_P(&record) != IS_ARRAY)) { + if (nesting) { + ZVAL_BOOL(&_114$$54, 1); + } else { + ZVAL_BOOL(&_114$$54, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_115, 0, &_114$$54); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_116$$54); + object_init_ex(&_116$$54, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_117$$54); + ZEPHIR_CONCAT_SVSVS(&_117$$54, "There are no defined relations for the model '", &className, "' using alias '", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_116$$54, "__construct", &_13, 32, &_117$$54); + zephir_check_call_status(); + zephir_throw_exception_debug(&_116$$54, "phalcon/Mvc/Model.zep", 5269); + ZEPHIR_MM_RESTORE(); + return; + } + } + ZEPHIR_CALL_METHOD(NULL, related, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&record); + ZEPHIR_INIT_NVAR(&name); + if (nesting) { + ZVAL_BOOL(&_118, 1); + } else { + ZVAL_BOOL(&_118, 0); + } + ZEPHIR_CALL_METHOD(NULL, connection, "commit", NULL, 0, &_118); + zephir_check_call_status(); + RETURN_MM_BOOL(1); } -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addForeignKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addIndex); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addPrimaryKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createTable); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createView); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeColumns); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeIndexes); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeReferences); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropForeignKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropIndex); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropPrimaryKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropTable); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropView); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, forUpdate); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnDefinition); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnList); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getCustomFunctions); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getSqlExpression); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, limit); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, listTables); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, modifyColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, registerCustomFunction); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, releaseSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, rollbackSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, select); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, sharedLock); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsReleaseSavepoints); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsSavepoints); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableExists); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableOptions); -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, viewExists); - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Db_Enum) +static PHP_METHOD(Phalcon_Mvc_Model, allowEmptyStringValues) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Enum, phalcon, db_enum, NULL, 0); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_ASSOC"), 2); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_BOTH"), 4); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_BOUND"), 6); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_CLASS"), 8); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_CLASSTYPE"), 262144); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_COLUMN"), 7); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_FUNC"), 10); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_GROUP"), 65536); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_INTO"), 9); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_KEY_PAIR"), 12); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_LAZY"), 1); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_NAMED"), 11); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_NUM"), 3); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_OBJ"), 5); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_ORI_NEXT"), 0); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_PROPS_LATE"), 1048576); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_SERIALIZE"), 524288); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_UNIQUE"), 196608); - - zephir_declare_class_constant_long(phalcon_db_enum_ce, SL("FETCH_DEFAULT"), 0); - - return SUCCESS; -} - - - + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *attributes_param = NULL, __$true, keysAttributes, attribute, *_0, _1, _2; + zval attributes; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&attributes); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&keysAttributes); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &attributes_param); + ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); - -ZEPHIR_INIT_CLASS(Phalcon_Db_Exception) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db, Exception, phalcon, db_exception, zend_ce_exception, NULL, 0); - - return SUCCESS; + ZEPHIR_INIT_VAR(&keysAttributes); + array_init(&keysAttributes); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5310); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) + { + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _0); + zephir_array_update_zval(&keysAttributes, &attribute, &__$true, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&attribute, &attributes, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_update_zval(&keysAttributes, &attribute, &__$true, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&attribute); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2, "setemptystringattributes", NULL, 0, this_ptr, &keysAttributes); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Mvc_Model, cancelOperation) +{ + zval _0, _1$$3, _2$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Db_Index) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Index, phalcon, db_index, phalcon_db_index_method_entry, 0); + ZEPHIR_MM_GROW(); - zend_declare_property_null(phalcon_db_index_ce, SL("columns"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_index_ce, SL("name"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_index_ce, SL("type"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_db_index_ce, 1, phalcon_db_indexinterface_ce); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("operationMade"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_LONG(&_0, 3)) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "notDeleted"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_1$$3); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_VAR(&_2$$4); + ZVAL_STRING(&_2$$4, "notSaved"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "fireevent", NULL, 0, &_2$$4); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Index, __construct) +static PHP_METHOD(Phalcon_Mvc_Model, belongsTo) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval columns; - zval *name_param = NULL, *columns_param = NULL, *type_param = NULL; - zval name, type; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval referenceModel; + zval *fields, fields_sub, *referenceModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&referenceModel); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(name) - Z_PARAM_ARRAY(columns) + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referenceModel) + Z_PARAM_ZVAL(referencedFields) Z_PARAM_OPTIONAL - Z_PARAM_STR(type) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &name_param, &columns_param, &type_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + zephir_fetch_params(1, 3, 1, &fields, &referenceModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referenceModel_param) != IS_STRING && Z_TYPE_P(referenceModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceModel' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(referenceModel_param) == IS_STRING)) { + zephir_get_strval(&referenceModel, referenceModel_param); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_INIT_VAR(&referenceModel); } - ZEPHIR_OBS_COPY_OR_DUP(&columns, columns_param); - if (!type_param) { - ZEPHIR_INIT_VAR(&type); - ZVAL_STRING(&type, ""); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - zephir_get_strval(&type, type_param); + zephir_get_arrval(&options, options_param); } - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - zephir_update_property_zval(this_ptr, ZEND_STRL("columns"), &columns); - zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &type); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Db_Index, getColumns) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "columns"); -} - -static PHP_METHOD(Phalcon_Db_Index, getName) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "name"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "addbelongsto", NULL, 0, this_ptr, fields, &referenceModel, referencedFields, &options); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Index, getType) +static PHP_METHOD(Phalcon_Mvc_Model, getPreparedQuery) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *params, params_sub, *limit = NULL, limit_sub, __$null, builder, bindParams, bindTypes, transaction, cache, manager, query, container, _1, _2, _3$$5, _4$$7; zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "type"); -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Db_IndexInterface) -{ - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, IndexInterface, phalcon, db_indexinterface, phalcon_db_indexinterface_method_entry); - - return SUCCESS; -} - -ZEPHIR_DOC_METHOD(Phalcon_Db_IndexInterface, getColumns); -ZEPHIR_DOC_METHOD(Phalcon_Db_IndexInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Db_IndexInterface, getType); - - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(¶ms_sub); + ZVAL_UNDEF(&limit_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&builder); + ZVAL_UNDEF(&bindParams); + ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&transaction); + ZVAL_UNDEF(&cache); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$7); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(params) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(limit) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, ¶ms, &limit); + if (!limit) { + limit = &limit_sub; + limit = &__$null; + } - -ZEPHIR_INIT_CLASS(Phalcon_Db_Profiler) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Profiler, phalcon, db_profiler, phalcon_db_profiler_method_entry, 0); - - zend_declare_property_null(phalcon_db_profiler_ce, SL("activeProfile"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_profiler_ce, SL("allProfiles"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_profiler_ce, SL("totalNanoseconds"), 0, ZEND_ACC_PROTECTED); - return SUCCESS; -} - -static PHP_METHOD(Phalcon_Db_Profiler, getLastProfile) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "activeProfile"); + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "modelsManager"); + ZEPHIR_CALL_METHOD(&_1, &container, "getshared", NULL, 0, &_2); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + ZEPHIR_CALL_METHOD(&_1, &manager, "createbuilder", NULL, 0, params); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&builder, &_1); + ZEPHIR_INIT_NVAR(&_2); + zephir_get_called_class(&_2); + ZEPHIR_CALL_METHOD(NULL, &builder, "from", NULL, 0, &_2); + zephir_check_call_status(); + if (Z_TYPE_P(limit) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, &builder, "limit", NULL, 0, limit); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&_1, &builder, "getquery", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&query, &_1); + ZEPHIR_OBS_VAR(&bindParams); + if (zephir_array_isset_string_fetch(&bindParams, params, SL("bind"), 0)) { + if (Z_TYPE_P(&bindParams) == IS_ARRAY) { + ZVAL_BOOL(&_3$$5, 1); + ZEPHIR_CALL_METHOD(NULL, &query, "setbindparams", NULL, 0, &bindParams, &_3$$5); + zephir_check_call_status(); + } + ZEPHIR_OBS_VAR(&bindTypes); + if (zephir_array_isset_string_fetch(&bindTypes, params, SL("bindTypes"), 0)) { + if (Z_TYPE_P(&bindTypes) == IS_ARRAY) { + ZVAL_BOOL(&_4$$7, 1); + ZEPHIR_CALL_METHOD(NULL, &query, "setbindtypes", NULL, 0, &bindTypes, &_4$$7); + zephir_check_call_status(); + } + } + } + ZEPHIR_OBS_VAR(&transaction); + if (zephir_array_isset_string_fetch(&transaction, params, SL("transaction"), 0)) { + if (zephir_instance_of_ev(&transaction, phalcon_mvc_model_transactioninterface_ce)) { + ZEPHIR_CALL_METHOD(NULL, &query, "settransaction", NULL, 0, &transaction); + zephir_check_call_status(); + } + } + ZEPHIR_OBS_VAR(&cache); + if (zephir_array_isset_string_fetch(&cache, params, SL("cache"), 0)) { + ZEPHIR_CALL_METHOD(NULL, &query, "cache", NULL, 0, &cache); + zephir_check_call_status(); + } + RETURN_CCTOR(&query); } -static PHP_METHOD(Phalcon_Db_Profiler, getNumberTotalStatements) +static PHP_METHOD(Phalcon_Mvc_Model, hasMany) { - zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval referenceModel; + zval *fields, fields_sub, *referenceModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&referenceModel); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referenceModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif - - zephir_read_property(&_0, this_ptr, ZEND_STRL("allProfiles"), PH_NOISY_CC | PH_READONLY); - RETURN_LONG(zephir_fast_count_int(&_0)); -} - -static PHP_METHOD(Phalcon_Db_Profiler, getTotalElapsedNanoseconds) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 1, &fields, &referenceModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referenceModel_param) != IS_STRING && Z_TYPE_P(referenceModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referenceModel_param) == IS_STRING)) { + zephir_get_strval(&referenceModel, referenceModel_param); + } else { + ZEPHIR_INIT_VAR(&referenceModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } - RETURN_MEMBER(getThis(), "totalNanoseconds"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "addhasmany", NULL, 0, this_ptr, fields, &referenceModel, referencedFields, &options); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Profiler, getTotalElapsedMilliseconds) +static PHP_METHOD(Phalcon_Mvc_Model, hasManyToMany) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval intermediateModel, referenceModel; + zval *fields, fields_sub, *intermediateModel_param = NULL, *intermediateFields, intermediateFields_sub, *intermediateReferencedFields, intermediateReferencedFields_sub, *referenceModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&intermediateFields_sub); + ZVAL_UNDEF(&intermediateReferencedFields_sub); + ZVAL_UNDEF(&referencedFields_sub); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&intermediateModel); + ZVAL_UNDEF(&referenceModel); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(6, 7) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(intermediateModel) + Z_PARAM_ZVAL(intermediateFields) + Z_PARAM_ZVAL(intermediateReferencedFields) + Z_PARAM_STR(referenceModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 6, 1, &fields, &intermediateModel_param, &intermediateFields, &intermediateReferencedFields, &referenceModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(intermediateModel_param) != IS_STRING && Z_TYPE_P(intermediateModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'intermediateModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(intermediateModel_param) == IS_STRING)) { + zephir_get_strval(&intermediateModel, intermediateModel_param); + } else { + ZEPHIR_INIT_VAR(&intermediateModel); + } + if (UNEXPECTED(Z_TYPE_P(referenceModel_param) != IS_STRING && Z_TYPE_P(referenceModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referenceModel_param) == IS_STRING)) { + zephir_get_strval(&referenceModel, referenceModel_param); + } else { + ZEPHIR_INIT_VAR(&referenceModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettotalelapsednanoseconds", NULL, 0); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "addhasmanytomany", NULL, 0, this_ptr, fields, &intermediateModel, intermediateFields, intermediateReferencedFields, &referenceModel, referencedFields, &options); zephir_check_call_status(); - RETURN_MM_DOUBLE(zephir_safe_div_zval_long(&_0, 1000000)); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Profiler, getTotalElapsedSeconds) +static PHP_METHOD(Phalcon_Mvc_Model, hasOne) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval referenceModel; + zval *fields, fields_sub, *referenceModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&referenceModel); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referenceModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettotalelapsedmilliseconds", NULL, 0); - zephir_check_call_status(); - RETURN_MM_DOUBLE(zephir_safe_div_zval_long(&_0, 1000)); + zephir_fetch_params(1, 3, 1, &fields, &referenceModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referenceModel_param) != IS_STRING && Z_TYPE_P(referenceModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referenceModel_param) == IS_STRING)) { + zephir_get_strval(&referenceModel, referenceModel_param); + } else { + ZEPHIR_INIT_VAR(&referenceModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "addhasone", NULL, 0, this_ptr, fields, &referenceModel, referencedFields, &options); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Profiler, getProfiles) +static PHP_METHOD(Phalcon_Mvc_Model, hasOneThrough) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval intermediateModel, referenceModel; + zval *fields, fields_sub, *intermediateModel_param = NULL, *intermediateFields, intermediateFields_sub, *intermediateReferencedFields, intermediateReferencedFields_sub, *referenceModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&intermediateFields_sub); + ZVAL_UNDEF(&intermediateReferencedFields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&intermediateModel); + ZVAL_UNDEF(&referenceModel); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(6, 7) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(intermediateModel) + Z_PARAM_ZVAL(intermediateFields) + Z_PARAM_ZVAL(intermediateReferencedFields) + Z_PARAM_STR(referenceModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "allProfiles"); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 6, 1, &fields, &intermediateModel_param, &intermediateFields, &intermediateReferencedFields, &referenceModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(intermediateModel_param) != IS_STRING && Z_TYPE_P(intermediateModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'intermediateModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(intermediateModel_param) == IS_STRING)) { + zephir_get_strval(&intermediateModel, intermediateModel_param); + } else { + ZEPHIR_INIT_VAR(&intermediateModel); + } + if (UNEXPECTED(Z_TYPE_P(referenceModel_param) != IS_STRING && Z_TYPE_P(referenceModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referenceModel_param) == IS_STRING)) { + zephir_get_strval(&referenceModel, referenceModel_param); + } else { + ZEPHIR_INIT_VAR(&referenceModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_METHOD(&_0, "addhasonethrough", NULL, 0, this_ptr, fields, &intermediateModel, intermediateFields, intermediateReferencedFields, &referenceModel, referencedFields, &options); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Profiler, reset) +static PHP_METHOD(Phalcon_Mvc_Model, keepSnapshots) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *keepSnapshot_param = NULL, _0, _1; + zend_bool keepSnapshot; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(keepSnapshot) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &keepSnapshot_param); + keepSnapshot = zephir_get_boolval(keepSnapshot_param); - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - zephir_update_property_zval(this_ptr, ZEND_STRL("allProfiles"), &_0); - RETURN_THIS(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + if (keepSnapshot) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "keepsnapshots", NULL, 0, this_ptr, &_1); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Profiler, startProfile) +static PHP_METHOD(Phalcon_Mvc_Model, setSchema) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval sqlVariables, sqlBindTypes; - zval *sqlStatement_param = NULL, *sqlVariables_param = NULL, *sqlBindTypes_param = NULL, __$true, activeProfile, _0; - zval sqlStatement; + zval *schema_param = NULL, _0; + zval schema; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&activeProfile); + ZVAL_UNDEF(&schema); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&sqlVariables); - ZVAL_UNDEF(&sqlBindTypes); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(sqlStatement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(sqlVariables) - Z_PARAM_ARRAY(sqlBindTypes) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(schema) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlStatement_param, &sqlVariables_param, &sqlBindTypes_param); - zephir_get_strval(&sqlStatement, sqlStatement_param); - if (!sqlVariables_param) { - ZEPHIR_INIT_VAR(&sqlVariables); - array_init(&sqlVariables); - } else { - zephir_get_arrval(&sqlVariables, sqlVariables_param); + zephir_fetch_params(1, 1, 0, &schema_param); + if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); + RETURN_MM_NULL(); } - if (!sqlBindTypes_param) { - ZEPHIR_INIT_VAR(&sqlBindTypes); - array_init(&sqlBindTypes); + if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { + zephir_get_strval(&schema, schema_param); } else { - zephir_get_arrval(&sqlBindTypes, sqlBindTypes_param); + ZEPHIR_INIT_VAR(&schema); } - ZEPHIR_INIT_VAR(&activeProfile); - object_init_ex(&activeProfile, phalcon_db_profiler_item_ce); - if (zephir_has_constructor(&activeProfile)) { - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "__construct", NULL, 0); - zephir_check_call_status(); - } - - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlstatement", NULL, 217, &sqlStatement); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlvariables", NULL, 218, &sqlVariables); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setsqlbindtypes", NULL, 219, &sqlBindTypes); - zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_0, "hrtime", NULL, 201, &__$true); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setinitialtime", NULL, 220, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setmodelschema", NULL, 0, this_ptr, &schema); zephir_check_call_status(); - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("beforestartprofile")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "beforestartprofile", NULL, 0, &activeProfile); - zephir_check_call_status(); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("activeProfile"), &activeProfile); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Profiler, stopProfile) +static PHP_METHOD(Phalcon_Mvc_Model, setSource) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval __$true, activeProfile, _0, _1, _2, _3; + zval *source_param = NULL, _0; + zval source; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_UNDEF(&activeProfile); + ZVAL_UNDEF(&source); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(source) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &source_param); + if (UNEXPECTED(Z_TYPE_P(source_param) != IS_STRING && Z_TYPE_P(source_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'source' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(source_param) == IS_STRING)) { + zephir_get_strval(&source, source_param); + } else { + ZEPHIR_INIT_VAR(&source); + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("activeProfile"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&activeProfile, &_0); - ZEPHIR_CALL_FUNCTION(&_1, "hrtime", NULL, 201, &__$true); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &activeProfile, "setfinaltime", NULL, 0, &_1); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("totalNanoseconds"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &activeProfile, "gettotalelapsednanoseconds", NULL, 0); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "setmodelsource", NULL, 0, this_ptr, &source); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3); - zephir_add_function(&_3, &_0, &_2); - zephir_update_property_zval(this_ptr, ZEND_STRL("totalNanoseconds"), &_3); - zephir_update_property_array_append(this_ptr, SL("allProfiles"), &activeProfile); - if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("afterendprofile")) == SUCCESS)) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "afterendprofile", NULL, 0, &activeProfile); - zephir_check_call_status(); - } RETURN_THIS(); } +static PHP_METHOD(Phalcon_Mvc_Model, skipAttributes) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *attributes_param = NULL; + zval attributes; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&attributes); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &attributes_param); + ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); - -ZEPHIR_INIT_CLASS(Phalcon_Db_RawValue) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, RawValue, phalcon, db_rawvalue, phalcon_db_rawvalue_method_entry, 0); - - zend_declare_property_null(phalcon_db_rawvalue_ce, SL("value"), ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "skipattributesoncreate", NULL, 0, &attributes); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "skipattributesonupdate", NULL, 0, &attributes); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_RawValue, __construct) +static PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnCreate) { - zval _2$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *value, value_sub, _0$$3, _1$$4; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *attributes_param = NULL, __$null, attribute, *_0, _1, _2; + zval attributes, keysAttributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&keysAttributes); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + Z_PARAM_ARRAY(attributes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &value); + zephir_fetch_params(1, 1, 0, &attributes_param); + ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); - if (ZEPHIR_IS_STRING_IDENTICAL(value, "")) { - ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_INIT_NVAR(&_0$$3); - ZVAL_STRING(&_0$$3, "''"); - zephir_update_property_zval(this_ptr, ZEND_STRL("value"), &_0$$3); - } else if (Z_TYPE_P(value) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$4); - ZEPHIR_INIT_NVAR(&_1$$4); - ZVAL_STRING(&_1$$4, "NULL"); - zephir_update_property_zval(this_ptr, ZEND_STRL("value"), &_1$$4); + ZEPHIR_INIT_VAR(&keysAttributes); + array_init(&keysAttributes); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5769); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) + { + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _0); + zephir_array_update_zval(&keysAttributes, &attribute, &__$null, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); } else { - zephir_cast_to_string(&_2$$5, value); - zephir_update_property_zval(this_ptr, ZEND_STRL("value"), &_2$$5); + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&attribute, &attributes, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_update_zval(&keysAttributes, &attribute, &__$null, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&attribute); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2, "setautomaticcreateattributes", NULL, 0, this_ptr, &keysAttributes); + zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_RawValue, __toString) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "value"); -} - -static PHP_METHOD(Phalcon_Db_RawValue, getValue) +static PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnUpdate) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *attributes_param = NULL, __$null, attribute, *_0, _1, _2; + zval attributes, keysAttributes; zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "value"); -} - - - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&keysAttributes); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(attributes) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &attributes_param); + ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); - -ZEPHIR_INIT_CLASS(Phalcon_Db_Reference) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Reference, phalcon, db_reference, phalcon_db_reference_method_entry, 0); - - zend_declare_property_null(phalcon_db_reference_ce, SL("columns"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("name"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("referencedColumns"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("referencedSchema"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("referencedTable"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("schemaName"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("onDelete"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_reference_ce, SL("onUpdate"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_db_reference_ce, 1, phalcon_db_referenceinterface_ce); - return SUCCESS; + ZEPHIR_INIT_VAR(&keysAttributes); + array_init(&keysAttributes); + zephir_is_iterable(&attributes, 0, "phalcon/Mvc/Model.zep", 5804); + if (Z_TYPE_P(&attributes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&attributes), _0) + { + ZEPHIR_INIT_NVAR(&attribute); + ZVAL_COPY(&attribute, _0); + zephir_array_update_zval(&keysAttributes, &attribute, &__$null, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &attributes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &attributes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&attribute, &attributes, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_update_zval(&keysAttributes, &attribute, &__$null, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &attributes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&attribute); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getmodelsmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2, "setautomaticupdateattributes", NULL, 0, this_ptr, &keysAttributes); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Reference, __construct) +static PHP_METHOD(Phalcon_Mvc_Model, useDynamicUpdate) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval definition; - zval *name_param = NULL, *definition_param = NULL, columns, schema, referencedTable, referencedSchema, referencedColumns, onDelete, onUpdate; - zval name; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *dynamicUpdate_param = NULL, _0, _1; + zend_bool dynamicUpdate; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&referencedTable); - ZVAL_UNDEF(&referencedSchema); - ZVAL_UNDEF(&referencedColumns); - ZVAL_UNDEF(&onDelete); - ZVAL_UNDEF(&onUpdate); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(name) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(dynamicUpdate) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + zephir_fetch_params(1, 1, 0, &dynamicUpdate_param); + dynamicUpdate = zephir_get_boolval(dynamicUpdate_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); - ZEPHIR_OBS_VAR(&referencedTable); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&referencedTable, &definition, SL("referencedTable"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Referenced table is required", "phalcon/Db/Reference.zep", 103); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("referencedTable"), &referencedTable); - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Foreign key columns are required", "phalcon/Db/Reference.zep", 109); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("columns"), &columns); - ZEPHIR_OBS_VAR(&referencedColumns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&referencedColumns, &definition, SL("referencedColumns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Referenced columns of the foreign key are required", "phalcon/Db/Reference.zep", 117); - return; - } - zephir_update_property_zval(this_ptr, ZEND_STRL("referencedColumns"), &referencedColumns); - ZEPHIR_OBS_VAR(&schema); - if (zephir_array_isset_string_fetch(&schema, &definition, SL("schema"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("schemaName"), &schema); - } - ZEPHIR_OBS_VAR(&referencedSchema); - if (zephir_array_isset_string_fetch(&referencedSchema, &definition, SL("referencedSchema"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("referencedSchema"), &referencedSchema); - } - ZEPHIR_OBS_VAR(&onDelete); - if (zephir_array_isset_string_fetch(&onDelete, &definition, SL("onDelete"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("onDelete"), &onDelete); - } - ZEPHIR_OBS_VAR(&onUpdate); - if (zephir_array_isset_string_fetch(&onUpdate, &definition, SL("onUpdate"), 0)) { - zephir_update_property_zval(this_ptr, ZEND_STRL("onUpdate"), &onUpdate); - } - if (UNEXPECTED(zephir_fast_count_int(&columns) != zephir_fast_count_int(&referencedColumns))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Number of columns is not equals than the number of columns referenced", "phalcon/Db/Reference.zep", 141); - return; + zephir_read_property(&_0, this_ptr, ZEND_STRL("modelsManager"), PH_NOISY_CC | PH_READONLY); + if (dynamicUpdate) { + ZVAL_BOOL(&_1, 1); + } else { + ZVAL_BOOL(&_1, 0); } + ZEPHIR_CALL_METHOD(NULL, &_0, "usedynamicupdate", NULL, 0, this_ptr, &_1); + zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Reference, getColumns) +static PHP_METHOD(Phalcon_Mvc_Model, validate) { + zend_object_iterator *_1; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_9 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *validator, validator_sub, messages, message, _0, _2$$4, _3$$4, _4$$4, _5$$4, _6$$4, _7$$4; zval *this_ptr = getThis(); + ZVAL_UNDEF(&validator_sub); + ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(validator, phalcon_filter_validation_validationinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "columns"); -} - -static PHP_METHOD(Phalcon_Db_Reference, getName) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &validator); - RETURN_MEMBER(getThis(), "name"); + ZVAL_NULL(&_0); + ZEPHIR_CALL_METHOD(&messages, validator, "validate", NULL, 0, &_0, this_ptr); + zephir_check_call_status(); + if (((Z_TYPE_P(&messages) == IS_TRUE || Z_TYPE_P(&messages) == IS_FALSE) == 1)) { + RETURN_CCTOR(&messages); + } + _1 = zephir_get_iterator(&messages); + _1->funcs->rewind(_1); + for (;_1->funcs->valid(_1) == SUCCESS && !EG(exception); _1->funcs->move_forward(_1)) { + { + ZEPHIR_ITERATOR_COPY(&message, _1); + } + ZEPHIR_INIT_NVAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_messages_message_ce); + ZEPHIR_CALL_METHOD(&_3$$4, &message, "getmessage", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$4, &message, "getfield", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5$$4, &message, "gettype", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_6$$4, &message, "getcode", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_7$$4, &message, "getmetadata", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", &_8, 6, &_3$$4, &_4$$4, &_5$$4, &_6$$4, &_7$$4); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_9, 0, &_2$$4); + zephir_check_call_status(); + } + zend_iterator_dtor(_1); + RETURN_MM_BOOL(!(zephir_fast_count_int(&messages))); } -static PHP_METHOD(Phalcon_Db_Reference, getReferencedColumns) +static PHP_METHOD(Phalcon_Mvc_Model, validationHasFailed) { + zval _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); - RETURN_MEMBER(getThis(), "referencedColumns"); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("errorMessages"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_fast_count_int(&_0) > 0); } -static PHP_METHOD(Phalcon_Db_Reference, getReferencedSchema) +static PHP_METHOD(Phalcon_Mvc_Model, caseInsensitiveColumnMap) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *columnMap, columnMap_sub, *key, key_sub, cmKey, _0, *_1, _2, _3$$3, _4$$3, _5$$5, _6$$5; zval *this_ptr = getThis(); + ZVAL_UNDEF(&columnMap_sub); + ZVAL_UNDEF(&key_sub); + ZVAL_UNDEF(&cmKey); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$5); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(columnMap) + Z_PARAM_ZVAL(key) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "referencedSchema"); -} - -static PHP_METHOD(Phalcon_Db_Reference, getReferencedTable) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &columnMap, &key); - RETURN_MEMBER(getThis(), "referencedTable"); + ZEPHIR_INIT_VAR(&_0); + zephir_array_keys(&_0, columnMap); + zephir_is_iterable(&_0, 0, "phalcon/Mvc/Model.zep", 5941); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) + { + ZEPHIR_INIT_NVAR(&cmKey); + ZVAL_COPY(&cmKey, _1); + ZEPHIR_INIT_NVAR(&_3$$3); + zephir_fast_strtolower(&_3$$3, &cmKey); + ZEPHIR_INIT_NVAR(&_4$$3); + zephir_fast_strtolower(&_4$$3, key); + if (ZEPHIR_IS_EQUAL(&_3$$3, &_4$$3)) { + RETURN_CCTOR(&cmKey); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&cmKey, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_5$$5); + zephir_fast_strtolower(&_5$$5, &cmKey); + ZEPHIR_INIT_NVAR(&_6$$5); + zephir_fast_strtolower(&_6$$5, key); + if (ZEPHIR_IS_EQUAL(&_5$$5, &_6$$5)) { + RETURN_CCTOR(&cmKey); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&cmKey); + RETVAL_ZVAL(key, 1, 0); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Reference, getSchemaName) +/*** + * Append messages to this model from another Model. + */ +static PHP_METHOD(Phalcon_Mvc_Model, appendMessagesFrom) { + zval _2$$5, _4$$7; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_3 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, messages, message, *_0$$3, _1$$3; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_4$$7); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(model) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "schemaName"); -} - -static PHP_METHOD(Phalcon_Db_Reference, getOnDelete) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); - RETURN_MEMBER(getThis(), "onDelete"); + ZEPHIR_CALL_METHOD(&messages, model, "getmessages", NULL, 0); + zephir_check_call_status(); + if (0 == ZEPHIR_IS_EMPTY(&messages)) { + zephir_is_iterable(&messages, 0, "phalcon/Mvc/Model.zep", 5965); + if (Z_TYPE_P(&messages) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&messages), _0$$3) + { + ZEPHIR_INIT_NVAR(&message); + ZVAL_COPY(&message, _0$$3); + if (Z_TYPE_P(&message) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_2$$5); + zephir_create_array(&_2$$5, 1, 0); + zephir_array_update_string(&_2$$5, SL("model"), model, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_2$$5); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_3, 0, &message); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$3, &messages, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&message, &messages, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&message) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_4$$7); + zephir_create_array(&_4$$7, 1, 0); + zephir_array_update_string(&_4$$7, SL("model"), model, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &message, "setmetadata", NULL, 0, &_4$$7); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_3, 0, &message); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &messages, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&message); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Reference, getOnUpdate) +zend_object *zephir_init_properties_Phalcon_Mvc_Model(zend_class_entry *class_type) { - zval *this_ptr = getThis(); - - + zval _0, _2, _4, _6, _8, _10, _12, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8, _13$$9; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_13$$9); + - RETURN_MEMBER(getThis(), "onUpdate"); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("uniqueTypes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("uniqueTypes"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("uniqueParams"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("uniqueParams"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("snapshot"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("snapshot"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("oldSnapshot"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("oldSnapshot"), &_7$$6); + } + zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("related"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_8) == IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$7); + array_init(&_9$$7); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("related"), &_9$$7); + } + zephir_read_property_ex(&_10, this_ptr, ZEND_STRL("errorMessages"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_10) == IS_NULL) { + ZEPHIR_INIT_VAR(&_11$$8); + array_init(&_11$$8); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("errorMessages"), &_11$$8); + } + zephir_read_property_ex(&_12, this_ptr, ZEND_STRL("dirtyRelated"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_12) == IS_NULL) { + ZEPHIR_INIT_VAR(&_13$$9); + array_init(&_13$$9); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("dirtyRelated"), &_13$$9); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } } @@ -48275,21 +53491,52 @@ static PHP_METHOD(Phalcon_Db_Reference, getOnUpdate) -ZEPHIR_INIT_CLASS(Phalcon_Db_ReferenceInterface) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_ModelInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, ReferenceInterface, phalcon, db_referenceinterface, phalcon_db_referenceinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ModelInterface, phalcon, mvc_modelinterface, phalcon_mvc_modelinterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getColumns); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getName); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getOnDelete); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getOnUpdate); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getReferencedColumns); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getReferencedSchema); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getReferencedTable); -ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getSchemaName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, appendMessage); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, assign); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, average); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, cloneResult); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, cloneResultMap); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, cloneResultMapHydrate); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, count); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, create); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, delete); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, find); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, findFirst); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, fireEvent); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, fireEventCancel); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getDirtyState); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getMessages); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getModelsMetaData); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getOperationMade); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getReadConnection); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getReadConnectionService); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getRelated); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getSchema); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getSource); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getWriteConnection); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, getWriteConnectionService); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, maximum); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, minimum); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, query); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, refresh); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, save); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setConnectionService); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setDirtyState); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setReadConnectionService); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setSnapshotData); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setTransaction); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, setWriteConnectionService); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, skipOperation); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, sum); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, validationHasFailed); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModelInterface, update); @@ -48300,33 +53547,15 @@ ZEPHIR_DOC_METHOD(Phalcon_Db_ReferenceInterface, getSchemaName); -ZEPHIR_INIT_CLASS(Phalcon_Db_ResultInterface) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_ModuleDefinitionInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, ResultInterface, phalcon, db_resultinterface, phalcon_db_resultinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ModuleDefinitionInterface, phalcon, mvc_moduledefinitioninterface, phalcon_mvc_moduledefinitioninterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, dataSeek); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, execute); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, fetch); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, fetchAll); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, fetchArray); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, getInternalResult); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, numRows); -ZEPHIR_DOC_METHOD(Phalcon_Db_ResultInterface, setFetchMode); - - - - -static int phalcon_db_checktype(zval *return_value, zval *placeholder) { - - if (Z_TYPE_P(placeholder) != IS_STRING) { - - } - - return 0; -} +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModuleDefinitionInterface, registerAutoloaders); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ModuleDefinitionInterface, registerServices); @@ -48337,2505 +53566,2419 @@ static int phalcon_db_checktype(zval *return_value, zval *placeholder) { -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Mysql) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Dialect, Mysql, phalcon, db_dialect_mysql, phalcon_db_dialect_ce, phalcon_db_dialect_mysql_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Router, phalcon, mvc_router, phalcon_di_abstractinjectionaware_ce, phalcon_mvc_router_method_entry, 0); - zend_declare_property_string(phalcon_db_dialect_mysql_ce, SL("escapeChar"), "`", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("action"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("controller"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("defaultAction"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("defaultController"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("defaultModule"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("defaultNamespace"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("defaultParams"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("keyRouteNames"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("keyRouteIds"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("matchedRoute"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("matches"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("module"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_ce, SL("namespaceName"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("notFoundPaths"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("params"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_router_ce, SL("removeExtraSlashes"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_ce, SL("routes"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_router_ce, SL("wasMatched"), 0, ZEND_ACC_PROTECTED); + phalcon_mvc_router_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router; + zephir_declare_class_constant_long(phalcon_mvc_router_ce, SL("POSITION_FIRST"), 0); + + zephir_declare_class_constant_long(phalcon_mvc_router_ce, SL("POSITION_LAST"), 1); + + zend_class_implements(phalcon_mvc_router_ce, 1, phalcon_mvc_routerinterface_ce); + zend_class_implements(phalcon_mvc_router_ce, 1, phalcon_events_eventsawareinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, addColumn) +static PHP_METHOD(Phalcon_Mvc_Router, __construct) { - zend_bool _6$$5, _7$$5, _8$$5; + zval routes, _1$$3, _3$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, afterPosition, defaultValue, upperDefaultValue, _0, _1, _2, _3, _4, _5, _14, _15, _9$$5, _10$$6, _11$$7, _12$$7, _13$$7, _16$$11; - zval tableName, schemaName, sql; + zval *defaultRoutes_param = NULL, _0$$3, _2$$3, _4$$3; + zend_bool defaultRoutes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&afterPosition); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&upperDefaultValue); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_15); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_13$$7); - ZVAL_UNDEF(&_16$$11); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&routes); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(defaultRoutes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + zephir_fetch_params(1, 0, 1, &defaultRoutes_param); + if (!defaultRoutes_param) { + defaultRoutes = 1; } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(defaultRoutes_param) != IS_TRUE && Z_TYPE_P(defaultRoutes_param) != IS_FALSE)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'defaultRoutes' must be of the type bool")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + defaultRoutes = (Z_TYPE_P(defaultRoutes_param) == IS_TRUE); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_SVSVSV(&_3, "ALTER TABLE ", &_0, " ADD `", &_1, "` ", &_2); - zephir_get_strval(&sql, &_3); - ZEPHIR_CALL_METHOD(&_4, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_4)) { - zephir_concat_self_str(&sql, " NOT NULL", sizeof(" NOT NULL") - 1); - } else { - zephir_concat_self_str(&sql, " NULL", sizeof(" NULL") - 1); - } - ZEPHIR_CALL_METHOD(&_5, column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_5)) { - ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); + ZEPHIR_INIT_VAR(&routes); + array_init(&routes); + if (defaultRoutes) { + ZEPHIR_INIT_VAR(&_0$$3); + object_init_ex(&_0$$3, phalcon_mvc_router_route_ce); + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 1, 0); + add_assoc_long_ex(&_1$$3, SL("controller"), 1); + ZEPHIR_INIT_VAR(&_2$$3); + ZVAL_STRING(&_2$$3, "#^/([\\w0-9\\_\\-]+)[/]{0,1}$#u"); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 100, &_2$$3, &_1$$3); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&upperDefaultValue); - zephir_fast_strtoupper(&upperDefaultValue, &defaultValue); - _6$$5 = zephir_memnstr_str(&upperDefaultValue, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Mysql.zep", 54); - if (!(_6$$5)) { - _6$$5 = zephir_memnstr_str(&upperDefaultValue, SL("NULL"), "phalcon/Db/Dialect/Mysql.zep", 54); - } - _7$$5 = _6$$5; - if (!(_7$$5)) { - _7$$5 = Z_TYPE_P(&defaultValue) == IS_LONG; - } - _8$$5 = _7$$5; - if (!(_8$$5)) { - ZEPHIR_CALL_FUNCTION(&_9$$5, "is_float", NULL, 213, &defaultValue); - zephir_check_call_status(); - _8$$5 = zephir_is_true(&_9$$5); - } - if (_8$$5) { - ZEPHIR_INIT_VAR(&_10$$6); - ZEPHIR_CONCAT_SV(&_10$$6, " DEFAULT ", &defaultValue); - zephir_concat_self(&sql, &_10$$6); - } else { - ZEPHIR_INIT_VAR(&_11$$7); - ZVAL_STRING(&_11$$7, "\""); - ZEPHIR_CALL_FUNCTION(&_12$$7, "addcslashes", NULL, 214, &defaultValue, &_11$$7); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_13$$7); - ZEPHIR_CONCAT_SVS(&_13$$7, " DEFAULT \"", &_12$$7, "\""); - zephir_concat_self(&sql, &_13$$7); - } - } - ZEPHIR_CALL_METHOD(&_14, column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_14)) { - zephir_concat_self_str(&sql, " AUTO_INCREMENT", sizeof(" AUTO_INCREMENT") - 1); - } - ZEPHIR_CALL_METHOD(&_15, column, "isfirst", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_15)) { - zephir_concat_self_str(&sql, " FIRST", sizeof(" FIRST") - 1); - } else { - ZEPHIR_CALL_METHOD(&afterPosition, column, "getafterposition", NULL, 0); + zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "phalcon/Mvc/Router.zep", 170); + ZEPHIR_INIT_NVAR(&_2$$3); + object_init_ex(&_2$$3, phalcon_mvc_router_route_ce); + ZEPHIR_INIT_VAR(&_3$$3); + zephir_create_array(&_3$$3, 3, 0); + add_assoc_long_ex(&_3$$3, SL("controller"), 1); + add_assoc_long_ex(&_3$$3, SL("action"), 2); + add_assoc_long_ex(&_3$$3, SL("params"), 3); + ZEPHIR_INIT_VAR(&_4$$3); + ZVAL_STRING(&_4$$3, "#^/([\\w0-9\\_\\-]+)/([\\w0-9\\.\\_]+)(/.*)*$#u"); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 100, &_4$$3, &_3$$3); zephir_check_call_status(); - if (zephir_is_true(&afterPosition)) { - ZEPHIR_INIT_VAR(&_16$$11); - ZEPHIR_CONCAT_SVS(&_16$$11, " AFTER `", &afterPosition, "`"); - zephir_concat_self(&sql, &_16$$11); - } + zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "phalcon/Mvc/Router.zep", 179); } - RETURN_CTOR(&sql); + zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &routes); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, addForeignKey) +static PHP_METHOD(Phalcon_Mvc_Router, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *reference, reference_sub, onDelete, onUpdate, _0, _1, _2, _5, _6, _7, _8, _9, _10, _11, _12, _3$$3, _4$$3, _13$$4, _14$$5; - zval tableName, schemaName, sql; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *httpMethods = NULL, httpMethods_sub, *position_param = NULL, __$null, route, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&reference_sub); - ZVAL_UNDEF(&onDelete); - ZVAL_UNDEF(&onUpdate); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_UNDEF(&httpMethods_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_13$$4); - ZVAL_UNDEF(&_14$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(reference, phalcon_db_referenceinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_ZVAL_OR_NULL(httpMethods) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 3, &pattern_param, &paths, &httpMethods, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!httpMethods) { + httpMethods = &httpMethods_sub; + httpMethods = &__$null; + } + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&schemaName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SVS(&_1, "ALTER TABLE ", &_0, " ADD"); - zephir_get_strval(&sql, &_1); - ZEPHIR_CALL_METHOD(&_2, reference, "getname", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_2)) { - ZEPHIR_CALL_METHOD(&_3$$3, reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4$$3); - ZEPHIR_CONCAT_SVS(&_4$$3, " CONSTRAINT `", &_3$$3, "`"); - zephir_concat_self(&sql, &_4$$3); - } - ZEPHIR_CALL_METHOD(&_6, reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8, reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_9, reference, "getreferencedschema", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7, this_ptr, "preparetable", NULL, 0, &_8, &_9); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_11, reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_10, this_ptr, "getcolumnlist", NULL, 54, &_11); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_12); - ZEPHIR_CONCAT_SVSVSVS(&_12, " FOREIGN KEY (", &_5, ") REFERENCES ", &_7, "(", &_10, ")"); - zephir_concat_self(&sql, &_12); - ZEPHIR_CALL_METHOD(&onDelete, reference, "getondelete", NULL, 0); + ZEPHIR_INIT_VAR(&route); + object_init_ex(&route, phalcon_mvc_router_route_ce); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 100, &pattern, paths, httpMethods); zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_VAR(&_13$$4); - ZEPHIR_CONCAT_SV(&_13$$4, " ON DELETE ", &onDelete); - zephir_concat_self(&sql, &_13$$4); - } - ZEPHIR_CALL_METHOD(&onUpdate, reference, "getonupdate", NULL, 0); + ZVAL_LONG(&_0, position); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "attach", NULL, 0, &route, &_0); zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_VAR(&_14$$5); - ZEPHIR_CONCAT_SV(&_14$$5, " ON UPDATE ", &onUpdate); - zephir_concat_self(&sql, &_14$$5); - } - RETURN_CTOR(&sql); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, addIndex) +static PHP_METHOD(Phalcon_Mvc_Router, addConnect) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, indexType, _0, _1, _3, _4, _5, _6, _2$$3; - zval tableName, schemaName, sql; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&indexType); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&schemaName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SV(&_1, "ALTER TABLE ", &_0); - zephir_get_strval(&sql, &_1); - ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SVS(&_2$$3, " ADD ", &indexType, " INDEX "); - zephir_concat_self(&sql, &_2$$3); - } else { - zephir_concat_self_str(&sql, " ADD INDEX ", sizeof(" ADD INDEX ") - 1); - } - ZEPHIR_CALL_METHOD(&_3, index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "getcolumnlist", NULL, 54, &_5); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "CONNECT"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CONCAT_SVSVS(&_6, "`", &_3, "` (", &_4, ")"); - zephir_concat_self(&sql, &_6); - RETURN_CTOR(&sql); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, addPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Router, addDelete) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, _0, _1, _2; - zval tableName, schemaName; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&schemaName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &_2); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "DELETE"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " ADD PRIMARY KEY (", &_1, ")"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, createTable) +static PHP_METHOD(Phalcon_Mvc_Router, addGet) { - zend_bool _9$$10, _10$$10, _11$$10, _28$$19, _29$$19, _30$$19; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_13 = NULL, *_17 = NULL, *_45 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition, createLines; - zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, temporary, options, table, columns, column, indexes, index, reference, references, indexName, columnLine, indexType, onDelete, onUpdate, defaultValue, upperDefaultValue, *_2, _3, _86, _87, _0$$5, _1$$6, _4$$7, _5$$7, _7$$7, _8$$7, _19$$7, _20$$7, _21$$7, _12$$10, _14$$11, _15$$12, _16$$12, _18$$12, _22$$15, _23$$15, _24$$16, _25$$16, _26$$16, _27$$16, _36$$16, _37$$16, _38$$16, _31$$19, _32$$20, _33$$21, _34$$21, _35$$21, _39$$24, _40$$24, *_41$$25, _42$$25, _43$$27, _44$$27, _46$$27, _47$$29, _48$$29, _49$$29, _50$$30, _51$$30, _52$$30, _53$$32, _54$$32, _55$$32, _56$$34, _57$$34, _58$$34, _59$$35, _60$$35, _61$$35, *_62$$36, _63$$36, _64$$37, _65$$37, _66$$37, _67$$37, _68$$37, _69$$37, _70$$37, _71$$37, _72$$37, _73$$38, _74$$39, _75$$40, _76$$40, _77$$40, _78$$40, _79$$40, _80$$40, _81$$40, _82$$40, _83$$40, _84$$41, _85$$42, _88$$43, _89$$43; - zval tableName, schemaName, indexSql, referenceSql, sql; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexSql); - ZVAL_UNDEF(&referenceSql); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&temporary); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&indexName); - ZVAL_UNDEF(&columnLine); - ZVAL_UNDEF(&indexType); - ZVAL_UNDEF(&onDelete); - ZVAL_UNDEF(&onUpdate); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&upperDefaultValue); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_86); - ZVAL_UNDEF(&_87); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_19$$7); - ZVAL_UNDEF(&_20$$7); - ZVAL_UNDEF(&_21$$7); - ZVAL_UNDEF(&_12$$10); - ZVAL_UNDEF(&_14$$11); - ZVAL_UNDEF(&_15$$12); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_22$$15); - ZVAL_UNDEF(&_23$$15); - ZVAL_UNDEF(&_24$$16); - ZVAL_UNDEF(&_25$$16); - ZVAL_UNDEF(&_26$$16); - ZVAL_UNDEF(&_27$$16); - ZVAL_UNDEF(&_36$$16); - ZVAL_UNDEF(&_37$$16); - ZVAL_UNDEF(&_38$$16); - ZVAL_UNDEF(&_31$$19); - ZVAL_UNDEF(&_32$$20); - ZVAL_UNDEF(&_33$$21); - ZVAL_UNDEF(&_34$$21); - ZVAL_UNDEF(&_35$$21); - ZVAL_UNDEF(&_39$$24); - ZVAL_UNDEF(&_40$$24); - ZVAL_UNDEF(&_42$$25); - ZVAL_UNDEF(&_43$$27); - ZVAL_UNDEF(&_44$$27); - ZVAL_UNDEF(&_46$$27); - ZVAL_UNDEF(&_47$$29); - ZVAL_UNDEF(&_48$$29); - ZVAL_UNDEF(&_49$$29); - ZVAL_UNDEF(&_50$$30); - ZVAL_UNDEF(&_51$$30); - ZVAL_UNDEF(&_52$$30); - ZVAL_UNDEF(&_53$$32); - ZVAL_UNDEF(&_54$$32); - ZVAL_UNDEF(&_55$$32); - ZVAL_UNDEF(&_56$$34); - ZVAL_UNDEF(&_57$$34); - ZVAL_UNDEF(&_58$$34); - ZVAL_UNDEF(&_59$$35); - ZVAL_UNDEF(&_60$$35); - ZVAL_UNDEF(&_61$$35); - ZVAL_UNDEF(&_63$$36); - ZVAL_UNDEF(&_64$$37); - ZVAL_UNDEF(&_65$$37); - ZVAL_UNDEF(&_66$$37); - ZVAL_UNDEF(&_67$$37); - ZVAL_UNDEF(&_68$$37); - ZVAL_UNDEF(&_69$$37); - ZVAL_UNDEF(&_70$$37); - ZVAL_UNDEF(&_71$$37); - ZVAL_UNDEF(&_72$$37); - ZVAL_UNDEF(&_73$$38); - ZVAL_UNDEF(&_74$$39); - ZVAL_UNDEF(&_75$$40); - ZVAL_UNDEF(&_76$$40); - ZVAL_UNDEF(&_77$$40); - ZVAL_UNDEF(&_78$$40); - ZVAL_UNDEF(&_79$$40); - ZVAL_UNDEF(&_80$$40); - ZVAL_UNDEF(&_81$$40); - ZVAL_UNDEF(&_82$$40); - ZVAL_UNDEF(&_83$$40); - ZVAL_UNDEF(&_84$$41); - ZVAL_UNDEF(&_85$$42); - ZVAL_UNDEF(&_88$$43); - ZVAL_UNDEF(&_89$$43); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&createLines); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&schemaName); + position = zephir_get_intval(position_param); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/Db/Dialect/Mysql.zep", 151); - return; - } - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "GET"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&temporary); - ZVAL_BOOL(&temporary, 0); - ZEPHIR_OBS_VAR(&options); - if (zephir_array_isset_string_fetch(&options, &definition, SL("options"), 0)) { - ZEPHIR_OBS_NVAR(&temporary); - zephir_array_isset_string_fetch(&temporary, &options, SL("temporary"), 0); - } - if (zephir_is_true(&temporary)) { - ZEPHIR_INIT_VAR(&_0$$5); - ZEPHIR_CONCAT_SVS(&_0$$5, "CREATE TEMPORARY TABLE ", &table, " (\n\t"); - zephir_get_strval(&sql, &_0$$5); - } else { - ZEPHIR_INIT_VAR(&_1$$6); - ZEPHIR_CONCAT_SVS(&_1$$6, "CREATE TABLE ", &table, " (\n\t"); - zephir_get_strval(&sql, &_1$$6); - } - ZEPHIR_INIT_VAR(&createLines); - array_init(&createLines); - zephir_is_iterable(&columns, 0, "phalcon/Db/Dialect/Mysql.zep", 228); - if (Z_TYPE_P(&columns) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&columns), _2) - { - ZEPHIR_INIT_NVAR(&column); - ZVAL_COPY(&column, _2); - ZEPHIR_CALL_METHOD(&_4$$7, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$7, this_ptr, "getcolumndefinition", &_6, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&columnLine); - ZEPHIR_CONCAT_SVSV(&columnLine, "`", &_4$$7, "` ", &_5$$7); - ZEPHIR_CALL_METHOD(&_7$$7, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_7$$7)) { - zephir_concat_self_str(&columnLine, SL(" NOT NULL")); - } else { - zephir_concat_self_str(&columnLine, SL(" NULL")); - } - ZEPHIR_CALL_METHOD(&_8$$7, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_8$$7)) { - ZEPHIR_CALL_METHOD(&defaultValue, &column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&upperDefaultValue); - zephir_fast_strtoupper(&upperDefaultValue, &defaultValue); - _9$$10 = zephir_memnstr_str(&upperDefaultValue, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Mysql.zep", 194); - if (!(_9$$10)) { - _9$$10 = zephir_memnstr_str(&upperDefaultValue, SL("NULL"), "phalcon/Db/Dialect/Mysql.zep", 194); - } - _10$$10 = _9$$10; - if (!(_10$$10)) { - _10$$10 = Z_TYPE_P(&defaultValue) == IS_LONG; - } - _11$$10 = _10$$10; - if (!(_11$$10)) { - ZEPHIR_CALL_FUNCTION(&_12$$10, "is_float", &_13, 213, &defaultValue); - zephir_check_call_status(); - _11$$10 = zephir_is_true(&_12$$10); - } - if (_11$$10) { - ZEPHIR_INIT_NVAR(&_14$$11); - ZEPHIR_CONCAT_SV(&_14$$11, " DEFAULT ", &defaultValue); - zephir_concat_self(&columnLine, &_14$$11); - } else { - ZEPHIR_INIT_NVAR(&_15$$12); - ZVAL_STRING(&_15$$12, "\""); - ZEPHIR_CALL_FUNCTION(&_16$$12, "addcslashes", &_17, 214, &defaultValue, &_15$$12); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_18$$12); - ZEPHIR_CONCAT_SVS(&_18$$12, " DEFAULT \"", &_16$$12, "\""); - zephir_concat_self(&columnLine, &_18$$12); - } - } - ZEPHIR_CALL_METHOD(&_19$$7, &column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_19$$7)) { - zephir_concat_self_str(&columnLine, SL(" AUTO_INCREMENT")); - } - ZEPHIR_CALL_METHOD(&_20$$7, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_20$$7)) { - zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY")); - } - ZEPHIR_CALL_METHOD(&_21$$7, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_21$$7)) { - ZEPHIR_CALL_METHOD(&_22$$15, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_23$$15); - ZEPHIR_CONCAT_SVS(&_23$$15, " COMMENT '", &_22$$15, "'"); - zephir_concat_self(&columnLine, &_23$$15); - } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 222); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &columns, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &columns, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24$$16, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_25$$16, this_ptr, "getcolumndefinition", &_6, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&columnLine); - ZEPHIR_CONCAT_SVSV(&columnLine, "`", &_24$$16, "` ", &_25$$16); - ZEPHIR_CALL_METHOD(&_26$$16, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_26$$16)) { - zephir_concat_self_str(&columnLine, SL(" NOT NULL")); - } else { - zephir_concat_self_str(&columnLine, SL(" NULL")); - } - ZEPHIR_CALL_METHOD(&_27$$16, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_27$$16)) { - ZEPHIR_CALL_METHOD(&defaultValue, &column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&upperDefaultValue); - zephir_fast_strtoupper(&upperDefaultValue, &defaultValue); - _28$$19 = zephir_memnstr_str(&upperDefaultValue, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Mysql.zep", 194); - if (!(_28$$19)) { - _28$$19 = zephir_memnstr_str(&upperDefaultValue, SL("NULL"), "phalcon/Db/Dialect/Mysql.zep", 194); - } - _29$$19 = _28$$19; - if (!(_29$$19)) { - _29$$19 = Z_TYPE_P(&defaultValue) == IS_LONG; - } - _30$$19 = _29$$19; - if (!(_30$$19)) { - ZEPHIR_CALL_FUNCTION(&_31$$19, "is_float", &_13, 213, &defaultValue); - zephir_check_call_status(); - _30$$19 = zephir_is_true(&_31$$19); - } - if (_30$$19) { - ZEPHIR_INIT_NVAR(&_32$$20); - ZEPHIR_CONCAT_SV(&_32$$20, " DEFAULT ", &defaultValue); - zephir_concat_self(&columnLine, &_32$$20); - } else { - ZEPHIR_INIT_NVAR(&_33$$21); - ZVAL_STRING(&_33$$21, "\""); - ZEPHIR_CALL_FUNCTION(&_34$$21, "addcslashes", &_17, 214, &defaultValue, &_33$$21); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_35$$21); - ZEPHIR_CONCAT_SVS(&_35$$21, " DEFAULT \"", &_34$$21, "\""); - zephir_concat_self(&columnLine, &_35$$21); - } - } - ZEPHIR_CALL_METHOD(&_36$$16, &column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_36$$16)) { - zephir_concat_self_str(&columnLine, SL(" AUTO_INCREMENT")); - } - ZEPHIR_CALL_METHOD(&_37$$16, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_37$$16)) { - zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY")); - } - ZEPHIR_CALL_METHOD(&_38$$16, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_38$$16)) { - ZEPHIR_CALL_METHOD(&_39$$24, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_40$$24); - ZEPHIR_CONCAT_SVS(&_40$$24, " COMMENT '", &_39$$24, "'"); - zephir_concat_self(&columnLine, &_40$$24); - } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 222); - ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&column); - ZEPHIR_OBS_VAR(&indexes); - if (zephir_array_isset_string_fetch(&indexes, &definition, SL("indexes"), 0)) { - zephir_is_iterable(&indexes, 0, "phalcon/Db/Dialect/Mysql.zep", 248); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&indexes), _41$$25) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _41$$25); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { - ZEPHIR_CALL_METHOD(&_44$$27, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_43$$27, this_ptr, "getcolumnlist", &_45, 54, &_44$$27); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_46$$27); - ZEPHIR_CONCAT_SVS(&_46$$27, "PRIMARY KEY (", &_43$$27, ")"); - zephir_get_strval(&indexSql, &_46$$27); - } else { - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_CALL_METHOD(&_48$$29, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_47$$29, this_ptr, "getcolumnlist", &_45, 54, &_48$$29); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_49$$29); - ZEPHIR_CONCAT_VSVSVS(&_49$$29, &indexType, " KEY `", &indexName, "` (", &_47$$29, ")"); - zephir_get_strval(&indexSql, &_49$$29); - } else { - ZEPHIR_CALL_METHOD(&_51$$30, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_50$$30, this_ptr, "getcolumnlist", &_45, 54, &_51$$30); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_52$$30); - ZEPHIR_CONCAT_SVSVS(&_52$$30, "KEY `", &indexName, "` (", &_50$$30, ")"); - zephir_get_strval(&indexSql, &_52$$30); - } - } - zephir_array_append(&createLines, &indexSql, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 246); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_42$$25, &indexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_42$$25)) { - break; - } - ZEPHIR_CALL_METHOD(&index, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { - ZEPHIR_CALL_METHOD(&_54$$32, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_53$$32, this_ptr, "getcolumnlist", &_45, 54, &_54$$32); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_55$$32); - ZEPHIR_CONCAT_SVS(&_55$$32, "PRIMARY KEY (", &_53$$32, ")"); - zephir_get_strval(&indexSql, &_55$$32); - } else { - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_CALL_METHOD(&_57$$34, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_56$$34, this_ptr, "getcolumnlist", &_45, 54, &_57$$34); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_58$$34); - ZEPHIR_CONCAT_VSVSVS(&_58$$34, &indexType, " KEY `", &indexName, "` (", &_56$$34, ")"); - zephir_get_strval(&indexSql, &_58$$34); - } else { - ZEPHIR_CALL_METHOD(&_60$$35, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_59$$35, this_ptr, "getcolumnlist", &_45, 54, &_60$$35); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_61$$35); - ZEPHIR_CONCAT_SVSVS(&_61$$35, "KEY `", &indexName, "` (", &_59$$35, ")"); - zephir_get_strval(&indexSql, &_61$$35); - } - } - zephir_array_append(&createLines, &indexSql, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 246); - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - } - ZEPHIR_OBS_VAR(&references); - if (zephir_array_isset_string_fetch(&references, &definition, SL("references"), 0)) { - zephir_is_iterable(&references, 0, "phalcon/Db/Dialect/Mysql.zep", 270); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&references), _62$$36) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _62$$36); - ZEPHIR_CALL_METHOD(&_64$$37, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_66$$37, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_65$$37, this_ptr, "getcolumnlist", &_45, 54, &_66$$37); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_68$$37, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_69$$37, &reference, "getreferencedschema", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_67$$37, this_ptr, "preparetable", NULL, 0, &_68$$37, &_69$$37); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_71$$37, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_70$$37, this_ptr, "getcolumnlist", &_45, 54, &_71$$37); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_72$$37); - ZEPHIR_CONCAT_SVSVSSVSVS(&_72$$37, "CONSTRAINT `", &_64$$37, "` FOREIGN KEY (", &_65$$37, ")", " REFERENCES ", &_67$$37, " (", &_70$$37, ")"); - zephir_get_strval(&referenceSql, &_72$$37); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_73$$38); - ZEPHIR_CONCAT_SV(&_73$$38, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_73$$38); - } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_74$$39); - ZEPHIR_CONCAT_SV(&_74$$39, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_74$$39); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 268); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_63$$36, &references, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_63$$36)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &references, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_75$$40, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_77$$40, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_76$$40, this_ptr, "getcolumnlist", &_45, 54, &_77$$40); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_79$$40, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_80$$40, &reference, "getreferencedschema", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_78$$40, this_ptr, "preparetable", NULL, 0, &_79$$40, &_80$$40); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_82$$40, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_81$$40, this_ptr, "getcolumnlist", &_45, 54, &_82$$40); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_83$$40); - ZEPHIR_CONCAT_SVSVSSVSVS(&_83$$40, "CONSTRAINT `", &_75$$40, "` FOREIGN KEY (", &_76$$40, ")", " REFERENCES ", &_78$$40, " (", &_81$$40, ")"); - zephir_get_strval(&referenceSql, &_83$$40); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_84$$41); - ZEPHIR_CONCAT_SV(&_84$$41, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_84$$41); - } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_85$$42); - ZEPHIR_CONCAT_SV(&_85$$42, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_85$$42); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 268); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reference); - } - ZEPHIR_INIT_VAR(&_86); - zephir_fast_join_str(&_86, SL(",\n\t"), &createLines); - ZEPHIR_INIT_VAR(&_87); - ZEPHIR_CONCAT_VS(&_87, &_86, "\n)"); - zephir_concat_self(&sql, &_87); - if (zephir_array_isset_string(&definition, SL("options"))) { - ZEPHIR_CALL_METHOD(&_88$$43, this_ptr, "gettableoptions", NULL, 0, &definition); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_89$$43); - ZEPHIR_CONCAT_SV(&_89$$43, " ", &_88$$43); - zephir_concat_self(&sql, &_89$$43); - } - RETURN_CTOR(&sql); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, createView) +static PHP_METHOD(Phalcon_Mvc_Router, addHead) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, viewSql, _0; - zval viewName, schemaName; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&viewSql); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(viewName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&viewName); + ZEPHIR_INIT_VAR(&pattern); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } + if (!position_param) { + position = 1; } else { - zephir_get_strval(&schemaName, schemaName_param); + position = zephir_get_intval(position_param); } - ZEPHIR_OBS_VAR(&viewSql); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&viewSql, &definition, SL("sql"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/Db/Dialect/Mysql.zep", 291); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HEAD"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSV(return_value, "CREATE VIEW ", &_0, " AS ", &viewSql); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, describeColumns) +static PHP_METHOD(Phalcon_Mvc_Router, addOptions) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, _0; - zval table, schema; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&pattern); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } + if (!position_param) { + position = 1; } else { - zephir_get_strval(&schema, schema_param); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &table, &schema); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "OPTIONS"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, "SHOW FULL COLUMNS FROM ", &_0); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_Router, addPatch) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, _0; - zval table, schema; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&pattern); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } + if (!position_param) { + position = 1; } else { - zephir_get_strval(&schema, schema_param); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &table, &schema); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PATCH"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, "SHOW INDEXES FROM ", &_0); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, describeReferences) +static PHP_METHOD(Phalcon_Mvc_Router, addPost) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema, sql, _0$$3, _1$$4; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&pattern); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } + if (!position_param) { + position = 1; } else { - zephir_get_strval(&schema, schema_param); + position = zephir_get_intval(position_param); } - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, "SELECT DISTINCT KCU.TABLE_NAME, KCU.COLUMN_NAME, KCU.CONSTRAINT_NAME, KCU.REFERENCED_TABLE_SCHEMA, KCU.REFERENCED_TABLE_NAME, KCU.REFERENCED_COLUMN_NAME, RC.UPDATE_RULE, RC.DELETE_RULE FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS RC ON RC.CONSTRAINT_NAME = KCU.CONSTRAINT_NAME AND RC.CONSTRAINT_SCHEMA = KCU.CONSTRAINT_SCHEMA WHERE KCU.REFERENCED_TABLE_NAME IS NOT NULL AND "); - if (!(ZEPHIR_IS_EMPTY(&schema))) { - ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_CONCAT_SVSVS(&_0$$3, "KCU.CONSTRAINT_SCHEMA = '", &schema, "' AND KCU.TABLE_NAME = '", &table, "'"); - zephir_concat_self(&sql, &_0$$3); - } else { - ZEPHIR_INIT_VAR(&_1$$4); - ZEPHIR_CONCAT_SVS(&_1$$4, "KCU.CONSTRAINT_SCHEMA = DATABASE() AND KCU.TABLE_NAME = '", &table, "'"); - zephir_concat_self(&sql, &_1$$4); - } - RETURN_CTOR(&sql); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "POST"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropColumn) +static PHP_METHOD(Phalcon_Mvc_Router, addPurge) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL, _0; - zval tableName, schemaName, columnName; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&columnName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(columnName) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(columnName_param) == IS_STRING)) { - zephir_get_strval(&columnName, columnName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&columnName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PURGE"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP COLUMN `", &columnName, "`"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropForeignKey) +static PHP_METHOD(Phalcon_Mvc_Router, addPut) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL, _0; - zval tableName, schemaName, referenceName; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&referenceName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(referenceName) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(referenceName_param) == IS_STRING)) { - zephir_get_strval(&referenceName, referenceName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&referenceName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PUT"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP FOREIGN KEY `", &referenceName, "`"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropIndex) +static PHP_METHOD(Phalcon_Mvc_Router, addTrace) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL, _0; - zval tableName, schemaName, indexName; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *position_param = NULL, __$null, _0, _1; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(indexName) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &position_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(indexName_param) == IS_STRING)) { - zephir_get_strval(&indexName, indexName_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&indexName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "TRACE"); + ZVAL_LONG(&_1, position); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, &pattern, paths, &_0, &_1); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP INDEX `", &indexName, "`"); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Router, attach) { + zval _1$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, _0; - zval tableName, schemaName; + zend_long position; + zval *route, route_sub, *position_param = NULL, _0$$4, _2$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&route_sub); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_1$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_OBJECT_OF_CLASS(route, phalcon_mvc_router_routeinterface_ce) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + zephir_fetch_params(1, 1, 1, &route, &position_param); + if (!position_param) { + position = 1; } else { - ZEPHIR_INIT_VAR(&schemaName); + position = zephir_get_intval(position_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "ALTER TABLE ", &_0, " DROP PRIMARY KEY"); - RETURN_MM(); + do { + if (position == 1) { + zephir_update_property_array_append(this_ptr, SL("routes"), route); + break; + } + if (position == 0) { + ZEPHIR_INIT_VAR(&_0$$4); + ZEPHIR_INIT_VAR(&_1$$4); + zephir_create_array(&_1$$4, 1, 0); + zephir_array_fast_append(&_1$$4, route); + zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_fast_array_merge(&_0$$4, &_1$$4, &_2$$4); + zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &_0$$4); + break; + } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "Invalid route position", "phalcon/Mvc/Router.zep", 494); + return; + } while(0); + + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropTable) +static PHP_METHOD(Phalcon_Mvc_Router, clear) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, table; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - if (!ifExists_param) { - ifExists = 1; - } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); - } + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &_0); + ZEPHIR_MM_RESTORE(); +} - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE IF EXISTS ", &table); - RETURN_MM(); - } - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE ", &table); - RETURN_MM(); +static PHP_METHOD(Phalcon_Mvc_Router, getEventsManager) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "eventsManager"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, dropView) +static PHP_METHOD(Phalcon_Mvc_Router, getActionName) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, view; - zval viewName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&view); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - if (!ifExists_param) { - ifExists = 1; - } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); - } + RETURN_MEMBER(getThis(), "action"); +} +static PHP_METHOD(Phalcon_Mvc_Router, getControllerName) +{ + zval *this_ptr = getThis(); - ZEPHIR_CALL_METHOD(&view, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); - zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW IF EXISTS ", &view); - RETURN_MM(); - } - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW ", &view); - RETURN_MM(); + + + RETURN_MEMBER(getThis(), "controller"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition) +static PHP_METHOD(Phalcon_Mvc_Router, getDefaults) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_41 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, columnType, columnSql, typeValues, _0$$3, _1$$3, _2$$3, _3$$5, _4$$11, _5$$15, _6$$17, _7$$18, _8$$18, _9$$18, _10$$20, _11$$20, _12$$20, _13$$22, _14$$24, _15$$24, _16$$24, _17$$26, _18$$26, _19$$26, _20$$36, _21$$36, _22$$36, _23$$40, _24$$40, _25$$40, _26$$44, _27$$46, _28$$47, _29$$49, _30$$52, _31$$52, _32$$52, _33$$56, _34$$59, _35$$59, _36$$59, value$$61, valueSql$$61, *_37$$61, _38$$61, _46$$61, _47$$61, _48$$61, _49$$61, _39$$62, _40$$62, _42$$62, _43$$63, _44$$63, _45$$63, _50$$64, _51$$64, _52$$64; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&columnSql); - ZVAL_UNDEF(&typeValues); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$11); - ZVAL_UNDEF(&_5$$15); - ZVAL_UNDEF(&_6$$17); - ZVAL_UNDEF(&_7$$18); - ZVAL_UNDEF(&_8$$18); - ZVAL_UNDEF(&_9$$18); - ZVAL_UNDEF(&_10$$20); - ZVAL_UNDEF(&_11$$20); - ZVAL_UNDEF(&_12$$20); - ZVAL_UNDEF(&_13$$22); - ZVAL_UNDEF(&_14$$24); - ZVAL_UNDEF(&_15$$24); - ZVAL_UNDEF(&_16$$24); - ZVAL_UNDEF(&_17$$26); - ZVAL_UNDEF(&_18$$26); - ZVAL_UNDEF(&_19$$26); - ZVAL_UNDEF(&_20$$36); - ZVAL_UNDEF(&_21$$36); - ZVAL_UNDEF(&_22$$36); - ZVAL_UNDEF(&_23$$40); - ZVAL_UNDEF(&_24$$40); - ZVAL_UNDEF(&_25$$40); - ZVAL_UNDEF(&_26$$44); - ZVAL_UNDEF(&_27$$46); - ZVAL_UNDEF(&_28$$47); - ZVAL_UNDEF(&_29$$49); - ZVAL_UNDEF(&_30$$52); - ZVAL_UNDEF(&_31$$52); - ZVAL_UNDEF(&_32$$52); - ZVAL_UNDEF(&_33$$56); - ZVAL_UNDEF(&_34$$59); - ZVAL_UNDEF(&_35$$59); - ZVAL_UNDEF(&_36$$59); - ZVAL_UNDEF(&value$$61); - ZVAL_UNDEF(&valueSql$$61); - ZVAL_UNDEF(&_38$$61); - ZVAL_UNDEF(&_46$$61); - ZVAL_UNDEF(&_47$$61); - ZVAL_UNDEF(&_48$$61); - ZVAL_UNDEF(&_49$$61); - ZVAL_UNDEF(&_39$$62); - ZVAL_UNDEF(&_40$$62); - ZVAL_UNDEF(&_42$$62); - ZVAL_UNDEF(&_43$$63); - ZVAL_UNDEF(&_44$$63); - ZVAL_UNDEF(&_45$$63); - ZVAL_UNDEF(&_50$$64); - ZVAL_UNDEF(&_51$$64); - ZVAL_UNDEF(&_52$$64); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_create_array(return_value, 5, 0); + ZEPHIR_OBS_VAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultNamespace"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("namespace"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("module"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultController"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("controller"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultAction"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("action"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("params"), &_0, PH_COPY | PH_SEPARATE); + RETURN_MM(); +} - ZEPHIR_CALL_METHOD(&columnSql, this_ptr, "checkcolumntypesql", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnType, this_ptr, "checkcolumntype", NULL, 0, column); - zephir_check_call_status(); - do { - if (ZEPHIR_IS_LONG(&columnType, 14)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BIGINT")); - } - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_VV(&_2$$3, &_0$$3, &_1$$3); - zephir_concat_self(&columnSql, &_2$$3); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 19)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BIT")); - } - ZEPHIR_CALL_METHOD(&_3$$5, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_3$$5); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 11)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 8)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYINT(1)")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 5)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("CHAR")); - } - ZEPHIR_CALL_METHOD(&_4$$11, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_4$$11); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 1)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DATE")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 4)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DATETIME")); - } - ZEPHIR_CALL_METHOD(&_5$$15, column, "getsize", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_GT_LONG(&_5$$15, 0)) { - ZEPHIR_CALL_METHOD(&_6$$17, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_6$$17); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 3)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DECIMAL")); - } - ZEPHIR_CALL_METHOD(&_7$$18, this_ptr, "getcolumnsizeandscale", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8$$18, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_9$$18); - ZEPHIR_CONCAT_VV(&_9$$18, &_7$$18, &_8$$18); - zephir_concat_self(&columnSql, &_9$$18); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 9)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DOUBLE")); - } - ZEPHIR_CALL_METHOD(&_10$$20, this_ptr, "checkcolumnsizeandscale", NULL, 216, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_11$$20, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_12$$20); - ZEPHIR_CONCAT_VV(&_12$$20, &_10$$20, &_11$$20); - zephir_concat_self(&columnSql, &_12$$20); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 18)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("ENUM")); - } - ZEPHIR_CALL_METHOD(&_13$$22, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_13$$22); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 7)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("FLOAT")); - } - ZEPHIR_CALL_METHOD(&_14$$24, this_ptr, "checkcolumnsizeandscale", NULL, 216, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_15$$24, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_16$$24); - ZEPHIR_CONCAT_VV(&_16$$24, &_14$$24, &_15$$24); - zephir_concat_self(&columnSql, &_16$$24); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 0)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("INT")); - } - ZEPHIR_CALL_METHOD(&_17$$26, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_18$$26, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_19$$26); - ZEPHIR_CONCAT_VV(&_19$$26, &_17$$26, &_18$$26); - zephir_concat_self(&columnSql, &_19$$26); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 15)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("JSON")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 13)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("LONGBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 24)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("LONGTEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 12)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("MEDIUMBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 21)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("MEDIUMINT")); - } - ZEPHIR_CALL_METHOD(&_20$$36, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_21$$36, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_22$$36); - ZEPHIR_CONCAT_VV(&_22$$36, &_20$$36, &_21$$36); - zephir_concat_self(&columnSql, &_22$$36); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 23)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("MEDIUMTEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 22)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("SMALLINT")); - } - ZEPHIR_CALL_METHOD(&_23$$40, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24$$40, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_25$$40); - ZEPHIR_CONCAT_VV(&_25$$40, &_23$$40, &_24$$40); - zephir_concat_self(&columnSql, &_25$$40); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 6)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 20)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TIME")); - } - ZEPHIR_CALL_METHOD(&_26$$44, column, "getsize", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_GT_LONG(&_26$$44, 0)) { - ZEPHIR_CALL_METHOD(&_27$$46, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_27$$46); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 17)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TIMESTAMP")); - } - ZEPHIR_CALL_METHOD(&_28$$47, column, "getsize", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_GT_LONG(&_28$$47, 0)) { - ZEPHIR_CALL_METHOD(&_29$$49, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_29$$49); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 10)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 26)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYINT")); - } - ZEPHIR_CALL_METHOD(&_30$$52, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_31$$52, this_ptr, "checkcolumnunsigned", NULL, 215, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_32$$52); - ZEPHIR_CONCAT_VV(&_32$$52, &_30$$52, &_31$$52); - zephir_concat_self(&columnSql, &_32$$52); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 25)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYTEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 2)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("VARCHAR")); - } - ZEPHIR_CALL_METHOD(&_33$$56, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_33$$56); - break; - } - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&columnSql))) { - ZEPHIR_INIT_VAR(&_34$$59); - object_init_ex(&_34$$59, phalcon_db_exception_ce); - ZEPHIR_CALL_METHOD(&_35$$59, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_36$$59); - ZEPHIR_CONCAT_SV(&_36$$59, "Unrecognized MySQL data type at column ", &_35$$59); - ZEPHIR_CALL_METHOD(NULL, &_34$$59, "__construct", NULL, 29, &_36$$59); - zephir_check_call_status(); - zephir_throw_exception_debug(&_34$$59, "phalcon/Db/Dialect/Mysql.zep", 635); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&typeValues))) { - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&valueSql$$61); - ZVAL_STRING(&valueSql$$61, ""); - zephir_is_iterable(&typeValues, 0, "phalcon/Db/Dialect/Mysql.zep", 649); - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&typeValues), _37$$61) - { - ZEPHIR_INIT_NVAR(&value$$61); - ZVAL_COPY(&value$$61, _37$$61); - ZEPHIR_INIT_NVAR(&_39$$62); - ZVAL_STRING(&_39$$62, "\""); - ZEPHIR_CALL_FUNCTION(&_40$$62, "addcslashes", &_41, 214, &value$$61, &_39$$62); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_42$$62); - ZEPHIR_CONCAT_SVS(&_42$$62, "\"", &_40$$62, "\", "); - zephir_concat_self(&valueSql$$61, &_42$$62); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &typeValues, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_38$$61, &typeValues, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_38$$61)) { - break; - } - ZEPHIR_CALL_METHOD(&value$$61, &typeValues, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_43$$63); - ZVAL_STRING(&_43$$63, "\""); - ZEPHIR_CALL_FUNCTION(&_44$$63, "addcslashes", &_41, 214, &value$$61, &_43$$63); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_45$$63); - ZEPHIR_CONCAT_SVS(&_45$$63, "\"", &_44$$63, "\", "); - zephir_concat_self(&valueSql$$61, &_45$$63); - ZEPHIR_CALL_METHOD(NULL, &typeValues, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value$$61); - ZVAL_LONG(&_46$$61, 0); - ZVAL_LONG(&_47$$61, -2); - ZEPHIR_INIT_VAR(&_48$$61); - zephir_substr(&_48$$61, &valueSql$$61, 0 , -2 , 0); - ZEPHIR_INIT_VAR(&_49$$61); - ZEPHIR_CONCAT_SVS(&_49$$61, "(", &_48$$61, ")"); - zephir_concat_self(&columnSql, &_49$$61); - } else { - ZEPHIR_INIT_VAR(&_50$$64); - ZVAL_STRING(&_50$$64, "\""); - ZEPHIR_CALL_FUNCTION(&_51$$64, "addcslashes", &_41, 214, &typeValues, &_50$$64); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_52$$64); - ZEPHIR_CONCAT_SVS(&_52$$64, "(\"", &_51$$64, "\")"); - zephir_concat_self(&columnSql, &_52$$64); - } - } - } while(0); +static PHP_METHOD(Phalcon_Mvc_Router, getKeyRouteNames) +{ + zval *this_ptr = getThis(); - RETURN_CCTOR(&columnSql); + + + RETURN_MEMBER(getThis(), "keyRouteNames"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, getForeignKeyChecks) +static PHP_METHOD(Phalcon_Mvc_Router, getKeyRouteIds) { zval *this_ptr = getThis(); - RETURN_STRING("SELECT @@foreign_key_checks"); + RETURN_MEMBER(getThis(), "keyRouteIds"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, listTables) +static PHP_METHOD(Phalcon_Mvc_Router, getMatchedRoute) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } + RETURN_MEMBER(getThis(), "matchedRoute"); +} + +static PHP_METHOD(Phalcon_Mvc_Router, getMatches) +{ + zval *this_ptr = getThis(); - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CONCAT_SVS(return_value, "SHOW TABLES FROM `", &schemaName, "`"); - RETURN_MM(); - } - RETURN_MM_STRING("SHOW TABLES"); + + RETURN_MEMBER(getThis(), "matches"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, listViews) +static PHP_METHOD(Phalcon_Mvc_Router, getModuleName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "module"); +} + +static PHP_METHOD(Phalcon_Mvc_Router, getNamespaceName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "namespaceName"); +} + +static PHP_METHOD(Phalcon_Mvc_Router, getParams) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "params"); +} + +static PHP_METHOD(Phalcon_Mvc_Router, getRouteById) { + zend_string *_7; + zend_ulong _6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *id, id_sub, route, routeId, key, _0, _3, *_4, _5, _1$$3, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&id_sub); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&routeId); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(id) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - } + zephir_fetch_params(1, 1, 0, &id); - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CONCAT_SVS(return_value, "SELECT `TABLE_NAME` AS view_name FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_SCHEMA` = '", &schemaName, "' ORDER BY view_name"); - RETURN_MM(); + ZEPHIR_OBS_VAR(&key); + zephir_read_property(&_0, this_ptr, ZEND_STRL("keyRouteIds"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&key, &_0, id, 0)) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_2$$3, &_1$$3, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Router.zep", 614); + RETURN_CTOR(&_2$$3); } - RETURN_MM_STRING("SELECT `TABLE_NAME` AS view_name FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_SCHEMA` = DATABASE() ORDER BY view_name"); + zephir_read_property(&_3, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_3, 0, "phalcon/Mvc/Router.zep", 626); + if (Z_TYPE_P(&_3) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_3), _6, _7, _4) + { + ZEPHIR_INIT_NVAR(&key); + if (_7 != NULL) { + ZVAL_STR_COPY(&key, _7); + } else { + ZVAL_LONG(&key, _6); + } + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _4); + ZEPHIR_CALL_METHOD(&routeId, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("keyRouteIds"), &routeId, &key); + if (ZEPHIR_IS_EQUAL(&routeId, id)) { + RETURN_CCTOR(&route); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_5)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &_3, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&route, &_3, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&routeId, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("keyRouteIds"), &routeId, &key); + if (ZEPHIR_IS_EQUAL(&routeId, id)) { + RETURN_CCTOR(&route); + } + ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&route); + ZEPHIR_INIT_NVAR(&key); + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, modifyColumn) +static PHP_METHOD(Phalcon_Mvc_Router, getRouteByName) { - zend_bool _11$$8, _12$$8, _13$$8; + zend_string *_7; + zend_ulong _6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, *currentColumn = NULL, currentColumn_sub, __$null, afterPosition, defaultValue, upperDefaultValue, columnDefinition, _0, _1, _2, _3, _9, _10, _19, _20, _23, _4$$4, _5$$4, _6$$4, _7$$5, _8$$5, _14$$8, _15$$9, _16$$10, _17$$10, _18$$10, _21$$12, _22$$12, _24$$15; - zval tableName, schemaName, sql; + zval *name_param = NULL, route, routeName, key, _0, _3, *_4, _5, _1$$3, _2$$3; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(¤tColumn_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&afterPosition); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&upperDefaultValue); - ZVAL_UNDEF(&columnDefinition); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&routeName); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_19); - ZVAL_UNDEF(&_20); - ZVAL_UNDEF(&_23); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_14$$8); - ZVAL_UNDEF(&_15$$9); - ZVAL_UNDEF(&_16$$10); - ZVAL_UNDEF(&_17$$10); - ZVAL_UNDEF(&_18$$10); - ZVAL_UNDEF(&_21$$12); - ZVAL_UNDEF(&_22$$12); - ZVAL_UNDEF(&_24$$15); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(currentColumn, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &name_param); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!currentColumn) { - currentColumn = ¤tColumn_sub; - ZEPHIR_CPY_WRT(currentColumn, &__$null); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_SEPARATE_PARAM(currentColumn); + ZEPHIR_INIT_VAR(&name); } - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SV(&_1, "ALTER TABLE ", &_0); - zephir_get_strval(&sql, &_1); - if (Z_TYPE_P(currentColumn) != IS_OBJECT) { - ZEPHIR_CPY_WRT(currentColumn, column); + ZEPHIR_OBS_VAR(&key); + zephir_read_property(&_0, this_ptr, ZEND_STRL("keyRouteNames"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&key, &_0, &name, 0)) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_2$$3, &_1$$3, &key, PH_NOISY | PH_READONLY, "phalcon/Mvc/Router.zep", 641); + RETURN_CTOR(&_2$$3); } - ZEPHIR_CALL_METHOD(&_2, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, currentColumn, "getname", NULL, 0); - zephir_check_call_status(); - if (!ZEPHIR_IS_IDENTICAL(&_2, &_3)) { - ZEPHIR_CALL_METHOD(&_4$$4, currentColumn, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$4, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6$$4); - ZEPHIR_CONCAT_SVSVSV(&_6$$4, " CHANGE COLUMN `", &_4$$4, "` `", &_5$$4, "` ", &columnDefinition); - zephir_concat_self(&sql, &_6$$4); - } else { - ZEPHIR_CALL_METHOD(&_7$$5, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_8$$5); - ZEPHIR_CONCAT_SVSV(&_8$$5, " MODIFY `", &_7$$5, "` ", &columnDefinition); - zephir_concat_self(&sql, &_8$$5); - } - ZEPHIR_CALL_METHOD(&_9, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_9)) { - zephir_concat_self_str(&sql, " NOT NULL", sizeof(" NOT NULL") - 1); + zephir_read_property(&_3, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_3, 0, "phalcon/Mvc/Router.zep", 656); + if (Z_TYPE_P(&_3) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_3), _6, _7, _4) + { + ZEPHIR_INIT_NVAR(&key); + if (_7 != NULL) { + ZVAL_STR_COPY(&key, _7); + } else { + ZVAL_LONG(&key, _6); + } + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _4); + ZEPHIR_CALL_METHOD(&routeName, &route, "getname", NULL, 0); + zephir_check_call_status(); + if (!(ZEPHIR_IS_EMPTY(&routeName))) { + zephir_update_property_array(this_ptr, SL("keyRouteNames"), &routeName, &key); + if (ZEPHIR_IS_EQUAL(&routeName, &name)) { + RETURN_CCTOR(&route); + } + } + } ZEND_HASH_FOREACH_END(); } else { - zephir_concat_self_str(&sql, " NULL", sizeof(" NULL") - 1); - } - ZEPHIR_CALL_METHOD(&_10, column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_10)) { - ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&upperDefaultValue); - zephir_fast_strtoupper(&upperDefaultValue, &defaultValue); - _11$$8 = zephir_memnstr_str(&upperDefaultValue, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Mysql.zep", 731); - if (!(_11$$8)) { - _11$$8 = zephir_memnstr_str(&upperDefaultValue, SL("NULL"), "phalcon/Db/Dialect/Mysql.zep", 731); - } - _12$$8 = _11$$8; - if (!(_12$$8)) { - _12$$8 = Z_TYPE_P(&defaultValue) == IS_LONG; - } - _13$$8 = _12$$8; - if (!(_13$$8)) { - ZEPHIR_CALL_FUNCTION(&_14$$8, "is_float", NULL, 213, &defaultValue); + while (1) { + ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); zephir_check_call_status(); - _13$$8 = zephir_is_true(&_14$$8); - } - if (_13$$8) { - ZEPHIR_INIT_VAR(&_15$$9); - ZEPHIR_CONCAT_SV(&_15$$9, " DEFAULT ", &defaultValue); - zephir_concat_self(&sql, &_15$$9); - } else { - ZEPHIR_INIT_VAR(&_16$$10); - ZVAL_STRING(&_16$$10, "\""); - ZEPHIR_CALL_FUNCTION(&_17$$10, "addcslashes", NULL, 214, &defaultValue, &_16$$10); + if (!zend_is_true(&_5)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &_3, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&route, &_3, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&routeName, &route, "getname", NULL, 0); + zephir_check_call_status(); + if (!(ZEPHIR_IS_EMPTY(&routeName))) { + zephir_update_property_array(this_ptr, SL("keyRouteNames"), &routeName, &key); + if (ZEPHIR_IS_EQUAL(&routeName, &name)) { + RETURN_CCTOR(&route); + } + } + ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_18$$10); - ZEPHIR_CONCAT_SVS(&_18$$10, " DEFAULT \"", &_17$$10, "\""); - zephir_concat_self(&sql, &_18$$10); - } - } - ZEPHIR_CALL_METHOD(&_19, column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_19)) { - zephir_concat_self_str(&sql, " AUTO_INCREMENT", sizeof(" AUTO_INCREMENT") - 1); - } - ZEPHIR_CALL_METHOD(&_20, column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_20)) { - ZEPHIR_CALL_METHOD(&_21$$12, column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_22$$12); - ZEPHIR_CONCAT_SVS(&_22$$12, " COMMENT '", &_21$$12, "'"); - zephir_concat_self(&sql, &_22$$12); - } - ZEPHIR_CALL_METHOD(&_23, column, "isfirst", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_23)) { - zephir_concat_self_str(&sql, " FIRST", sizeof(" FIRST") - 1); - } else { - ZEPHIR_CALL_METHOD(&afterPosition, column, "getafterposition", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&afterPosition)) { - ZEPHIR_INIT_VAR(&_24$$15); - ZEPHIR_CONCAT_SVS(&_24$$15, " AFTER `", &afterPosition, "`"); - zephir_concat_self(&sql, &_24$$15); } } - RETURN_CTOR(&sql); + ZEPHIR_INIT_NVAR(&route); + ZEPHIR_INIT_NVAR(&key); + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, sharedLock) +static PHP_METHOD(Phalcon_Mvc_Router, getRoutes) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL; - zval sqlQuery; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - } - ZEPHIR_CONCAT_VS(return_value, &sqlQuery, " LOCK IN SHARE MODE"); - RETURN_MM(); + RETURN_MEMBER(getThis(), "routes"); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, tableExists) +static PHP_METHOD(Phalcon_Mvc_Router, handle) { + zend_string *_27$$33, *_62$$82; + zend_ulong _26$$33, _61$$82; + zval _21$$28, _33$$39, _35$$42, _40$$50, _42$$53, _56$$77, _67$$88, _69$$91, _74$$99, _76$$102; + zend_bool _2, _31$$34, _38$$45, _65$$83, _72$$94; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName; + zephir_fcall_cache_entry *_18 = NULL, *_20 = NULL, *_23 = NULL, *_30 = NULL, *_53 = NULL, *_55 = NULL, *_58 = NULL, *_78 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *uri_param = NULL, __$true, __$false, __$null, request, currentHostName, routeFound, parts, params, matches, notFoundPaths, vnamespace, module, controller, action, paramsStr, strParams, route, methods, container, hostname, regexHostName, matched, pattern, handledUri, beforeMatch, paths, converters, part, position, matchPosition, converter, eventsManager, _0, _1, _4, *_6, _7, _79, _80, _81, _82, _83, _3$$3, _5$$6, _8$$9, _9$$9, _10$$9, _11$$8, _12$$8, _13$$13, _14$$13, _15$$13, _16$$17, _17$$23, _19$$27, _22$$31, *_24$$33, _25$$33, _28$$35, _29$$35, _32$$39, _34$$42, _36$$46, _37$$46, _39$$50, _41$$53, _43$$58, _44$$58, _45$$58, _46$$57, _47$$57, _48$$62, _49$$62, _50$$62, _51$$66, _52$$72, _54$$76, _57$$80, *_59$$82, _60$$82, _63$$84, _64$$84, _66$$88, _68$$91, _70$$95, _71$$95, _73$$99, _75$$102, _77$$107, _84$$115, _85$$117, _86$$119; + zval uri; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&uri); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&request); + ZVAL_UNDEF(¤tHostName); + ZVAL_UNDEF(&routeFound); + ZVAL_UNDEF(&parts); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&matches); + ZVAL_UNDEF(¬FoundPaths); + ZVAL_UNDEF(&vnamespace); + ZVAL_UNDEF(&module); + ZVAL_UNDEF(&controller); + ZVAL_UNDEF(&action); + ZVAL_UNDEF(¶msStr); + ZVAL_UNDEF(&strParams); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&methods); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&hostname); + ZVAL_UNDEF(®exHostName); + ZVAL_UNDEF(&matched); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&handledUri); + ZVAL_UNDEF(&beforeMatch); + ZVAL_UNDEF(&paths); + ZVAL_UNDEF(&converters); + ZVAL_UNDEF(&part); + ZVAL_UNDEF(&position); + ZVAL_UNDEF(&matchPosition); + ZVAL_UNDEF(&converter); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_79); + ZVAL_UNDEF(&_80); + ZVAL_UNDEF(&_81); + ZVAL_UNDEF(&_82); + ZVAL_UNDEF(&_83); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_9$$9); + ZVAL_UNDEF(&_10$$9); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$13); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$13); + ZVAL_UNDEF(&_16$$17); + ZVAL_UNDEF(&_17$$23); + ZVAL_UNDEF(&_19$$27); + ZVAL_UNDEF(&_22$$31); + ZVAL_UNDEF(&_25$$33); + ZVAL_UNDEF(&_28$$35); + ZVAL_UNDEF(&_29$$35); + ZVAL_UNDEF(&_32$$39); + ZVAL_UNDEF(&_34$$42); + ZVAL_UNDEF(&_36$$46); + ZVAL_UNDEF(&_37$$46); + ZVAL_UNDEF(&_39$$50); + ZVAL_UNDEF(&_41$$53); + ZVAL_UNDEF(&_43$$58); + ZVAL_UNDEF(&_44$$58); + ZVAL_UNDEF(&_45$$58); + ZVAL_UNDEF(&_46$$57); + ZVAL_UNDEF(&_47$$57); + ZVAL_UNDEF(&_48$$62); + ZVAL_UNDEF(&_49$$62); + ZVAL_UNDEF(&_50$$62); + ZVAL_UNDEF(&_51$$66); + ZVAL_UNDEF(&_52$$72); + ZVAL_UNDEF(&_54$$76); + ZVAL_UNDEF(&_57$$80); + ZVAL_UNDEF(&_60$$82); + ZVAL_UNDEF(&_63$$84); + ZVAL_UNDEF(&_64$$84); + ZVAL_UNDEF(&_66$$88); + ZVAL_UNDEF(&_68$$91); + ZVAL_UNDEF(&_70$$95); + ZVAL_UNDEF(&_71$$95); + ZVAL_UNDEF(&_73$$99); + ZVAL_UNDEF(&_75$$102); + ZVAL_UNDEF(&_77$$107); + ZVAL_UNDEF(&_84$$115); + ZVAL_UNDEF(&_85$$117); + ZVAL_UNDEF(&_86$$119); + ZVAL_UNDEF(&_21$$28); + ZVAL_UNDEF(&_33$$39); + ZVAL_UNDEF(&_35$$42); + ZVAL_UNDEF(&_40$$50); + ZVAL_UNDEF(&_42$$53); + ZVAL_UNDEF(&_56$$77); + ZVAL_UNDEF(&_67$$88); + ZVAL_UNDEF(&_69$$91); + ZVAL_UNDEF(&_74$$99); + ZVAL_UNDEF(&_76$$102); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(uri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &uri_param); + if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(&uri, uri_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&uri); } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + + + ZVAL_LONG(&_0, 5); + ZEPHIR_CALL_FUNCTION(&_1, "parse_url", NULL, 101, &uri, &_0); + zephir_check_call_status(); + zephir_get_strval(&uri, &_1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("removeExtraSlashes"), PH_NOISY_CC | PH_READONLY); + _2 = zephir_is_true(&_0); + if (_2) { + _2 = !ZEPHIR_IS_STRING_IDENTICAL(&uri, "/"); + } + if (_2) { + ZEPHIR_INIT_VAR(&_3$$3); + ZVAL_STRING(&_3$$3, "/"); + ZEPHIR_INIT_VAR(&handledUri); + zephir_fast_trim(&handledUri, &uri, &_3$$3, ZEPHIR_TRIM_RIGHT); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_CPY_WRT(&handledUri, &uri); + } + if (ZEPHIR_IS_EMPTY(&handledUri)) { + ZEPHIR_INIT_NVAR(&handledUri); + ZVAL_STRING(&handledUri, "/"); + } + ZEPHIR_INIT_VAR(&request); + ZVAL_NULL(&request); + ZEPHIR_INIT_VAR(¤tHostName); + ZVAL_NULL(¤tHostName); + ZEPHIR_INIT_VAR(&routeFound); + ZVAL_BOOL(&routeFound, 0); + ZEPHIR_INIT_VAR(&parts); + array_init(&parts); + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + ZEPHIR_INIT_VAR(&matches); + ZVAL_NULL(&matches); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &__$null); + zephir_read_property(&_4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_4); + if (Z_TYPE_P(&eventsManager) != IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$6); + ZVAL_STRING(&_5$$6, "router:beforeCheckRoutes"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_5$$6, this_ptr); + zephir_check_call_status(); + } + zephir_read_property(&_4, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_4, 0, "phalcon/Mvc/Router.zep", 948); + if (Z_TYPE_P(&_4) == IS_ARRAY) { + ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&_4), _6) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _6); + ZEPHIR_INIT_NVAR(¶ms); + array_init(¶ms); + ZEPHIR_INIT_NVAR(&matches); + ZVAL_NULL(&matches); + ZEPHIR_CALL_METHOD(&methods, &route, "gethttpmethods", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methods) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_8$$9, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_8$$9); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'request' service", "phalcon/Mvc/Router.zep", 739); + return; + } + ZEPHIR_INIT_NVAR(&_10$$9); + ZVAL_STRING(&_10$$9, "request"); + ZEPHIR_CALL_METHOD(&_9$$9, &container, "getshared", NULL, 0, &_10$$9); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&request, &_9$$9); + } + ZVAL_BOOL(&_12$$8, 1); + ZEPHIR_CALL_METHOD(&_11$$8, &request, "ismethod", NULL, 0, &methods, &_12$$8); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_11$$8)) { + continue; + } + } + ZEPHIR_CALL_METHOD(&hostname, &route, "gethostname", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&hostname) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_13$$13, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_13$$13); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'request' service", "phalcon/Mvc/Router.zep", 766); + return; + } + ZEPHIR_INIT_NVAR(&_15$$13); + ZVAL_STRING(&_15$$13, "request"); + ZEPHIR_CALL_METHOD(&_14$$13, &container, "getshared", NULL, 0, &_15$$13); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&request, &_14$$13); + } + if (Z_TYPE_P(¤tHostName) == IS_NULL) { + ZEPHIR_CALL_METHOD(¤tHostName, &request, "gethttphost", NULL, 0); + zephir_check_call_status(); + } + if (!(zephir_is_true(¤tHostName))) { + continue; + } + if (zephir_memnstr_str(&hostname, SL("("), "phalcon/Mvc/Router.zep", 790)) { + if (!(zephir_memnstr_str(&hostname, SL("#"), "phalcon/Mvc/Router.zep", 791))) { + ZEPHIR_INIT_NVAR(®exHostName); + ZEPHIR_CONCAT_SV(®exHostName, "#^", &hostname); + if (!(zephir_memnstr_str(&hostname, SL(":"), "phalcon/Mvc/Router.zep", 794))) { + zephir_concat_self_str(®exHostName, SL("(:[[:digit:]]+)?")); + } + zephir_concat_self_str(®exHostName, SL("$#i")); + } else { + ZEPHIR_CPY_WRT(®exHostName, &hostname); + } + ZEPHIR_INIT_NVAR(&_16$$17); + ZEPHIR_INIT_NVAR(&matched); + zephir_preg_match(&matched, ®exHostName, ¤tHostName, &_16$$17, 0, 0 , 0 ); + } else { + ZEPHIR_INIT_NVAR(&matched); + ZVAL_BOOL(&matched, ZEPHIR_IS_EQUAL(¤tHostName, &hostname)); + } + if (!(zephir_is_true(&matched))) { + continue; + } + } + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_17$$23); + ZVAL_STRING(&_17$$23, "router:beforeCheckRoute"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_18, 0, &_17$$23, this_ptr, &route); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); + zephir_check_call_status(); + if (zephir_memnstr_str(&pattern, SL("^"), "phalcon/Mvc/Router.zep", 822)) { + ZEPHIR_INIT_NVAR(&routeFound); + zephir_preg_match(&routeFound, &pattern, &handledUri, &matches, 0, 0 , 0 ); + } else { + ZEPHIR_INIT_NVAR(&routeFound); + ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, &handledUri)); + } + if (zephir_is_true(&routeFound)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_19$$27); + ZVAL_STRING(&_19$$27, "router:matchedRoute"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_20, 0, &_19$$27, this_ptr, &route); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&beforeMatch) != IS_NULL) { + if (UNEXPECTED(!(zephir_is_callable(&beforeMatch)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/Mvc/Router.zep", 844); + return; + } + ZEPHIR_INIT_NVAR(&_21$$28); + zephir_create_array(&_21$$28, 3, 0); + zephir_array_fast_append(&_21$$28, &handledUri); + zephir_array_fast_append(&_21$$28, &route); + zephir_array_fast_append(&_21$$28, this_ptr); + ZEPHIR_INIT_NVAR(&routeFound); + ZEPHIR_CALL_USER_FUNC_ARRAY(&routeFound, &beforeMatch, &_21$$28); + zephir_check_call_status(); + } + } else { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_22$$31); + ZVAL_STRING(&_22$$31, "router:notMatchedRoute"); + ZEPHIR_CALL_METHOD(&routeFound, &eventsManager, "fire", &_23, 0, &_22$$31, this_ptr, &route); + zephir_check_call_status(); + } + } + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&parts, &paths); + if (Z_TYPE_P(&matches) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&paths, 0, "phalcon/Mvc/Router.zep", 936); + if (Z_TYPE_P(&paths) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _26$$33, _27$$33, _24$$33) + { + ZEPHIR_INIT_NVAR(&part); + if (_27$$33 != NULL) { + ZVAL_STR_COPY(&part, _27$$33); + } else { + ZVAL_LONG(&part, _26$$33); + } + ZEPHIR_INIT_NVAR(&position); + ZVAL_COPY(&position, _24$$33); + if (UNEXPECTED(Z_TYPE_P(&part) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_28$$35); + object_init_ex(&_28$$35, phalcon_mvc_router_exception_ce); + ZEPHIR_INIT_NVAR(&_29$$35); + ZEPHIR_CONCAT_SV(&_29$$35, "Wrong key in paths: ", &part); + ZEPHIR_CALL_METHOD(NULL, &_28$$35, "__construct", &_30, 32, &_29$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(&_28$$35, "phalcon/Mvc/Router.zep", 884); + ZEPHIR_MM_RESTORE(); + return; + } + _31$$34 = Z_TYPE_P(&position) != IS_STRING; + if (_31$$34) { + _31$$34 = Z_TYPE_P(&position) != IS_LONG; + } + if (_31$$34) { + continue; + } + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_32$$39); + ZEPHIR_INIT_NVAR(&_33$$39); + zephir_create_array(&_33$$39, 1, 0); + zephir_array_fast_append(&_33$$39, &matchPosition); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_32$$39, &converter, &_33$$39); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_32$$39, PH_COPY | PH_SEPARATE); + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_34$$42); + ZEPHIR_INIT_NVAR(&_35$$42); + zephir_create_array(&_35$$42, 1, 0); + zephir_array_fast_append(&_35$$42, &position); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_34$$42, &converter, &_35$$42); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_34$$42, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&position) == IS_LONG) { + zephir_array_unset(&parts, &part, PH_SEPARATE); + } + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_25$$33, &paths, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_25$$33)) { + break; + } + ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&part) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_36$$46); + object_init_ex(&_36$$46, phalcon_mvc_router_exception_ce); + ZEPHIR_INIT_NVAR(&_37$$46); + ZEPHIR_CONCAT_SV(&_37$$46, "Wrong key in paths: ", &part); + ZEPHIR_CALL_METHOD(NULL, &_36$$46, "__construct", &_30, 32, &_37$$46); + zephir_check_call_status(); + zephir_throw_exception_debug(&_36$$46, "phalcon/Mvc/Router.zep", 884); + ZEPHIR_MM_RESTORE(); + return; + } + _38$$45 = Z_TYPE_P(&position) != IS_STRING; + if (_38$$45) { + _38$$45 = Z_TYPE_P(&position) != IS_LONG; + } + if (_38$$45) { + continue; + } + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_39$$50); + ZEPHIR_INIT_NVAR(&_40$$50); + zephir_create_array(&_40$$50, 1, 0); + zephir_array_fast_append(&_40$$50, &matchPosition); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_39$$50, &converter, &_40$$50); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_39$$50, PH_COPY | PH_SEPARATE); + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_41$$53); + ZEPHIR_INIT_NVAR(&_42$$53); + zephir_create_array(&_42$$53, 1, 0); + zephir_array_fast_append(&_42$$53, &position); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_41$$53, &converter, &_42$$53); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_41$$53, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&position) == IS_LONG) { + zephir_array_unset(&parts, &part, PH_SEPARATE); + } + } + } + ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&position); + ZEPHIR_INIT_NVAR(&part); + zephir_update_property_zval(this_ptr, ZEND_STRL("matches"), &matches); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &route); + break; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_4, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_7, &_4, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_7)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &_4, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(¶ms); + array_init(¶ms); + ZEPHIR_INIT_NVAR(&matches); + ZVAL_NULL(&matches); + ZEPHIR_CALL_METHOD(&methods, &route, "gethttpmethods", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methods) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_43$$58, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_43$$58); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'request' service", "phalcon/Mvc/Router.zep", 739); + return; + } + ZEPHIR_INIT_NVAR(&_45$$58); + ZVAL_STRING(&_45$$58, "request"); + ZEPHIR_CALL_METHOD(&_44$$58, &container, "getshared", NULL, 0, &_45$$58); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&request, &_44$$58); + } + ZVAL_BOOL(&_47$$57, 1); + ZEPHIR_CALL_METHOD(&_46$$57, &request, "ismethod", NULL, 0, &methods, &_47$$57); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_46$$57)) { + continue; + } + } + ZEPHIR_CALL_METHOD(&hostname, &route, "gethostname", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&hostname) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_48$$62, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_48$$62); + if (Z_TYPE_P(&container) == IS_NULL) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'request' service", "phalcon/Mvc/Router.zep", 766); + return; + } + ZEPHIR_INIT_NVAR(&_50$$62); + ZVAL_STRING(&_50$$62, "request"); + ZEPHIR_CALL_METHOD(&_49$$62, &container, "getshared", NULL, 0, &_50$$62); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&request, &_49$$62); + } + if (Z_TYPE_P(¤tHostName) == IS_NULL) { + ZEPHIR_CALL_METHOD(¤tHostName, &request, "gethttphost", NULL, 0); + zephir_check_call_status(); + } + if (!(zephir_is_true(¤tHostName))) { + continue; + } + if (zephir_memnstr_str(&hostname, SL("("), "phalcon/Mvc/Router.zep", 790)) { + if (!(zephir_memnstr_str(&hostname, SL("#"), "phalcon/Mvc/Router.zep", 791))) { + ZEPHIR_INIT_NVAR(®exHostName); + ZEPHIR_CONCAT_SV(®exHostName, "#^", &hostname); + if (!(zephir_memnstr_str(&hostname, SL(":"), "phalcon/Mvc/Router.zep", 794))) { + zephir_concat_self_str(®exHostName, SL("(:[[:digit:]]+)?")); + } + zephir_concat_self_str(®exHostName, SL("$#i")); + } else { + ZEPHIR_CPY_WRT(®exHostName, &hostname); + } + ZEPHIR_INIT_NVAR(&_51$$66); + ZEPHIR_INIT_NVAR(&matched); + zephir_preg_match(&matched, ®exHostName, ¤tHostName, &_51$$66, 0, 0 , 0 ); + } else { + ZEPHIR_INIT_NVAR(&matched); + ZVAL_BOOL(&matched, ZEPHIR_IS_EQUAL(¤tHostName, &hostname)); + } + if (!(zephir_is_true(&matched))) { + continue; + } + } + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_52$$72); + ZVAL_STRING(&_52$$72, "router:beforeCheckRoute"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_53, 0, &_52$$72, this_ptr, &route); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); + zephir_check_call_status(); + if (zephir_memnstr_str(&pattern, SL("^"), "phalcon/Mvc/Router.zep", 822)) { + ZEPHIR_INIT_NVAR(&routeFound); + zephir_preg_match(&routeFound, &pattern, &handledUri, &matches, 0, 0 , 0 ); + } else { + ZEPHIR_INIT_NVAR(&routeFound); + ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, &handledUri)); + } + if (zephir_is_true(&routeFound)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_54$$76); + ZVAL_STRING(&_54$$76, "router:matchedRoute"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_55, 0, &_54$$76, this_ptr, &route); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&beforeMatch) != IS_NULL) { + if (UNEXPECTED(!(zephir_is_callable(&beforeMatch)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/Mvc/Router.zep", 844); + return; + } + ZEPHIR_INIT_NVAR(&_56$$77); + zephir_create_array(&_56$$77, 3, 0); + zephir_array_fast_append(&_56$$77, &handledUri); + zephir_array_fast_append(&_56$$77, &route); + zephir_array_fast_append(&_56$$77, this_ptr); + ZEPHIR_INIT_NVAR(&routeFound); + ZEPHIR_CALL_USER_FUNC_ARRAY(&routeFound, &beforeMatch, &_56$$77); + zephir_check_call_status(); + } + } else { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_57$$80); + ZVAL_STRING(&_57$$80, "router:notMatchedRoute"); + ZEPHIR_CALL_METHOD(&routeFound, &eventsManager, "fire", &_58, 0, &_57$$80, this_ptr, &route); + zephir_check_call_status(); + } + } + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&parts, &paths); + if (Z_TYPE_P(&matches) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&paths, 0, "phalcon/Mvc/Router.zep", 936); + if (Z_TYPE_P(&paths) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _61$$82, _62$$82, _59$$82) + { + ZEPHIR_INIT_NVAR(&part); + if (_62$$82 != NULL) { + ZVAL_STR_COPY(&part, _62$$82); + } else { + ZVAL_LONG(&part, _61$$82); + } + ZEPHIR_INIT_NVAR(&position); + ZVAL_COPY(&position, _59$$82); + if (UNEXPECTED(Z_TYPE_P(&part) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_63$$84); + object_init_ex(&_63$$84, phalcon_mvc_router_exception_ce); + ZEPHIR_INIT_NVAR(&_64$$84); + ZEPHIR_CONCAT_SV(&_64$$84, "Wrong key in paths: ", &part); + ZEPHIR_CALL_METHOD(NULL, &_63$$84, "__construct", &_30, 32, &_64$$84); + zephir_check_call_status(); + zephir_throw_exception_debug(&_63$$84, "phalcon/Mvc/Router.zep", 884); + ZEPHIR_MM_RESTORE(); + return; + } + _65$$83 = Z_TYPE_P(&position) != IS_STRING; + if (_65$$83) { + _65$$83 = Z_TYPE_P(&position) != IS_LONG; + } + if (_65$$83) { + continue; + } + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_66$$88); + ZEPHIR_INIT_NVAR(&_67$$88); + zephir_create_array(&_67$$88, 1, 0); + zephir_array_fast_append(&_67$$88, &matchPosition); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_66$$88, &converter, &_67$$88); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_66$$88, PH_COPY | PH_SEPARATE); + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_68$$91); + ZEPHIR_INIT_NVAR(&_69$$91); + zephir_create_array(&_69$$91, 1, 0); + zephir_array_fast_append(&_69$$91, &position); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_68$$91, &converter, &_69$$91); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_68$$91, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&position) == IS_LONG) { + zephir_array_unset(&parts, &part, PH_SEPARATE); + } + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_60$$82, &paths, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_60$$82)) { + break; + } + ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&part) != IS_STRING)) { + ZEPHIR_INIT_NVAR(&_70$$95); + object_init_ex(&_70$$95, phalcon_mvc_router_exception_ce); + ZEPHIR_INIT_NVAR(&_71$$95); + ZEPHIR_CONCAT_SV(&_71$$95, "Wrong key in paths: ", &part); + ZEPHIR_CALL_METHOD(NULL, &_70$$95, "__construct", &_30, 32, &_71$$95); + zephir_check_call_status(); + zephir_throw_exception_debug(&_70$$95, "phalcon/Mvc/Router.zep", 884); + ZEPHIR_MM_RESTORE(); + return; + } + _72$$94 = Z_TYPE_P(&position) != IS_STRING; + if (_72$$94) { + _72$$94 = Z_TYPE_P(&position) != IS_LONG; + } + if (_72$$94) { + continue; + } + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_73$$99); + ZEPHIR_INIT_NVAR(&_74$$99); + zephir_create_array(&_74$$99, 1, 0); + zephir_array_fast_append(&_74$$99, &matchPosition); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_73$$99, &converter, &_74$$99); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_73$$99, PH_COPY | PH_SEPARATE); + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&converter); + if (zephir_array_isset_fetch(&converter, &converters, &part, 0)) { + ZEPHIR_INIT_NVAR(&_75$$102); + ZEPHIR_INIT_NVAR(&_76$$102); + zephir_create_array(&_76$$102, 1, 0); + zephir_array_fast_append(&_76$$102, &position); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_75$$102, &converter, &_76$$102); + zephir_check_call_status(); + zephir_array_update_zval(&parts, &part, &_75$$102, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&position) == IS_LONG) { + zephir_array_unset(&parts, &part, PH_SEPARATE); + } + } + } + ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&position); + ZEPHIR_INIT_NVAR(&part); + zephir_update_property_zval(this_ptr, ZEND_STRL("matches"), &matches); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("matchedRoute"), &route); + break; + } + ZEPHIR_CALL_METHOD(NULL, &_4, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&route); + if (zephir_is_true(&routeFound)) { + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); + } + } else { + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("wasMatched"), &__$false); + } + } + if (!(zephir_is_true(&routeFound))) { + zephir_read_property(&_77$$107, this_ptr, ZEND_STRL("notFoundPaths"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(¬FoundPaths, &_77$$107); + if (Z_TYPE_P(¬FoundPaths) != IS_NULL) { + ZEPHIR_CALL_CE_STATIC(&parts, phalcon_mvc_router_route_ce, "getroutepaths", &_78, 0, ¬FoundPaths); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&routeFound); + ZVAL_BOOL(&routeFound, 1); + } + } + zephir_read_property(&_79, this_ptr, ZEND_STRL("defaultNamespace"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("namespaceName"), &_79); + zephir_read_property(&_80, this_ptr, ZEND_STRL("defaultModule"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("module"), &_80); + zephir_read_property(&_81, this_ptr, ZEND_STRL("defaultController"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("controller"), &_81); + zephir_read_property(&_82, this_ptr, ZEND_STRL("defaultAction"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("action"), &_82); + zephir_read_property(&_83, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), &_83); + if (zephir_is_true(&routeFound)) { + ZEPHIR_OBS_VAR(&vnamespace); + if (zephir_array_isset_string_fetch(&vnamespace, &parts, SL("namespace"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("namespaceName"), &vnamespace); + zephir_array_unset_string(&parts, SL("namespace"), PH_SEPARATE); + } + ZEPHIR_OBS_VAR(&module); + if (zephir_array_isset_string_fetch(&module, &parts, SL("module"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("module"), &module); + zephir_array_unset_string(&parts, SL("module"), PH_SEPARATE); + } + ZEPHIR_OBS_VAR(&controller); + if (zephir_array_isset_string_fetch(&controller, &parts, SL("controller"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("controller"), &controller); + zephir_array_unset_string(&parts, SL("controller"), PH_SEPARATE); + } + ZEPHIR_OBS_VAR(&action); + if (zephir_array_isset_string_fetch(&action, &parts, SL("action"), 0)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("action"), &action); + zephir_array_unset_string(&parts, SL("action"), PH_SEPARATE); + } + ZEPHIR_OBS_VAR(¶msStr); + if (zephir_array_isset_string_fetch(¶msStr, &parts, SL("params"), 0)) { + if (Z_TYPE_P(¶msStr) == IS_STRING) { + ZEPHIR_INIT_VAR(&_84$$115); + ZVAL_STRING(&_84$$115, "/"); + ZEPHIR_INIT_VAR(&strParams); + zephir_fast_trim(&strParams, ¶msStr, &_84$$115, ZEPHIR_TRIM_BOTH); + if (!ZEPHIR_IS_STRING_IDENTICAL(&strParams, "")) { + ZEPHIR_INIT_NVAR(¶ms); + zephir_fast_explode_str(¶ms, SL("/"), &strParams, LONG_MAX); + } + } + zephir_array_unset_string(&parts, SL("params"), PH_SEPARATE); + } + if (zephir_fast_count_int(¶ms)) { + ZEPHIR_INIT_VAR(&_85$$117); + zephir_fast_array_merge(&_85$$117, ¶ms, &parts); + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), &_85$$117); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("params"), &parts); + } + } + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_86$$119); + ZVAL_STRING(&_86$$119, "router:afterCheckRoutes"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_86$$119, this_ptr); + zephir_check_call_status(); } + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, isExactControllerName) +{ + zval *this_ptr = getThis(); - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT IF(COUNT(*) > 0, 1, 0) FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_NAME`= '", &tableName, "' AND `TABLE_SCHEMA` = '", &schemaName, "'"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, "SELECT IF(COUNT(*) > 0, 1, 0) FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_NAME` = '", &tableName, "' AND `TABLE_SCHEMA` = DATABASE()"); - RETURN_MM(); + + RETURN_BOOL(1); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, tableOptions) +static PHP_METHOD(Phalcon_Mvc_Router, mount) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema, sql; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *group, group_sub, groupRoutes, beforeMatch, hostname, routes, route, eventsManager, _0, _6, _1$$3, *_2$$5, _3$$5, *_4$$8, _5$$8; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&sql); + ZVAL_UNDEF(&group_sub); + ZVAL_UNDEF(&groupRoutes); + ZVAL_UNDEF(&beforeMatch); + ZVAL_UNDEF(&hostname); + ZVAL_UNDEF(&routes); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_5$$8); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(group, phalcon_mvc_router_groupinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } - + zephir_fetch_params(1, 1, 0, &group); - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, "SELECT TABLES.TABLE_TYPE AS table_type,TABLES.AUTO_INCREMENT AS auto_increment,TABLES.ENGINE AS engine,TABLES.TABLE_COLLATION AS table_collation FROM INFORMATION_SCHEMA.TABLES WHERE "); - if (!(ZEPHIR_IS_EMPTY(&schema))) { - ZEPHIR_CONCAT_VSVSVS(return_value, &sql, "TABLES.TABLE_SCHEMA = '", &schema, "' AND TABLES.TABLE_NAME = '", &table, "'"); - RETURN_MM(); - } - ZEPHIR_CONCAT_VSVS(return_value, &sql, "TABLES.TABLE_SCHEMA = DATABASE() AND TABLES.TABLE_NAME = '", &table, "'"); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, truncateTable) + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_STRING(&_1$$3, "router:beforeMount"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_1$$3, this_ptr, group); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&groupRoutes, group, "getroutes", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(!(zephir_fast_count_int(&groupRoutes)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The group of routes does not contain any routes", "phalcon/Mvc/Router.zep", 1069); + return; + } + ZEPHIR_CALL_METHOD(&beforeMatch, group, "getbeforematch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&beforeMatch) != IS_NULL) { + zephir_is_iterable(&groupRoutes, 0, "phalcon/Mvc/Router.zep", 1081); + if (Z_TYPE_P(&groupRoutes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _2$$5) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _2$$5); + ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$5, &groupRoutes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$5)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &groupRoutes, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&route); + } + ZEPHIR_CALL_METHOD(&hostname, group, "gethostname", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&hostname) != IS_NULL) { + zephir_is_iterable(&groupRoutes, 0, "phalcon/Mvc/Router.zep", 1090); + if (Z_TYPE_P(&groupRoutes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _4$$8) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _4$$8); + ZEPHIR_CALL_METHOD(NULL, &route, "sethostname", NULL, 0, &hostname); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_5$$8, &groupRoutes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_5$$8)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &groupRoutes, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "sethostname", NULL, 0, &hostname); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&route); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&routes, &_0); + ZEPHIR_INIT_VAR(&_6); + zephir_fast_array_merge(&_6, &routes, &groupRoutes); + zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &_6); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, notFound) +{ + zend_bool _0; + zval *paths, paths_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&paths_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(paths) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &paths); + + + _0 = Z_TYPE_P(paths) != IS_ARRAY; + if (_0) { + _0 = Z_TYPE_P(paths) != IS_STRING; + } + if (UNEXPECTED(_0)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_mvc_router_exception_ce, "The not-found paths must be an array or string", "phalcon/Mvc/Router.zep", 1112); + return; + } + zephir_update_property_zval(this_ptr, ZEND_STRL("notFoundPaths"), paths); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, removeExtraSlashes) +{ + zval *remove_param = NULL, __$true, __$false; + zend_bool remove; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(remove) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &remove_param); + if (UNEXPECTED(Z_TYPE_P(remove_param) != IS_TRUE && Z_TYPE_P(remove_param) != IS_FALSE)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'remove' must be of the type bool")); + RETURN_NULL(); + } + remove = (Z_TYPE_P(remove_param) == IS_TRUE); + + + if (remove) { + zephir_update_property_zval(this_ptr, ZEND_STRL("removeExtraSlashes"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("removeExtraSlashes"), &__$false); + } + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, setDefaultAction) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName, table; + zval *actionName_param = NULL; + zval actionName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&actionName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(actionName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &actionName_param); + if (UNEXPECTED(Z_TYPE_P(actionName_param) != IS_STRING && Z_TYPE_P(actionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(actionName_param) == IS_STRING)) { + zephir_get_strval(&actionName, actionName_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&actionName); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultAction"), &actionName); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, setDefaultController) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *controllerName_param = NULL; + zval controllerName; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&controllerName); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(controllerName) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &controllerName_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&controllerName); } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_INIT_VAR(&table); - ZEPHIR_CONCAT_SVSVS(&table, "`", &schemaName, "`.`", &tableName, "`"); - } else { - ZEPHIR_INIT_NVAR(&table); - ZEPHIR_CONCAT_SVS(&table, "`", &tableName, "`"); - } - ZEPHIR_CONCAT_SV(return_value, "TRUNCATE TABLE ", &table); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultController"), &controllerName); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, viewExists) +static PHP_METHOD(Phalcon_Mvc_Router, setDefaultModule) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *viewName_param = NULL, *schemaName_param = NULL; - zval viewName, schemaName; + zval *moduleName_param = NULL; + zval moduleName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&moduleName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(moduleName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &moduleName_param); + if (UNEXPECTED(Z_TYPE_P(moduleName_param) != IS_STRING && Z_TYPE_P(moduleName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'moduleName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); + if (EXPECTED(Z_TYPE_P(moduleName_param) == IS_STRING)) { + zephir_get_strval(&moduleName, moduleName_param); } else { - ZEPHIR_INIT_VAR(&viewName); + ZEPHIR_INIT_VAR(&moduleName); } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultModule"), &moduleName); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, setDefaultNamespace) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *namespaceName_param = NULL; + zval namespaceName; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&namespaceName); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(namespaceName) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &namespaceName_param); + if (UNEXPECTED(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(namespaceName_param) == IS_STRING)) { + zephir_get_strval(&namespaceName, namespaceName_param); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_INIT_VAR(&namespaceName); } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT IF(COUNT(*) > 0, 1, 0) FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_NAME`= '", &viewName, "' AND `TABLE_SCHEMA`='", &schemaName, "'"); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, "SELECT IF(COUNT(*) > 0, 1, 0) FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_NAME`='", &viewName, "' AND `TABLE_SCHEMA` = DATABASE()"); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultNamespace"), &namespaceName); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, getTableOptions) +static PHP_METHOD(Phalcon_Mvc_Router, setDefaults) { + zval _0$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *definition_param = NULL, options, engine, autoIncrement, tableCollation, collationParts, _0$$5, _1$$7, _2$$9, _3$$9, _4$$9; - zval definition, tableOptions; + zval *defaults_param = NULL, namespaceName, module, controller, action, params; + zval defaults; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&tableOptions); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&engine); - ZVAL_UNDEF(&autoIncrement); - ZVAL_UNDEF(&tableCollation); - ZVAL_UNDEF(&collationParts); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_1$$7); - ZVAL_UNDEF(&_2$$9); - ZVAL_UNDEF(&_3$$9); - ZVAL_UNDEF(&_4$$9); + ZVAL_UNDEF(&defaults); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&module); + ZVAL_UNDEF(&controller); + ZVAL_UNDEF(&action); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(definition) + Z_PARAM_ARRAY(defaults) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &definition_param); - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + zephir_fetch_params(1, 1, 0, &defaults_param); + ZEPHIR_OBS_COPY_OR_DUP(&defaults, defaults_param); - ZEPHIR_OBS_VAR(&options); - if (!(zephir_array_isset_string_fetch(&options, &definition, SL("options"), 0))) { - RETURN_MM_STRING(""); + if (zephir_array_isset_string_fetch(&namespaceName, &defaults, SL("namespace"), 1)) { + zephir_cast_to_string(&_0$$3, &namespaceName); + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultNamespace"), &_0$$3); } - ZEPHIR_INIT_VAR(&tableOptions); - array_init(&tableOptions); - ZEPHIR_OBS_VAR(&engine); - if (zephir_array_isset_string_fetch(&engine, &options, SL("ENGINE"), 0)) { - if (zephir_is_true(&engine)) { - ZEPHIR_INIT_VAR(&_0$$5); - ZEPHIR_CONCAT_SV(&_0$$5, "ENGINE=", &engine); - zephir_array_append(&tableOptions, &_0$$5, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 857); - } + if (zephir_array_isset_string_fetch(&module, &defaults, SL("module"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultModule"), &module); } - ZEPHIR_OBS_VAR(&autoIncrement); - if (zephir_array_isset_string_fetch(&autoIncrement, &options, SL("AUTO_INCREMENT"), 0)) { - if (zephir_is_true(&autoIncrement)) { - ZEPHIR_INIT_VAR(&_1$$7); - ZEPHIR_CONCAT_SV(&_1$$7, "AUTO_INCREMENT=", &autoIncrement); - zephir_array_append(&tableOptions, &_1$$7, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 866); - } + if (zephir_array_isset_string_fetch(&controller, &defaults, SL("controller"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultController"), &controller); } - ZEPHIR_OBS_VAR(&tableCollation); - if (zephir_array_isset_string_fetch(&tableCollation, &options, SL("TABLE_COLLATION"), 0)) { - if (zephir_is_true(&tableCollation)) { - ZEPHIR_INIT_VAR(&collationParts); - zephir_fast_explode_str(&collationParts, SL("_"), &tableCollation, LONG_MAX); - zephir_array_fetch_long(&_2$$9, &collationParts, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect/Mysql.zep", 876); - ZEPHIR_INIT_VAR(&_3$$9); - ZEPHIR_CONCAT_SV(&_3$$9, "DEFAULT CHARSET=", &_2$$9); - zephir_array_append(&tableOptions, &_3$$9, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 876); - ZEPHIR_INIT_VAR(&_4$$9); - ZEPHIR_CONCAT_SV(&_4$$9, "COLLATE=", &tableCollation); - zephir_array_append(&tableOptions, &_4$$9, PH_SEPARATE, "phalcon/Db/Dialect/Mysql.zep", 877); - } + if (zephir_array_isset_string_fetch(&action, &defaults, SL("action"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultAction"), &action); } - zephir_fast_join_str(return_value, SL(" "), &tableOptions); - RETURN_MM(); + if (zephir_array_isset_string_fetch(¶ms, &defaults, SL("params"), 1)) { + zephir_update_property_zval(this_ptr, ZEND_STRL("defaultParams"), ¶ms); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, checkColumnSizeAndScale) +static PHP_METHOD(Phalcon_Mvc_Router, setEventsManager) +{ + zval *eventsManager, eventsManager_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&eventsManager_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); +} + +static PHP_METHOD(Phalcon_Mvc_Router, setKeyRouteNames) { - zval columnSql; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0, _1$$3, _2$$3, _3$$3, _4$$4, _5$$4; + zval *routeNames_param = NULL; + zval routeNames; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&columnSql); + ZVAL_UNDEF(&routeNames); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_ARRAY(routeNames) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 0, &routeNames_param); + zephir_get_arrval(&routeNames, routeNames_param); - ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_0)) { - ZEPHIR_CALL_METHOD(&_1$$3, column, "getsize", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_SV(&_2$$3, "(", &_1$$3); - zephir_concat_self(&columnSql, &_2$$3); - ZEPHIR_CALL_METHOD(&_3$$3, column, "getscale", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_3$$3)) { - ZEPHIR_CALL_METHOD(&_4$$4, column, "getscale", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_5$$4); - ZEPHIR_CONCAT_SVS(&_5$$4, ",", &_4$$4, ")"); - zephir_concat_self(&columnSql, &_5$$4); - } else { - zephir_concat_self_str(&columnSql, ")", sizeof(")") - 1); - } - } - RETURN_CTOR(&columnSql); + zephir_update_property_zval(this_ptr, ZEND_STRL("keyRouteNames"), &routeNames); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Mysql, checkColumnUnsigned) +static PHP_METHOD(Phalcon_Mvc_Router, setKeyRouteIds) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; + zval *routeIds_param = NULL; + zval routeIds; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&routeIds); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_ARRAY(routeIds) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 0, &routeIds_param); + zephir_get_arrval(&routeIds, routeIds_param); - ZEPHIR_CALL_METHOD(&_0, column, "isunsigned", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_0)) { - RETURN_MM_STRING(" UNSIGNED"); + zephir_update_property_zval(this_ptr, ZEND_STRL("keyRouteIds"), &routeIds); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Router, wasMatched) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "wasMatched"); +} + +zend_object *zephir_init_properties_Phalcon_Mvc_Router(zend_class_entry *class_type) +{ + zval _0, _2, _4, _6, _8, _10, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_11$$8); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("routes"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("matches"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("matches"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("keyRouteIds"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("keyRouteIds"), &_7$$6); + } + zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("keyRouteNames"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_8) == IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$7); + array_init(&_9$$7); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("keyRouteNames"), &_9$$7); + } + zephir_read_property_ex(&_10, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_10) == IS_NULL) { + ZEPHIR_INIT_VAR(&_11$$8); + array_init(&_11$$8); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("defaultParams"), &_11$$8); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - RETURN_MM_STRING(""); } @@ -50848,4182 +55991,4009 @@ static PHP_METHOD(Phalcon_Db_Dialect_Mysql, checkColumnUnsigned) -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Postgresql) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_RouterInterface) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Dialect, Postgresql, phalcon, db_dialect_postgresql, phalcon_db_dialect_ce, phalcon_db_dialect_postgresql_method_entry, 0); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, RouterInterface, phalcon, mvc_routerinterface, phalcon_mvc_routerinterface_method_entry); - zend_declare_property_string(phalcon_db_dialect_postgresql_ce, SL("escapeChar"), "\"", ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addColumn) +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, add); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addConnect); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addDelete); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addHead); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addGet); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addOptions); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addPatch); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addPost); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addPurge); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addPut); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, addTrace); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, attach); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, clear); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getActionName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getControllerName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getMatchedRoute); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getMatches); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getModuleName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getNamespaceName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getParams); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getRoutes); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getRouteById); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, getRouteByName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, handle); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, mount); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, setDefaultAction); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, setDefaultController); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, setDefaultModule); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, setDefaults); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_RouterInterface, wasMatched); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, Url, phalcon, mvc_url, phalcon_di_abstractinjectionaware_ce, phalcon_mvc_url_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_url_ce, SL("baseUri"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_url_ce, SL("basePath"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_url_ce, SL("router"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_url_ce, SL("staticBaseUri"), ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_mvc_url_ce, 1, phalcon_mvc_url_urlinterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Mvc_Url, __construct) +{ + zval *router = NULL, router_sub, __$null; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&router_sub); + ZVAL_NULL(&__$null); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(router, phalcon_mvc_routerinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(0, 1, &router); + if (!router) { + router = &router_sub; + router = &__$null; + } + + + zephir_update_property_zval(this_ptr, ZEND_STRL("router"), router); +} + +static PHP_METHOD(Phalcon_Mvc_Url, get) { + zval strUri, _16$$15; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, columnDefinition, _0, _1, _2, _3, _4, _7, _5$$3, _6$$3; - zval tableName, schemaName, sql; + zend_bool local, _0$$3, _1$$3, _20$$16; + zval *uri = NULL, uri_sub, *args = NULL, args_sub, *local_param = NULL, *baseUri = NULL, baseUri_sub, __$null, router, container, routeName, route, queryString, _2$$4, _3$$4, _4$$4, _5$$4, _6$$9, _11$$9, _14$$9, _15$$9, _7$$11, _8$$11, _9$$11, _10$$11, _12$$14, _13$$14, _17$$15, _18$$15, _19$$15, _21$$17, _22$$17, _23$$18, _24$$19; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&columnDefinition); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&uri_sub); + ZVAL_UNDEF(&args_sub); + ZVAL_UNDEF(&baseUri_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&router); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&routeName); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&queryString); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$9); + ZVAL_UNDEF(&_11$$9); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_15$$9); + ZVAL_UNDEF(&_7$$11); + ZVAL_UNDEF(&_8$$11); + ZVAL_UNDEF(&_9$$11); + ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&_12$$14); + ZVAL_UNDEF(&_13$$14); + ZVAL_UNDEF(&_17$$15); + ZVAL_UNDEF(&_18$$15); + ZVAL_UNDEF(&_19$$15); + ZVAL_UNDEF(&_21$$17); + ZVAL_UNDEF(&_22$$17); + ZVAL_UNDEF(&_23$$18); + ZVAL_UNDEF(&_24$$19); + ZVAL_UNDEF(&strUri); + ZVAL_UNDEF(&_16$$15); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(0, 4) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(uri) + Z_PARAM_ZVAL_OR_NULL(args) + Z_PARAM_BOOL_OR_NULL(local, is_null_true) + Z_PARAM_ZVAL_OR_NULL(baseUri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + zephir_fetch_params(1, 0, 4, &uri, &args, &local_param, &baseUri); + if (!uri) { + uri = &uri_sub; + ZEPHIR_CPY_WRT(uri, &__$null); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_SEPARATE_PARAM(uri); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!args) { + args = &args_sub; + args = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!local_param) { + local = 0; } else { - ZEPHIR_INIT_VAR(&schemaName); + local = zephir_get_boolval(local_param); + } + if (!baseUri) { + baseUri = &baseUri_sub; + ZEPHIR_CPY_WRT(baseUri, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(baseUri); } - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SVS(&_1, "ALTER TABLE ", &_0, " ADD COLUMN "); - zephir_get_strval(&sql, &_1); - ZEPHIR_CALL_METHOD(&_2, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_SVSV(&_3, "\"", &_2, "\" ", &columnDefinition); - zephir_concat_self(&sql, &_3); - ZEPHIR_CALL_METHOD(&_4, column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_4)) { - ZEPHIR_CALL_METHOD(&_5$$3, this_ptr, "castdefault", NULL, 0, column); + if (local == 0) { + _0$$3 = Z_TYPE_P(uri) == IS_STRING; + if (_0$$3) { + _1$$3 = zephir_memnstr_str(uri, SL("//"), "phalcon/Mvc/Url.zep", 107); + if (!(_1$$3)) { + _1$$3 = zephir_memnstr_str(uri, SL(":"), "phalcon/Mvc/Url.zep", 107); + } + _0$$3 = _1$$3; + } + if (_0$$3) { + ZEPHIR_INIT_VAR(&_2$$4); + ZEPHIR_INIT_VAR(&_3$$4); + ZVAL_STRING(&_3$$4, "#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i"); + ZEPHIR_INIT_VAR(&_4$$4); + ZEPHIR_INIT_VAR(&_5$$4); + ZVAL_STRING(&_5$$4, "#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i"); + zephir_preg_match(&_4$$4, &_5$$4, uri, &_2$$4, 0, 0 , 0 ); + if (zephir_is_true(&_4$$4)) { + local = 0; + } else { + local = 1; + } + } else { + local = 1; + } + } + if (Z_TYPE_P(baseUri) != IS_STRING) { + ZEPHIR_CALL_METHOD(baseUri, this_ptr, "getbaseuri", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6$$3); - ZEPHIR_CONCAT_SV(&_6$$3, " DEFAULT ", &_5$$3); - zephir_concat_self(&sql, &_6$$3); } - ZEPHIR_CALL_METHOD(&_7, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_7)) { - zephir_concat_self_str(&sql, " NOT NULL", sizeof(" NOT NULL") - 1); - } else { - zephir_concat_self_str(&sql, " NULL", sizeof(" NULL") - 1); + if (Z_TYPE_P(uri) == IS_ARRAY) { + ZEPHIR_OBS_VAR(&routeName); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&routeName, uri, SL("for"), 0)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "It's necessary to define the route name with the parameter 'for'", "phalcon/Mvc/Url.zep", 126); + return; + } + zephir_read_property(&_6$$9, this_ptr, ZEND_STRL("router"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&router, &_6$$9); + if (UNEXPECTED(!zephir_is_true(&router))) { + zephir_read_property(&_7$$11, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_7$$11); + if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injection container is required to access the 'router' service", "phalcon/Mvc/Url.zep", 140); + return; + } + ZEPHIR_INIT_VAR(&_9$$11); + ZVAL_STRING(&_9$$11, "router"); + ZEPHIR_CALL_METHOD(&_8$$11, &container, "has", NULL, 0, &_9$$11); + zephir_check_call_status(); + if (UNEXPECTED(!zephir_is_true(&_8$$11))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injection container is required to access the 'router' service", "phalcon/Mvc/Url.zep", 146); + return; + } + ZEPHIR_INIT_NVAR(&_9$$11); + ZVAL_STRING(&_9$$11, "router"); + ZEPHIR_CALL_METHOD(&_10$$11, &container, "getshared", NULL, 0, &_9$$11); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&router, &_10$$11); + zephir_update_property_zval(this_ptr, ZEND_STRL("router"), &router); + } + ZEPHIR_CALL_METHOD(&_11$$9, &router, "getroutebyname", NULL, 0, &routeName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&route, &_11$$9); + if (UNEXPECTED(Z_TYPE_P(&route) != IS_OBJECT)) { + ZEPHIR_INIT_VAR(&_12$$14); + object_init_ex(&_12$$14, phalcon_mvc_url_exception_ce); + ZEPHIR_INIT_VAR(&_13$$14); + ZEPHIR_CONCAT_SVS(&_13$$14, "Cannot obtain a route using the name '", &routeName, "'"); + ZEPHIR_CALL_METHOD(NULL, &_12$$14, "__construct", NULL, 32, &_13$$14); + zephir_check_call_status(); + zephir_throw_exception_debug(&_12$$14, "phalcon/Mvc/Url.zep", 161); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_VAR(&_14$$9); + ZEPHIR_CALL_METHOD(&_11$$9, &route, "getpattern", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_15$$9, &route, "getreversedpaths", NULL, 0); + zephir_check_call_status(); + phalcon_replace_paths(&_14$$9, &_11$$9, &_15$$9, uri); + ZEPHIR_CPY_WRT(uri, &_14$$9); } - RETURN_CTOR(&sql); + if (local) { + zephir_cast_to_string(&_16$$15, uri); + ZEPHIR_CPY_WRT(&strUri, &_16$$15); + ZEPHIR_INIT_VAR(&_17$$15); + ZEPHIR_CONCAT_VV(&_17$$15, baseUri, &strUri); + ZEPHIR_INIT_VAR(&_18$$15); + ZVAL_STRING(&_18$$15, "#(?= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(reference, phalcon_db_referenceinterface_ce) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(uri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + zephir_fetch_params(1, 0, 1, &uri); + if (!uri) { + uri = &uri_sub; + uri = &__$null; } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SVS(&_1, "ALTER TABLE ", &_0, " ADD"); - zephir_get_strval(&sql, &_1); - ZEPHIR_CALL_METHOD(&_2, reference, "getname", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_2)) { - ZEPHIR_CALL_METHOD(&_3$$3, reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4$$3); - ZEPHIR_CONCAT_SVS(&_4$$3, " CONSTRAINT \"", &_3$$3, "\""); - zephir_concat_self(&sql, &_4$$3); - } - ZEPHIR_CALL_METHOD(&_6, reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7, reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_9, reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8, this_ptr, "getcolumnlist", NULL, 54, &_9); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_10); - ZEPHIR_CONCAT_SVSSVSVS(&_10, " FOREIGN KEY (", &_5, ")", " REFERENCES \"", &_7, "\" (", &_8, ")"); - zephir_concat_self(&sql, &_10); - ZEPHIR_CALL_METHOD(&onDelete, reference, "getondelete", NULL, 0); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getstaticbaseuri", NULL, 0); zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_VAR(&_11$$4); - ZEPHIR_CONCAT_SV(&_11$$4, " ON DELETE ", &onDelete); - zephir_concat_self(&sql, &_11$$4); - } - ZEPHIR_CALL_METHOD(&onUpdate, reference, "getonupdate", NULL, 0); + ZVAL_NULL(&_1); + ZVAL_NULL(&_2); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "get", NULL, 0, uri, &_1, &_2, &_0); zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_VAR(&_12$$5); - ZEPHIR_CONCAT_SV(&_12$$5, " ON UPDATE ", &onUpdate); - zephir_concat_self(&sql, &_12$$5); - } - RETURN_CTOR(&sql); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addIndex) +static PHP_METHOD(Phalcon_Mvc_Url, getStaticBaseUri) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, indexType, _0, _2, _3, _4, _5, _6, _7, _1$$4; - zval tableName, schemaName, sql; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&indexType); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_1$$4); + + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("staticBaseUri"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) != IS_NULL) { + RETURN_MM_MEMBER(getThis(), "staticBaseUri"); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getbaseuri", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Url, setBasePath) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *basePath_param = NULL; + zval basePath; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&basePath); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(basePath) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &basePath_param); + if (UNEXPECTED(Z_TYPE_P(basePath_param) != IS_STRING && Z_TYPE_P(basePath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'basePath' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(basePath_param) == IS_STRING)) { + zephir_get_strval(&basePath, basePath_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&basePath); } - ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_STRING_IDENTICAL(&_0, "PRIMARY")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addprimarykey", NULL, 0, &tableName, &schemaName, index); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, "CREATE"); - ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_INIT_VAR(&_1$$4); - ZEPHIR_CONCAT_SV(&_1$$4, " ", &indexType); - zephir_concat_self(&sql, &_1$$4); - } - ZEPHIR_CALL_METHOD(&_2, index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_SVSV(&_4, " INDEX \"", &_2, "\" ON ", &_3); - zephir_concat_self(&sql, &_4); - ZEPHIR_CALL_METHOD(&_6, index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_7); - ZEPHIR_CONCAT_SVS(&_7, " (", &_5, ")"); - zephir_concat_self(&sql, &_7); - RETURN_CTOR(&sql); + zephir_update_property_zval(this_ptr, ZEND_STRL("basePath"), &basePath); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Url, setBaseUri) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, _0, _1, _2; - zval tableName, schemaName; + zval *baseUri_param = NULL, _0; + zval baseUri; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&baseUri); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(baseUri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &baseUri_param); + if (UNEXPECTED(Z_TYPE_P(baseUri_param) != IS_STRING && Z_TYPE_P(baseUri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'baseUri' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(baseUri_param) == IS_STRING)) { + zephir_get_strval(&baseUri, baseUri_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&baseUri); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 54, &_2); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVSVS(return_value, "ALTER TABLE ", &_0, " ADD CONSTRAINT \"", &tableName, "_PRIMARY\" PRIMARY KEY (", &_1, ")"); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("baseUri"), &baseUri); + zephir_read_property(&_0, this_ptr, ZEND_STRL("staticBaseUri"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + zephir_update_property_zval(this_ptr, ZEND_STRL("staticBaseUri"), &baseUri); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) +static PHP_METHOD(Phalcon_Mvc_Url, setStaticBaseUri) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition, createLines, primaryColumns; - zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, temporary, options, table, columns, column, indexes, index, reference, references, indexName, indexType, onDelete, onUpdate, columnDefinition, *_2, _3, _82, _83, _0$$5, _1$$6, _5$$7, _6$$7, _7$$7, _11$$7, _12$$7, _14$$7, _8$$8, _10$$8, _13$$11, _15$$12, _16$$12, _17$$12, _18$$13, _19$$13, _20$$13, _23$$13, _24$$13, _26$$13, _21$$14, _22$$14, _25$$17, _27$$18, _28$$18, _29$$18, _30$$19, _31$$19, *_32$$20, _33$$20, _34$$22, _35$$22, _36$$22, _37$$24, _38$$24, _39$$24, _40$$25, _41$$25, _42$$25, _43$$25, _44$$25, _45$$25, _46$$28, _47$$28, _48$$28, _49$$30, _50$$30, _51$$30, _52$$31, _53$$31, _54$$31, _55$$31, _56$$31, _57$$31, *_58$$33, _59$$33, _60$$34, _61$$34, _62$$34, _63$$34, _64$$34, _65$$34, _66$$34, _67$$34, _68$$34, _69$$35, _70$$36, _71$$37, _72$$37, _73$$37, _74$$37, _75$$37, _76$$37, _77$$37, _78$$37, _79$$37, _80$$38, _81$$39, _84$$40, _85$$40; - zval tableName, schemaName, indexSql, indexSqlAfterCreate, columnLine, referenceSql, sql, _86; + zval *staticBaseUri_param = NULL; + zval staticBaseUri; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexSql); - ZVAL_UNDEF(&indexSqlAfterCreate); - ZVAL_UNDEF(&columnLine); - ZVAL_UNDEF(&referenceSql); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&_86); - ZVAL_UNDEF(&temporary); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&indexName); - ZVAL_UNDEF(&indexType); - ZVAL_UNDEF(&onDelete); - ZVAL_UNDEF(&onUpdate); - ZVAL_UNDEF(&columnDefinition); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_82); - ZVAL_UNDEF(&_83); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_8$$8); - ZVAL_UNDEF(&_10$$8); - ZVAL_UNDEF(&_13$$11); - ZVAL_UNDEF(&_15$$12); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$13); - ZVAL_UNDEF(&_19$$13); - ZVAL_UNDEF(&_20$$13); - ZVAL_UNDEF(&_23$$13); - ZVAL_UNDEF(&_24$$13); - ZVAL_UNDEF(&_26$$13); - ZVAL_UNDEF(&_21$$14); - ZVAL_UNDEF(&_22$$14); - ZVAL_UNDEF(&_25$$17); - ZVAL_UNDEF(&_27$$18); - ZVAL_UNDEF(&_28$$18); - ZVAL_UNDEF(&_29$$18); - ZVAL_UNDEF(&_30$$19); - ZVAL_UNDEF(&_31$$19); - ZVAL_UNDEF(&_33$$20); - ZVAL_UNDEF(&_34$$22); - ZVAL_UNDEF(&_35$$22); - ZVAL_UNDEF(&_36$$22); - ZVAL_UNDEF(&_37$$24); - ZVAL_UNDEF(&_38$$24); - ZVAL_UNDEF(&_39$$24); - ZVAL_UNDEF(&_40$$25); - ZVAL_UNDEF(&_41$$25); - ZVAL_UNDEF(&_42$$25); - ZVAL_UNDEF(&_43$$25); - ZVAL_UNDEF(&_44$$25); - ZVAL_UNDEF(&_45$$25); - ZVAL_UNDEF(&_46$$28); - ZVAL_UNDEF(&_47$$28); - ZVAL_UNDEF(&_48$$28); - ZVAL_UNDEF(&_49$$30); - ZVAL_UNDEF(&_50$$30); - ZVAL_UNDEF(&_51$$30); - ZVAL_UNDEF(&_52$$31); - ZVAL_UNDEF(&_53$$31); - ZVAL_UNDEF(&_54$$31); - ZVAL_UNDEF(&_55$$31); - ZVAL_UNDEF(&_56$$31); - ZVAL_UNDEF(&_57$$31); - ZVAL_UNDEF(&_59$$33); - ZVAL_UNDEF(&_60$$34); - ZVAL_UNDEF(&_61$$34); - ZVAL_UNDEF(&_62$$34); - ZVAL_UNDEF(&_63$$34); - ZVAL_UNDEF(&_64$$34); - ZVAL_UNDEF(&_65$$34); - ZVAL_UNDEF(&_66$$34); - ZVAL_UNDEF(&_67$$34); - ZVAL_UNDEF(&_68$$34); - ZVAL_UNDEF(&_69$$35); - ZVAL_UNDEF(&_70$$36); - ZVAL_UNDEF(&_71$$37); - ZVAL_UNDEF(&_72$$37); - ZVAL_UNDEF(&_73$$37); - ZVAL_UNDEF(&_74$$37); - ZVAL_UNDEF(&_75$$37); - ZVAL_UNDEF(&_76$$37); - ZVAL_UNDEF(&_77$$37); - ZVAL_UNDEF(&_78$$37); - ZVAL_UNDEF(&_79$$37); - ZVAL_UNDEF(&_80$$38); - ZVAL_UNDEF(&_81$$39); - ZVAL_UNDEF(&_84$$40); - ZVAL_UNDEF(&_85$$40); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&createLines); - ZVAL_UNDEF(&primaryColumns); + ZVAL_UNDEF(&staticBaseUri); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(staticBaseUri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &staticBaseUri_param); + if (UNEXPECTED(Z_TYPE_P(staticBaseUri_param) != IS_STRING && Z_TYPE_P(staticBaseUri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'staticBaseUri' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(staticBaseUri_param) == IS_STRING)) { + zephir_get_strval(&staticBaseUri, staticBaseUri_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&staticBaseUri); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/Db/Dialect/Postgresql.zep", 134); - return; - } - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&temporary); - ZVAL_BOOL(&temporary, 0); - ZEPHIR_OBS_VAR(&options); - if (zephir_array_isset_string_fetch(&options, &definition, SL("options"), 0)) { - ZEPHIR_OBS_NVAR(&temporary); - zephir_array_isset_string_fetch(&temporary, &options, SL("temporary"), 0); - } - if (zephir_is_true(&temporary)) { - ZEPHIR_INIT_VAR(&_0$$5); - ZEPHIR_CONCAT_SVS(&_0$$5, "CREATE TEMPORARY TABLE ", &table, " (\n\t"); - zephir_get_strval(&sql, &_0$$5); - } else { - ZEPHIR_INIT_VAR(&_1$$6); - ZEPHIR_CONCAT_SVS(&_1$$6, "CREATE TABLE ", &table, " (\n\t"); - zephir_get_strval(&sql, &_1$$6); - } - ZEPHIR_INIT_VAR(&indexSqlAfterCreate); - ZEPHIR_INIT_VAR(&createLines); - array_init(&createLines); - ZEPHIR_INIT_VAR(&primaryColumns); - array_init(&primaryColumns); - zephir_is_iterable(&columns, 0, "phalcon/Db/Dialect/Postgresql.zep", 198); - if (Z_TYPE_P(&columns) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&columns), _2) - { - ZEPHIR_INIT_NVAR(&column); - ZVAL_COPY(&column, _2); - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", &_4, 0, &column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$7, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_6$$7); - ZEPHIR_CONCAT_SVSV(&_6$$7, "\"", &_5$$7, "\" ", &columnDefinition); - zephir_get_strval(&columnLine, &_6$$7); - ZEPHIR_CALL_METHOD(&_7$$7, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_7$$7)) { - ZEPHIR_CALL_METHOD(&_8$$8, this_ptr, "castdefault", &_9, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_10$$8); - ZEPHIR_CONCAT_SV(&_10$$8, " DEFAULT ", &_8$$8); - zephir_concat_self(&columnLine, &_10$$8); - } - ZEPHIR_CALL_METHOD(&_11$$7, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_11$$7)) { - zephir_concat_self_str(&columnLine, " NOT NULL", sizeof(" NOT NULL") - 1); - } else { - zephir_concat_self_str(&columnLine, " NULL", sizeof(" NULL") - 1); - } - ZEPHIR_CALL_METHOD(&_12$$7, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_12$$7)) { - ZEPHIR_CALL_METHOD(&_13$$11, &column, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_append(&primaryColumns, &_13$$11, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 185); - } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 188); - ZEPHIR_CALL_METHOD(&_14$$7, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_14$$7)) { - ZEPHIR_CALL_METHOD(&_15$$12, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_16$$12, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_17$$12); - ZEPHIR_CONCAT_SVSVSVS(&_17$$12, " COMMENT ON COLUMN ", &table, ".\"", &_15$$12, "\" IS '", &_16$$12, "';"); - zephir_concat_self(&indexSqlAfterCreate, &_17$$12); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &columns, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &columns, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", &_4, 0, &column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_18$$13, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_19$$13); - ZEPHIR_CONCAT_SVSV(&_19$$13, "\"", &_18$$13, "\" ", &columnDefinition); - zephir_get_strval(&columnLine, &_19$$13); - ZEPHIR_CALL_METHOD(&_20$$13, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_20$$13)) { - ZEPHIR_CALL_METHOD(&_21$$14, this_ptr, "castdefault", &_9, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_22$$14); - ZEPHIR_CONCAT_SV(&_22$$14, " DEFAULT ", &_21$$14); - zephir_concat_self(&columnLine, &_22$$14); - } - ZEPHIR_CALL_METHOD(&_23$$13, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_23$$13)) { - zephir_concat_self_str(&columnLine, " NOT NULL", sizeof(" NOT NULL") - 1); - } else { - zephir_concat_self_str(&columnLine, " NULL", sizeof(" NULL") - 1); - } - ZEPHIR_CALL_METHOD(&_24$$13, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_24$$13)) { - ZEPHIR_CALL_METHOD(&_25$$17, &column, "getname", NULL, 0); - zephir_check_call_status(); - zephir_array_append(&primaryColumns, &_25$$17, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 185); - } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 188); - ZEPHIR_CALL_METHOD(&_26$$13, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_26$$13)) { - ZEPHIR_CALL_METHOD(&_27$$18, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_28$$18, &column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_29$$18); - ZEPHIR_CONCAT_SVSVSVS(&_29$$18, " COMMENT ON COLUMN ", &table, ".\"", &_27$$18, "\" IS '", &_28$$18, "';"); - zephir_concat_self(&indexSqlAfterCreate, &_29$$18); - } - ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&column); - if (!(ZEPHIR_IS_EMPTY(&primaryColumns))) { - ZEPHIR_CALL_METHOD(&_30$$19, this_ptr, "getcolumnlist", NULL, 54, &primaryColumns); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_31$$19); - ZEPHIR_CONCAT_SVS(&_31$$19, "PRIMARY KEY (", &_30$$19, ")"); - zephir_array_append(&createLines, &_31$$19, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 199); - } - ZEPHIR_OBS_VAR(&indexes); - if (zephir_array_isset_string_fetch(&indexes, &definition, SL("indexes"), 0)) { - zephir_is_iterable(&indexes, 0, "phalcon/Db/Dialect/Postgresql.zep", 227); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&indexes), _32$$20) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _32$$20); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&indexSql); - if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { - ZEPHIR_CALL_METHOD(&_35$$22, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_34$$22, this_ptr, "getcolumnlist", NULL, 54, &_35$$22); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_36$$22); - ZEPHIR_CONCAT_SVS(&_36$$22, "CONSTRAINT \"PRIMARY\" PRIMARY KEY (", &_34$$22, ")"); - zephir_get_strval(&indexSql, &_36$$22); - } else { - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_CALL_METHOD(&_38$$24, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_37$$24, this_ptr, "getcolumnlist", NULL, 54, &_38$$24); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_39$$24); - ZEPHIR_CONCAT_SVSVSVS(&_39$$24, "CONSTRAINT \"", &indexName, "\" ", &indexType, " (", &_37$$24, ")"); - zephir_get_strval(&indexSql, &_39$$24); - } else { - ZEPHIR_CALL_METHOD(&_40$$25, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_41$$25, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_42$$25); - ZEPHIR_CONCAT_SVSV(&_42$$25, "CREATE INDEX \"", &_40$$25, "\" ON ", &_41$$25); - zephir_concat_self(&indexSqlAfterCreate, &_42$$25); - ZEPHIR_CALL_METHOD(&_44$$25, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_43$$25, this_ptr, "getcolumnlist", NULL, 54, &_44$$25); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_45$$25); - ZEPHIR_CONCAT_SVS(&_45$$25, " (", &_43$$25, ");"); - zephir_concat_self(&indexSqlAfterCreate, &_45$$25); - } - } - if (!(ZEPHIR_IS_EMPTY(&indexSql))) { - zephir_array_append(&createLines, &indexSql, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 224); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_33$$20, &indexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_33$$20)) { - break; - } - ZEPHIR_CALL_METHOD(&index, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&indexSql); - if (ZEPHIR_IS_STRING(&indexName, "PRIMARY")) { - ZEPHIR_CALL_METHOD(&_47$$28, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_46$$28, this_ptr, "getcolumnlist", NULL, 54, &_47$$28); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_48$$28); - ZEPHIR_CONCAT_SVS(&_48$$28, "CONSTRAINT \"PRIMARY\" PRIMARY KEY (", &_46$$28, ")"); - zephir_get_strval(&indexSql, &_48$$28); - } else { - if (!(ZEPHIR_IS_EMPTY(&indexType))) { - ZEPHIR_CALL_METHOD(&_50$$30, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_49$$30, this_ptr, "getcolumnlist", NULL, 54, &_50$$30); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_51$$30); - ZEPHIR_CONCAT_SVSVSVS(&_51$$30, "CONSTRAINT \"", &indexName, "\" ", &indexType, " (", &_49$$30, ")"); - zephir_get_strval(&indexSql, &_51$$30); - } else { - ZEPHIR_CALL_METHOD(&_52$$31, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_53$$31, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_54$$31); - ZEPHIR_CONCAT_SVSV(&_54$$31, "CREATE INDEX \"", &_52$$31, "\" ON ", &_53$$31); - zephir_concat_self(&indexSqlAfterCreate, &_54$$31); - ZEPHIR_CALL_METHOD(&_56$$31, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_55$$31, this_ptr, "getcolumnlist", NULL, 54, &_56$$31); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_57$$31); - ZEPHIR_CONCAT_SVS(&_57$$31, " (", &_55$$31, ");"); - zephir_concat_self(&indexSqlAfterCreate, &_57$$31); - } - } - if (!(ZEPHIR_IS_EMPTY(&indexSql))) { - zephir_array_append(&createLines, &indexSql, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 224); - } - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - } - ZEPHIR_OBS_VAR(&references); - if (zephir_array_isset_string_fetch(&references, &definition, SL("references"), 0)) { - zephir_is_iterable(&references, 0, "phalcon/Db/Dialect/Postgresql.zep", 255); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&references), _58$$33) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _58$$33); - ZEPHIR_CALL_METHOD(&_60$$34, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_62$$34, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_61$$34, this_ptr, "getcolumnlist", NULL, 54, &_62$$34); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_63$$34); - ZEPHIR_CONCAT_SVSVS(&_63$$34, "CONSTRAINT \"", &_60$$34, "\" FOREIGN KEY (", &_61$$34, ") REFERENCES "); - zephir_get_strval(&referenceSql, &_63$$34); - ZEPHIR_CALL_METHOD(&_65$$34, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_64$$34, this_ptr, "preparetable", NULL, 0, &_65$$34, &schemaName); - zephir_check_call_status(); - zephir_concat_self(&referenceSql, &_64$$34); - ZEPHIR_CALL_METHOD(&_67$$34, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_66$$34, this_ptr, "getcolumnlist", NULL, 54, &_67$$34); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_68$$34); - ZEPHIR_CONCAT_SVS(&_68$$34, " (", &_66$$34, ")"); - zephir_concat_self(&referenceSql, &_68$$34); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_69$$35); - ZEPHIR_CONCAT_SV(&_69$$35, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_69$$35); - } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_70$$36); - ZEPHIR_CONCAT_SV(&_70$$36, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_70$$36); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 253); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_59$$33, &references, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_59$$33)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &references, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_71$$37, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_73$$37, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_72$$37, this_ptr, "getcolumnlist", NULL, 54, &_73$$37); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_74$$37); - ZEPHIR_CONCAT_SVSVS(&_74$$37, "CONSTRAINT \"", &_71$$37, "\" FOREIGN KEY (", &_72$$37, ") REFERENCES "); - zephir_get_strval(&referenceSql, &_74$$37); - ZEPHIR_CALL_METHOD(&_76$$37, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_75$$37, this_ptr, "preparetable", NULL, 0, &_76$$37, &schemaName); - zephir_check_call_status(); - zephir_concat_self(&referenceSql, &_75$$37); - ZEPHIR_CALL_METHOD(&_78$$37, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_77$$37, this_ptr, "getcolumnlist", NULL, 54, &_78$$37); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_79$$37); - ZEPHIR_CONCAT_SVS(&_79$$37, " (", &_77$$37, ")"); - zephir_concat_self(&referenceSql, &_79$$37); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_80$$38); - ZEPHIR_CONCAT_SV(&_80$$38, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_80$$38); - } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_81$$39); - ZEPHIR_CONCAT_SV(&_81$$39, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_81$$39); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Postgresql.zep", 253); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reference); - } - ZEPHIR_INIT_VAR(&_82); - zephir_fast_join_str(&_82, SL(",\n\t"), &createLines); - ZEPHIR_INIT_VAR(&_83); - ZEPHIR_CONCAT_VS(&_83, &_82, "\n)"); - zephir_concat_self(&sql, &_83); - if (zephir_array_isset_string(&definition, SL("options"))) { - ZEPHIR_CALL_METHOD(&_84$$40, this_ptr, "gettableoptions", NULL, 0, &definition); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_85$$40); - ZEPHIR_CONCAT_SV(&_85$$40, " ", &_84$$40); - zephir_concat_self(&sql, &_85$$40); - } - ZEPHIR_INIT_VAR(&_86); - ZEPHIR_CONCAT_SV(&_86, ";", &indexSqlAfterCreate); - zephir_concat_self(&sql, &_86); - RETURN_CTOR(&sql); + zephir_update_property_zval(this_ptr, ZEND_STRL("staticBaseUri"), &staticBaseUri); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createView) +static PHP_METHOD(Phalcon_Mvc_Url, path) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, viewSql, _0; - zval viewName, schemaName; + zval *path_param = NULL, _0; + zval path; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&viewSql); + ZVAL_UNDEF(&path); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&definition); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(viewName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + Z_PARAM_STR_OR_NULL(path) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + zephir_fetch_params(1, 0, 1, &path_param); + if (!path_param) { + ZEPHIR_INIT_VAR(&path); } else { - zephir_get_strval(&schemaName, schemaName_param); + zephir_get_strval(&path, path_param); } - ZEPHIR_OBS_VAR(&viewSql); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&viewSql, &definition, SL("sql"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/Db/Dialect/Postgresql.zep", 276); - return; - } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSV(return_value, "CREATE VIEW ", &_0, " AS ", &viewSql); + zephir_read_property(&_0, this_ptr, ZEND_STRL("basePath"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CONCAT_VV(return_value, &_0, &path); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeColumns) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } - if (ZEPHIR_IS_NULL(&schema)) { - ZEPHIR_INIT_NVAR(&schema); - ZVAL_STRING(&schema, "public"); - } - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT DISTINCT c.column_name AS Field, c.data_type AS Type, c.character_maximum_length AS Size, c.numeric_precision AS NumericSize, c.numeric_scale AS NumericScale, c.is_nullable AS Null, CASE WHEN pkc.column_name NOTNULL THEN 'PRI' ELSE '' END AS Key, CASE WHEN c.data_type LIKE '%int%' AND c.column_default LIKE '%nextval%' THEN 'auto_increment' ELSE '' END AS Extra, c.ordinal_position AS Position, c.column_default, des.description FROM information_schema.columns c LEFT JOIN ( SELECT kcu.column_name, kcu.table_name, kcu.table_schema FROM information_schema.table_constraints tc INNER JOIN information_schema.key_column_usage kcu on (kcu.constraint_name = tc.constraint_name and kcu.table_name=tc.table_name and kcu.table_schema=tc.table_schema) WHERE tc.constraint_type='PRIMARY KEY') pkc ON (c.column_name=pkc.column_name AND c.table_schema = pkc.table_schema AND c.table_name=pkc.table_name) LEFT JOIN ( SELECT objsubid, description, relname, nspname FROM pg_description JOIN pg_class ON pg_description.objoid = pg_class.oid JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid ) des ON ( des.objsubid = C.ordinal_position AND C.table_schema = des.nspname AND C.TABLE_NAME = des.relname ) WHERE c.table_schema='", &schema, "' AND c.table_name='", &table, "' ORDER BY c.ordinal_position"); - RETURN_MM(); + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_View) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc, View, phalcon, mvc_view, phalcon_di_injectable_ce, phalcon_mvc_view_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_view_ce, SL("actionName"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("activeRenderPaths"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_view_ce, SL("basePath"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_view_ce, SL("content"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("controllerName"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_mvc_view_ce, SL("currentRenderLevel"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_view_ce, SL("disabled"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("disabledLevels"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_view_ce, SL("engines"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("layout"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_view_ce, SL("layoutsDir"), "", ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_view_ce, SL("mainView"), "index", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("options"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("params"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("pickView"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_view_ce, SL("partialsDir"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("registeredEngines"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_mvc_view_ce, SL("renderLevel"), 5, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("templatesAfter"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("templatesBefore"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("viewsDirs"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_view_ce, SL("viewParams"), ZEND_ACC_PROTECTED); + phalcon_mvc_view_ce->create_object = zephir_init_properties_Phalcon_Mvc_View; + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_ACTION_VIEW"), 1); + + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_BEFORE_TEMPLATE"), 2); + + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_LAYOUT"), 3); + + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_MAIN_LAYOUT"), 5); + + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_NO_RENDER"), 0); + + zephir_declare_class_constant_long(phalcon_mvc_view_ce, SL("LEVEL_AFTER_TEMPLATE"), 4); + + zend_class_implements(phalcon_mvc_view_ce, 1, phalcon_mvc_viewinterface_ce); + zend_class_implements(phalcon_mvc_view_ce, 1, phalcon_events_eventsawareinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_View, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zval *options_param = NULL; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + zephir_fetch_params(1, 0, 1, &options_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - zephir_get_strval(&schema, schema_param); + zephir_get_arrval(&options, options_param); } - ZEPHIR_CONCAT_SVS(return_value, "SELECT 0 as c0, t.relname as table_name, i.relname as key_name, 3 as c3, a.attname as column_name FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND a.attnum = ANY(ix.indkey) AND t.relkind = 'r' AND t.relname = '", &table, "' ORDER BY t.relname, i.relname;"); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeReferences) +static PHP_METHOD(Phalcon_Mvc_View, __get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *key_param = NULL; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&key); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 0, &key_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - zephir_get_strval(&schema, schema_param); + ZEPHIR_INIT_VAR(&key); } - if (ZEPHIR_IS_NULL(&schema)) { - ZEPHIR_INIT_NVAR(&schema); - ZVAL_STRING(&schema, "public"); - } - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT DISTINCT tc.table_name AS TABLE_NAME, kcu.column_name AS COLUMN_NAME, tc.constraint_name AS CONSTRAINT_NAME, tc.table_catalog AS REFERENCED_TABLE_SCHEMA, ccu.table_name AS REFERENCED_TABLE_NAME, ccu.column_name AS REFERENCED_COLUMN_NAME, rc.update_rule AS UPDATE_RULE, rc.delete_rule AS DELETE_RULE FROM information_schema.table_constraints AS tc JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name JOIN information_schema.referential_constraints rc ON tc.constraint_catalog = rc.constraint_catalog AND tc.constraint_schema = rc.constraint_schema AND tc.constraint_name = rc.constraint_name AND tc.constraint_type = 'FOREIGN KEY' WHERE constraint_type = 'FOREIGN KEY' AND tc.table_schema = '", &schema, "' AND tc.table_name='", &table, "'"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getvar", NULL, 0, &key); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropColumn) +static PHP_METHOD(Phalcon_Mvc_View, __isset) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL, _0; - zval tableName, schemaName, columnName; + zval *key_param = NULL, _0; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&columnName); + ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(columnName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &key_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(columnName_param) == IS_STRING)) { - zephir_get_strval(&columnName, columnName_param); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - ZEPHIR_INIT_VAR(&columnName); + ZEPHIR_INIT_VAR(&key); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP COLUMN \"", &columnName, "\""); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + RETURN_MM_BOOL(zephir_array_isset(&_0, &key)); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropForeignKey) +static PHP_METHOD(Phalcon_Mvc_View, __set) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL, _0; - zval tableName, schemaName, referenceName; + zval *key_param = NULL, *value, value_sub; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&referenceName); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(referenceName) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be of the type string")); + zephir_fetch_params(1, 2, 0, &key_param, &value); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(referenceName_param) == IS_STRING)) { - zephir_get_strval(&referenceName, referenceName_param); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - ZEPHIR_INIT_VAR(&referenceName); + ZEPHIR_INIT_VAR(&key); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvar", NULL, 0, &key, value); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP CONSTRAINT \"", &referenceName, "\""); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropIndex) +static PHP_METHOD(Phalcon_Mvc_View, cleanTemplateAfter) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL; - zval tableName, schemaName, indexName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(indexName) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(indexName_param) == IS_STRING)) { - zephir_get_strval(&indexName, indexName_param); - } else { - ZEPHIR_INIT_VAR(&indexName); - } - - ZEPHIR_CONCAT_SVS(return_value, "DROP INDEX \"", &indexName, "\""); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesAfter"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_View, cleanTemplateBefore) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, _0; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "ALTER TABLE ", &_0, " DROP CONSTRAINT \"", &tableName, "_PRIMARY\""); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesBefore"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropTable) +static PHP_METHOD(Phalcon_Mvc_View, disableLevel) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, table; - zval tableName, schemaName; + zval *level, level_sub, __$true; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&level_sub); + ZVAL_BOOL(&__$true, 1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(level) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + zephir_fetch_params_without_memory_grow(1, 0, &level); + + + if (Z_TYPE_P(level) == IS_ARRAY) { + zephir_update_property_zval(this_ptr, ZEND_STRL("disabledLevels"), level); } else { - zephir_get_strval(&schemaName, schemaName_param); + zephir_update_property_array(this_ptr, SL("disabledLevels"), level, &__$true); } - if (!ifExists_param) { - ifExists = 1; + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_View, disable) +{ + zval __$true, __$false; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + + + + if (1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$true); } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$false); } + RETURN_THISW(); +} +static PHP_METHOD(Phalcon_Mvc_View, enable) +{ + zval __$true, __$false; + zval *this_ptr = getThis(); - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE IF EXISTS ", &table); - RETURN_MM(); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + + + + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$false); } - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE ", &table); - RETURN_MM(); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropView) +static PHP_METHOD(Phalcon_Mvc_View, exists) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, view; - zval viewName, schemaName; + zval *view_param = NULL; + zval view; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); ZVAL_UNDEF(&view); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(view) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &view_param); + if (UNEXPECTED(Z_TYPE_P(view_param) != IS_STRING && Z_TYPE_P(view_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'view' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - if (!ifExists_param) { - ifExists = 1; + if (EXPECTED(Z_TYPE_P(view_param) == IS_STRING)) { + zephir_get_strval(&view, view_param); } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); + ZEPHIR_INIT_VAR(&view); } - ZEPHIR_CALL_METHOD(&view, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "has", NULL, 0, &view); zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW IF EXISTS ", &view); - RETURN_MM(); - } - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW ", &view); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) +static PHP_METHOD(Phalcon_Mvc_View, finish) { - zval valueSql$$38; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_12 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, columnType, columnSql, typeValues, _0$$4, _1$$9, _2$$15, _3$$20, _4$$33, _5$$36, _6$$36, _7$$36, value$$38, *_8$$38, _9$$38, _17$$38, _18$$38, _19$$38, _20$$38, _10$$39, _11$$39, _13$$39, _14$$40, _15$$40, _16$$40, _21$$41, _22$$41, _23$$41; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&columnSql); - ZVAL_UNDEF(&typeValues); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_1$$9); - ZVAL_UNDEF(&_2$$15); - ZVAL_UNDEF(&_3$$20); - ZVAL_UNDEF(&_4$$33); - ZVAL_UNDEF(&_5$$36); - ZVAL_UNDEF(&_6$$36); - ZVAL_UNDEF(&_7$$36); - ZVAL_UNDEF(&value$$38); - ZVAL_UNDEF(&_9$$38); - ZVAL_UNDEF(&_17$$38); - ZVAL_UNDEF(&_18$$38); - ZVAL_UNDEF(&_19$$38); - ZVAL_UNDEF(&_20$$38); - ZVAL_UNDEF(&_10$$39); - ZVAL_UNDEF(&_11$$39); - ZVAL_UNDEF(&_13$$39); - ZVAL_UNDEF(&_14$$40); - ZVAL_UNDEF(&_15$$40); - ZVAL_UNDEF(&_16$$40); - ZVAL_UNDEF(&_21$$41); - ZVAL_UNDEF(&_22$$41); - ZVAL_UNDEF(&_23$$41); - ZVAL_UNDEF(&valueSql$$38); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - ZEPHIR_CALL_METHOD(&columnSql, this_ptr, "checkcolumntypesql", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnType, this_ptr, "checkcolumntype", NULL, 0, column); + ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 490); zephir_check_call_status(); - do { - if (ZEPHIR_IS_LONG(&columnType, 14)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - ZEPHIR_CALL_METHOD(&_0$$4, column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_0$$4)) { - zephir_concat_self_str(&columnSql, SL("BIGSERIAL")); - } else { - zephir_concat_self_str(&columnSql, SL("BIGINT")); - } - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 8)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BOOLEAN")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 5)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("CHARACTER")); - } - ZEPHIR_CALL_METHOD(&_1$$9, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_1$$9); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 1)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DATE")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 4)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TIMESTAMP")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 3)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("NUMERIC")); - } - ZEPHIR_CALL_METHOD(&_2$$15, this_ptr, "getcolumnsizeandscale", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_2$$15); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 7)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("FLOAT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 0)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - ZEPHIR_CALL_METHOD(&_3$$20, column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_3$$20)) { - zephir_concat_self_str(&columnSql, SL("SERIAL")); - } else { - zephir_concat_self_str(&columnSql, SL("INT")); - } - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 22)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("SMALLINT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 15)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("JSON")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 16)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("JSONB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 17)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TIMESTAMP")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 6)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 2)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("CHARACTER VARYING")); - } - ZEPHIR_CALL_METHOD(&_4$$33, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_4$$33); - break; - } - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&columnSql))) { - ZEPHIR_INIT_VAR(&_5$$36); - object_init_ex(&_5$$36, phalcon_db_exception_ce); - ZEPHIR_CALL_METHOD(&_6$$36, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_7$$36); - ZEPHIR_CONCAT_SV(&_7$$36, "Unrecognized PostgreSQL data type at column ", &_6$$36); - ZEPHIR_CALL_METHOD(NULL, &_5$$36, "__construct", NULL, 29, &_7$$36); - zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$36, "phalcon/Db/Dialect/Postgresql.zep", 511); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&typeValues))) { - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&valueSql$$38); - zephir_is_iterable(&typeValues, 0, "phalcon/Db/Dialect/Postgresql.zep", 526); - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&typeValues), _8$$38) - { - ZEPHIR_INIT_NVAR(&value$$38); - ZVAL_COPY(&value$$38, _8$$38); - ZEPHIR_INIT_NVAR(&_10$$39); - ZVAL_STRING(&_10$$39, "\'"); - ZEPHIR_CALL_FUNCTION(&_11$$39, "addcslashes", &_12, 214, &value$$38, &_10$$39); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_13$$39); - ZEPHIR_CONCAT_SVS(&_13$$39, "'", &_11$$39, "', "); - zephir_concat_self(&valueSql$$38, &_13$$39); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &typeValues, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9$$38, &typeValues, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9$$38)) { - break; - } - ZEPHIR_CALL_METHOD(&value$$38, &typeValues, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_14$$40); - ZVAL_STRING(&_14$$40, "\'"); - ZEPHIR_CALL_FUNCTION(&_15$$40, "addcslashes", &_12, 214, &value$$38, &_14$$40); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_16$$40); - ZEPHIR_CONCAT_SVS(&_16$$40, "'", &_15$$40, "', "); - zephir_concat_self(&valueSql$$38, &_16$$40); - ZEPHIR_CALL_METHOD(NULL, &typeValues, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value$$38); - ZVAL_LONG(&_17$$38, 0); - ZVAL_LONG(&_18$$38, -2); - ZEPHIR_INIT_VAR(&_19$$38); - zephir_substr(&_19$$38, &valueSql$$38, 0 , -2 , 0); - ZEPHIR_INIT_VAR(&_20$$38); - ZEPHIR_CONCAT_SVS(&_20$$38, "(", &_19$$38, ")"); - zephir_concat_self(&columnSql, &_20$$38); - } else { - ZEPHIR_INIT_VAR(&_21$$41); - ZVAL_STRING(&_21$$41, "\'"); - ZEPHIR_CALL_FUNCTION(&_22$$41, "addcslashes", &_12, 214, &typeValues, &_21$$41); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_23$$41); - ZEPHIR_CONCAT_SVS(&_23$$41, "('", &_22$$41, "')"); - zephir_concat_self(&columnSql, &_23$$41); - } - } - } while(0); + RETURN_THIS(); +} - RETURN_CCTOR(&columnSql); +static PHP_METHOD(Phalcon_Mvc_View, getActionName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "actionName"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, listTables) +static PHP_METHOD(Phalcon_Mvc_View, getActiveRenderPath) { + zend_bool _1$$3; + zval activeRenderPath, _0, _2$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; + zend_long ZEPHIR_LAST_CALL_STATUS, viewsDirsCount = 0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&activeRenderPath); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$4); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getviewsdirs", NULL, 0); + zephir_check_call_status(); + viewsDirsCount = zephir_fast_count_int(&_0); + ZEPHIR_OBS_VAR(&activeRenderPath); + zephir_read_property(&activeRenderPath, this_ptr, ZEND_STRL("activeRenderPaths"), PH_NOISY_CC); + if (viewsDirsCount == 1) { + _1$$3 = Z_TYPE_P(&activeRenderPath) == IS_ARRAY; + if (_1$$3) { + _1$$3 = ((zephir_fast_count_int(&activeRenderPath)) ? 1 : 0); + } + if (_1$$3) { + zephir_array_fetch_long(&_2$$4, &activeRenderPath, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/View.zep", 339); + ZEPHIR_CPY_WRT(&activeRenderPath, &_2$$4); + } + } + if (Z_TYPE_P(&activeRenderPath) == IS_NULL) { + ZEPHIR_INIT_NVAR(&activeRenderPath); + ZVAL_STRING(&activeRenderPath, ""); } + RETURN_CCTOR(&activeRenderPath); +} +static PHP_METHOD(Phalcon_Mvc_View, getBasePath) +{ + zval *this_ptr = getThis(); - if (ZEPHIR_IS_NULL(&schemaName)) { - ZEPHIR_INIT_NVAR(&schemaName); - ZVAL_STRING(&schemaName, "public"); - } - ZEPHIR_CONCAT_SVS(return_value, "SELECT table_name FROM information_schema.tables WHERE table_schema = '", &schemaName, "' ORDER BY table_name"); - RETURN_MM(); + + + RETURN_MEMBER(getThis(), "basePath"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, listViews) +static PHP_METHOD(Phalcon_Mvc_View, getContent) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } + RETURN_MEMBER(getThis(), "content"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getControllerName) +{ + zval *this_ptr = getThis(); - if (ZEPHIR_IS_NULL(&schemaName)) { - ZEPHIR_INIT_NVAR(&schemaName); - ZVAL_STRING(&schemaName, "public"); - } - ZEPHIR_CONCAT_SVS(return_value, "SELECT viewname AS view_name FROM pg_views WHERE schemaname = '", &schemaName, "' ORDER BY view_name"); - RETURN_MM(); + + RETURN_MEMBER(getThis(), "controllerName"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, modifyColumn) +static PHP_METHOD(Phalcon_Mvc_View, getCurrentRenderLevel) { - zend_bool _26$$10; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, *currentColumn = NULL, currentColumn_sub, __$null, defaultValue, columnDefinition, _0, _1, _2, _3, _7, _8, _11, _12, _18, _23, _24, _4$$4, _5$$4, _6$$4, _9$$5, _10$$5, _13$$6, _14$$7, _15$$7, _16$$8, _17$$8, _19$$9, _20$$9, _21$$9, _22$$9, _25$$10, _27$$10, _30$$10, _28$$11, _29$$11, _31$$12, _32$$13, _33$$13, _34$$14, _35$$14; - zval tableName, schemaName, sql, sqlAlterTable; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&sqlAlterTable); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(¤tColumn_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&columnDefinition); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_8); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_18); - ZVAL_UNDEF(&_23); - ZVAL_UNDEF(&_24); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_13$$6); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_15$$7); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_19$$9); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&_21$$9); - ZVAL_UNDEF(&_22$$9); - ZVAL_UNDEF(&_25$$10); - ZVAL_UNDEF(&_27$$10); - ZVAL_UNDEF(&_30$$10); - ZVAL_UNDEF(&_28$$11); - ZVAL_UNDEF(&_29$$11); - ZVAL_UNDEF(&_31$$12); - ZVAL_UNDEF(&_32$$13); - ZVAL_UNDEF(&_33$$13); - ZVAL_UNDEF(&_34$$14); - ZVAL_UNDEF(&_35$$14); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(currentColumn, phalcon_db_columninterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!currentColumn) { - currentColumn = ¤tColumn_sub; - ZEPHIR_CPY_WRT(currentColumn, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(currentColumn); - } + RETURN_MEMBER(getThis(), "currentRenderLevel"); +} +static PHP_METHOD(Phalcon_Mvc_View, getRegisteredEngines) +{ + zval *this_ptr = getThis(); - ZEPHIR_INIT_VAR(&sql); - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SV(&_1, "ALTER TABLE ", &_0); - zephir_get_strval(&sqlAlterTable, &_1); - if (Z_TYPE_P(currentColumn) != IS_OBJECT) { - ZEPHIR_CPY_WRT(currentColumn, column); - } - ZEPHIR_CALL_METHOD(&_2, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, currentColumn, "getname", NULL, 0); - zephir_check_call_status(); - if (!ZEPHIR_IS_IDENTICAL(&_2, &_3)) { - ZEPHIR_CALL_METHOD(&_4$$4, currentColumn, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$4, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6$$4); - ZEPHIR_CONCAT_VSVSVS(&_6$$4, &sqlAlterTable, " RENAME COLUMN \"", &_4$$4, "\" TO \"", &_5$$4, "\";"); - zephir_concat_self(&sql, &_6$$4); - } - ZEPHIR_CALL_METHOD(&_7, column, "gettype", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_8, currentColumn, "gettype", NULL, 0); - zephir_check_call_status(); - if (!ZEPHIR_IS_IDENTICAL(&_7, &_8)) { - ZEPHIR_CALL_METHOD(&_9$$5, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_10$$5); - ZEPHIR_CONCAT_VSVSVS(&_10$$5, &sqlAlterTable, " ALTER COLUMN \"", &_9$$5, "\" TYPE ", &columnDefinition, ";"); - zephir_concat_self(&sql, &_10$$5); - } - ZEPHIR_CALL_METHOD(&_11, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_12, currentColumn, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (!ZEPHIR_IS_IDENTICAL(&_11, &_12)) { - ZEPHIR_CALL_METHOD(&_13$$6, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_13$$6)) { - ZEPHIR_CALL_METHOD(&_14$$7, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_15$$7); - ZEPHIR_CONCAT_VSVS(&_15$$7, &sqlAlterTable, " ALTER COLUMN \"", &_14$$7, "\" SET NOT NULL;"); - zephir_concat_self(&sql, &_15$$7); - } else { - ZEPHIR_CALL_METHOD(&_16$$8, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_17$$8); - ZEPHIR_CONCAT_VSVS(&_17$$8, &sqlAlterTable, " ALTER COLUMN \"", &_16$$8, "\" DROP NOT NULL;"); - zephir_concat_self(&sql, &_17$$8); - } - } - ZEPHIR_CALL_METHOD(&_18, column, "getcomment", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_18)) { - ZEPHIR_CALL_METHOD(&_19$$9, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_20$$9, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_21$$9, column, "getcomment", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_22$$9); - ZEPHIR_CONCAT_SVSVSVS(&_22$$9, "COMMENT ON COLUMN ", &_19$$9, ".\"", &_20$$9, "\" IS '", &_21$$9, "';"); - zephir_concat_self(&sql, &_22$$9); - } - ZEPHIR_CALL_METHOD(&_23, column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_24, currentColumn, "getdefault", NULL, 0); - zephir_check_call_status(); - if (!ZEPHIR_IS_IDENTICAL(&_23, &_24)) { - ZEPHIR_CALL_METHOD(&_25$$10, column, "getdefault", NULL, 0); - zephir_check_call_status(); - _26$$10 = ZEPHIR_IS_EMPTY(&_25$$10); - if (_26$$10) { - ZEPHIR_CALL_METHOD(&_27$$10, currentColumn, "getdefault", NULL, 0); - zephir_check_call_status(); - _26$$10 = !(ZEPHIR_IS_EMPTY(&_27$$10)); - } - if (_26$$10) { - ZEPHIR_CALL_METHOD(&_28$$11, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_29$$11); - ZEPHIR_CONCAT_VSVS(&_29$$11, &sqlAlterTable, " ALTER COLUMN \"", &_28$$11, "\" DROP DEFAULT;"); - zephir_concat_self(&sql, &_29$$11); - } - ZEPHIR_CALL_METHOD(&_30$$10, column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_30$$10)) { - ZEPHIR_CALL_METHOD(&defaultValue, this_ptr, "castdefault", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_31$$12); - zephir_fast_strtoupper(&_31$$12, &columnDefinition); - if (zephir_memnstr_str(&_31$$12, SL("BOOLEAN"), "phalcon/Db/Dialect/Postgresql.zep", 616)) { - ZEPHIR_CALL_METHOD(&_32$$13, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_33$$13); - ZEPHIR_CONCAT_SVSV(&_33$$13, " ALTER COLUMN \"", &_32$$13, "\" SET DEFAULT ", &defaultValue); - zephir_concat_self(&sql, &_33$$13); - } else { - ZEPHIR_CALL_METHOD(&_34$$14, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_35$$14); - ZEPHIR_CONCAT_VSVSV(&_35$$14, &sqlAlterTable, " ALTER COLUMN \"", &_34$$14, "\" SET DEFAULT ", &defaultValue); - zephir_concat_self(&sql, &_35$$14); - } - } - } - RETURN_CTOR(&sql); + + + RETURN_MEMBER(getThis(), "registeredEngines"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, sharedLock) +static PHP_METHOD(Phalcon_Mvc_View, getRenderLevel) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL; - zval sqlQuery; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - } + RETURN_MEMBER(getThis(), "renderLevel"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getEventsManager) +{ + zval *this_ptr = getThis(); - RETURN_CTOR(&sqlQuery); + + RETURN_MEMBER(getThis(), "eventsManager"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, tableExists) +static PHP_METHOD(Phalcon_Mvc_View, getLayout) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } + RETURN_MEMBER(getThis(), "layout"); +} +static PHP_METHOD(Phalcon_Mvc_View, getLayoutsDir) +{ + zval *this_ptr = getThis(); - if (ZEPHIR_IS_NULL(&schemaName)) { - ZEPHIR_INIT_NVAR(&schemaName); - ZVAL_STRING(&schemaName, "public"); - } - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM information_schema.tables WHERE table_schema = '", &schemaName, "' AND table_name='", &tableName, "'"); - RETURN_MM(); + + + RETURN_MEMBER(getThis(), "layoutsDir"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, tableOptions) +static PHP_METHOD(Phalcon_Mvc_View, getMainView) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "mainView"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getParamsToView) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "viewParams"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getPartial) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, params_sub, __$null; + zval partialPath; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&partialPath); + ZVAL_UNDEF(¶ms_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + Z_PARAM_STR(partialPath) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + if (UNEXPECTED(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(&partialPath, partialPath_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&partialPath); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); + if (!params) { + params = ¶ms_sub; + params = &__$null; } - RETURN_MM_STRING(""); + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 389); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "partial", NULL, 0, &partialPath, params); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 396); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, truncateTable) +static PHP_METHOD(Phalcon_Mvc_View, getPartialsDir) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "partialsDir"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getRender) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, table; - zval tableName, schemaName; + zval params, _1$$3; + zval *controllerName_param = NULL, *actionName_param = NULL, *params_param = NULL, *configCallback = NULL, configCallback_sub, __$null, view, _0$$3; + zval controllerName, actionName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&configCallback_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&view); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(controllerName) + Z_PARAM_STR(actionName) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(params) + Z_PARAM_ZVAL_OR_NULL(configCallback) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 2, 2, &controllerName_param, &actionName_param, ¶ms_param, &configCallback); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&controllerName); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(actionName_param) != IS_STRING && Z_TYPE_P(actionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(actionName_param) == IS_STRING)) { + zephir_get_strval(&actionName, actionName_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&actionName); + } + if (!params_param) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else { + zephir_get_arrval(¶ms, params_param); + } + if (!configCallback) { + configCallback = &configCallback_sub; + configCallback = &__$null; } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName); + ZEPHIR_INIT_VAR(&view); + if (zephir_clone(&view, this_ptr) == FAILURE) { + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(NULL, &view, "reset", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &view, "setvars", NULL, 0, ¶ms); + zephir_check_call_status(); + if (Z_TYPE_P(configCallback) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_0$$3); + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 1, 0); + zephir_array_fast_append(&_1$$3, &view); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_0$$3, configCallback, &_1$$3); zephir_check_call_status(); } - ZEPHIR_CONCAT_SV(return_value, "TRUNCATE TABLE ", &table); + ZEPHIR_CALL_METHOD(NULL, &view, "start", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &view, "render", NULL, 0, &controllerName, &actionName); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &view, "finish", NULL, 0); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&view, "getcontent", NULL, 0); + zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, viewExists) +static PHP_METHOD(Phalcon_Mvc_View, getVar) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *viewName_param = NULL, *schemaName_param = NULL; - zval viewName, schemaName; + zval *key_param = NULL, value, _0; + zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &key_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - ZEPHIR_INIT_VAR(&viewName); + ZEPHIR_INIT_VAR(&key); } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&value, &_0, &key, 1))) { + RETURN_MM_NULL(); } + RETURN_CTOR(&value); +} +static PHP_METHOD(Phalcon_Mvc_View, getViewsDir) +{ + zval *this_ptr = getThis(); - if (ZEPHIR_IS_NULL(&schemaName)) { - ZEPHIR_INIT_NVAR(&schemaName); - ZVAL_STRING(&schemaName, "public"); + + + RETURN_MEMBER(getThis(), "viewsDirs"); +} + +static PHP_METHOD(Phalcon_Mvc_View, getViewsDirs) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("viewsDirs"), PH_NOISY_CC); + if (Z_TYPE_P(&_0) == IS_STRING) { + zephir_create_array(return_value, 1, 0); + ZEPHIR_OBS_VAR(&_1$$3); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("viewsDirs"), PH_NOISY_CC); + zephir_array_fast_append(return_value, &_1$$3); + RETURN_MM(); } - ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM pg_views WHERE viewname='", &viewName, "' AND schemaname='", &schemaName, "'"); - RETURN_MM(); + RETURN_MM_MEMBER(getThis(), "viewsDirs"); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, castDefault) +static PHP_METHOD(Phalcon_Mvc_View, has) { - zend_bool _2, _3, _4, _5; - zval preparedValue, _6$$5; + zend_string *_9$$4, *_16$$9; + zend_ulong _8$$4, _15$$9; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, defaultValue, columnDefinition, columnType, _0, _1, _7$$6, _8$$6, _9$$6; + zval *view_param = NULL, basePath, viewsDir, engines, extension, _0, _2, *_3, _4, _1$$3, _5$$4, *_6$$4, _7$$4, _10$$5, _11$$7, _12$$9, *_13$$9, _14$$9, _17$$10, _18$$12; + zval view; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&columnDefinition); - ZVAL_UNDEF(&columnType); + ZVAL_UNDEF(&view); + ZVAL_UNDEF(&basePath); + ZVAL_UNDEF(&viewsDir); + ZVAL_UNDEF(&engines); + ZVAL_UNDEF(&extension); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_9$$6); - ZVAL_UNDEF(&preparedValue); - ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_10$$5); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_12$$9); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_17$$10); + ZVAL_UNDEF(&_18$$12); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_STR(view) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 0, &view_param); + if (UNEXPECTED(Z_TYPE_P(view_param) != IS_STRING && Z_TYPE_P(view_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'view' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(view_param) == IS_STRING)) { + zephir_get_strval(&view, view_param); + } else { + ZEPHIR_INIT_VAR(&view); + } - ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("basePath"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&basePath, &_0); + ZEPHIR_OBS_VAR(&engines); + zephir_read_property(&engines, this_ptr, ZEND_STRL("registeredEngines"), PH_NOISY_CC); + if (ZEPHIR_IS_EMPTY(&engines)) { + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 1, 0); + add_assoc_stringl_ex(&_1$$3, SL(".phtml"), SL("Phalcon\\Mvc\\View\\Engine\\Php")); + ZEPHIR_CPY_WRT(&engines, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "registerengines", NULL, 0, &engines); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&_2, this_ptr, "getviewsdirs", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnDefinition, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnType, column, "gettype", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_fast_strtoupper(&_0, &columnDefinition); - if (zephir_memnstr_str(&_0, SL("BOOLEAN"), "phalcon/Db/Dialect/Postgresql.zep", 699)) { - RETURN_CCTOR(&defaultValue); - } - ZEPHIR_INIT_VAR(&_1); - zephir_fast_strtoupper(&_1, &defaultValue); - if (zephir_memnstr_str(&_1, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Postgresql.zep", 703)) { - RETURN_MM_STRING("CURRENT_TIMESTAMP"); + zephir_is_iterable(&_2, 0, "phalcon/Mvc/View.zep", 599); + if (Z_TYPE_P(&_2) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_2), _3) + { + ZEPHIR_INIT_NVAR(&viewsDir); + ZVAL_COPY(&viewsDir, _3); + ZEPHIR_INIT_NVAR(&_5$$4); + zephir_is_iterable(&engines, 0, "phalcon/Mvc/View.zep", 597); + if (Z_TYPE_P(&engines) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&engines), _8$$4, _9$$4, _6$$4) + { + ZEPHIR_INIT_NVAR(&extension); + if (_9$$4 != NULL) { + ZVAL_STR_COPY(&extension, _9$$4); + } else { + ZVAL_LONG(&extension, _8$$4); + } + ZEPHIR_INIT_NVAR(&_5$$4); + ZVAL_COPY(&_5$$4, _6$$4); + ZEPHIR_INIT_NVAR(&_10$$5); + ZEPHIR_CONCAT_VVVV(&_10$$5, &basePath, &viewsDir, &view, &extension); + if ((zephir_file_exists(&_10$$5) == SUCCESS)) { + RETURN_MM_BOOL(1); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &engines, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_7$$4, &engines, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_7$$4)) { + break; + } + ZEPHIR_CALL_METHOD(&extension, &engines, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5$$4, &engines, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_11$$7); + ZEPHIR_CONCAT_VVVV(&_11$$7, &basePath, &viewsDir, &view, &extension); + if ((zephir_file_exists(&_11$$7) == SUCCESS)) { + RETURN_MM_BOOL(1); + } + ZEPHIR_CALL_METHOD(NULL, &engines, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_INIT_NVAR(&extension); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_2, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_4, &_2, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4)) { + break; + } + ZEPHIR_CALL_METHOD(&viewsDir, &_2, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_12$$9); + zephir_is_iterable(&engines, 0, "phalcon/Mvc/View.zep", 597); + if (Z_TYPE_P(&engines) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&engines), _15$$9, _16$$9, _13$$9) + { + ZEPHIR_INIT_NVAR(&extension); + if (_16$$9 != NULL) { + ZVAL_STR_COPY(&extension, _16$$9); + } else { + ZVAL_LONG(&extension, _15$$9); + } + ZEPHIR_INIT_NVAR(&_12$$9); + ZVAL_COPY(&_12$$9, _13$$9); + ZEPHIR_INIT_NVAR(&_17$$10); + ZEPHIR_CONCAT_VVVV(&_17$$10, &basePath, &viewsDir, &view, &extension); + if ((zephir_file_exists(&_17$$10) == SUCCESS)) { + RETURN_MM_BOOL(1); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &engines, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_14$$9, &engines, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_14$$9)) { + break; + } + ZEPHIR_CALL_METHOD(&extension, &engines, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$9, &engines, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_18$$12); + ZEPHIR_CONCAT_VVVV(&_18$$12, &basePath, &viewsDir, &view, &extension); + if ((zephir_file_exists(&_18$$12) == SUCCESS)) { + RETURN_MM_BOOL(1); + } + ZEPHIR_CALL_METHOD(NULL, &engines, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&_12$$9); + ZEPHIR_INIT_NVAR(&extension); + ZEPHIR_CALL_METHOD(NULL, &_2, "next", NULL, 0); + zephir_check_call_status(); + } } - _2 = ZEPHIR_IS_LONG_IDENTICAL(&columnType, 0); - if (!(_2)) { - _2 = ZEPHIR_IS_LONG_IDENTICAL(&columnType, 14); + ZEPHIR_INIT_NVAR(&viewsDir); + RETURN_MM_BOOL(0); +} + +static PHP_METHOD(Phalcon_Mvc_View, isDisabled) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "disabled"); +} + +static PHP_METHOD(Phalcon_Mvc_View, partial) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *partialPath_param = NULL, *params = NULL, params_sub, __$null, viewParams, _3, _4, _5, _6, _7, _0$$3, _1$$3, _2$$3; + zval partialPath; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&partialPath); + ZVAL_UNDEF(¶ms_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&viewParams); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(partialPath) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(params) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms); + if (UNEXPECTED(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be of the type string")); + RETURN_MM_NULL(); } - _3 = _2; - if (!(_3)) { - _3 = ZEPHIR_IS_LONG_IDENTICAL(&columnType, 3); + if (EXPECTED(Z_TYPE_P(partialPath_param) == IS_STRING)) { + zephir_get_strval(&partialPath, partialPath_param); + } else { + ZEPHIR_INIT_VAR(&partialPath); } - _4 = _3; - if (!(_4)) { - _4 = ZEPHIR_IS_LONG_IDENTICAL(&columnType, 7); + if (!params) { + params = ¶ms_sub; + params = &__$null; } - _5 = _4; - if (!(_5)) { - _5 = ZEPHIR_IS_LONG_IDENTICAL(&columnType, 9); + + + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&viewParams, &_0$$3); + ZEPHIR_INIT_VAR(&_1$$3); + zephir_fast_array_merge(&_1$$3, &viewParams, params); + zephir_update_property_zval(this_ptr, ZEND_STRL("viewParams"), &_1$$3); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CREATE_SYMBOL_TABLE(); + } - if (_5) { - zephir_cast_to_string(&_6$$5, &defaultValue); - ZEPHIR_CPY_WRT(&preparedValue, &_6$$5); - } else { - ZEPHIR_INIT_VAR(&_7$$6); - ZVAL_STRING(&_7$$6, "\'"); - ZEPHIR_CALL_FUNCTION(&_8$$6, "addcslashes", NULL, 214, &defaultValue, &_7$$6); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_9$$6); - ZEPHIR_CONCAT_SVS(&_9$$6, "'", &_8$$6, "'"); - zephir_get_strval(&preparedValue, &_9$$6); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "loadtemplateengines", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_4, this_ptr, ZEND_STRL("partialsDir"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_5); + ZEPHIR_CONCAT_VV(&_5, &_4, &partialPath); + ZVAL_BOOL(&_6, 0); + ZVAL_BOOL(&_7, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &_3, &_5, &_6, &_7); + zephir_check_call_status(); + if (Z_TYPE_P(params) == IS_ARRAY) { + zephir_update_property_zval(this_ptr, ZEND_STRL("viewParams"), &viewParams); } - RETURN_CTOR(&preparedValue); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getTableOptions) +static PHP_METHOD(Phalcon_Mvc_View, pick) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *definition_param = NULL; - zval definition; + zval *renderView, renderView_sub, pickView, layout, parts, _0$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&renderView_sub); + ZVAL_UNDEF(&pickView); + ZVAL_UNDEF(&layout); + ZVAL_UNDEF(&parts); + ZVAL_UNDEF(&_0$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(definition) + Z_PARAM_ZVAL(renderView) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &definition_param); - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + zephir_fetch_params(1, 1, 0, &renderView); - RETURN_MM_STRING(""); + if (Z_TYPE_P(renderView) == IS_ARRAY) { + ZEPHIR_CPY_WRT(&pickView, renderView); + } else { + ZEPHIR_INIT_VAR(&layout); + ZVAL_NULL(&layout); + if (zephir_memnstr_str(renderView, SL("/"), "phalcon/Mvc/View.zep", 701)) { + ZEPHIR_INIT_VAR(&parts); + zephir_fast_explode_str(&parts, SL("/"), renderView, LONG_MAX); + ZEPHIR_OBS_NVAR(&layout); + zephir_array_fetch_long(&layout, &parts, 0, PH_NOISY, "phalcon/Mvc/View.zep", 703); + } + ZEPHIR_INIT_VAR(&_0$$4); + zephir_create_array(&_0$$4, 1, 0); + zephir_array_fast_append(&_0$$4, renderView); + ZEPHIR_CPY_WRT(&pickView, &_0$$4); + if (Z_TYPE_P(&layout) != IS_NULL) { + zephir_array_append(&pickView, &layout, PH_SEPARATE, "phalcon/Mvc/View.zep", 709); + } + } + zephir_update_property_zval(this_ptr, ZEND_STRL("pickView"), &pickView); + RETURN_THIS(); } +static PHP_METHOD(Phalcon_Mvc_View, registerEngines) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *engines_param = NULL; + zval engines; + zval *this_ptr = getThis(); - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&engines); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(engines) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &engines_param); + ZEPHIR_OBS_COPY_OR_DUP(&engines, engines_param); - -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Sqlite) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Dialect, Sqlite, phalcon, db_dialect_sqlite, phalcon_db_dialect_ce, phalcon_db_dialect_sqlite_method_entry, 0); - - zend_declare_property_string(phalcon_db_dialect_sqlite_ce, SL("escapeChar"), "\"", ZEND_ACC_PROTECTED); - return SUCCESS; + zephir_update_property_zval(this_ptr, ZEND_STRL("registeredEngines"), &engines); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addColumn) +static PHP_METHOD(Phalcon_Mvc_View, render) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, defaultValue, _0, _1, _2, _3, _4, _5, _10, _11, _6$$3, _7$$5, _8$$5, _9$$5; - zval tableName, schemaName, sql; + zval params; + zval *controllerName_param = NULL, *actionName_param = NULL, *params_param = NULL, result; + zval controllerName, actionName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(¶ms); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(controllerName) + Z_PARAM_STR(actionName) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &controllerName_param, &actionName_param, ¶ms_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&controllerName); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(actionName_param) != IS_STRING && Z_TYPE_P(actionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(actionName_param) == IS_STRING)) { + zephir_get_strval(&actionName, actionName_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&actionName); + } + if (!params_param) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else { + zephir_get_arrval(¶ms, params_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SVS(&_1, "ALTER TABLE ", &_0, " ADD COLUMN "); - zephir_get_strval(&sql, &_1); - ZEPHIR_CALL_METHOD(&_2, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getcolumndefinition", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_SVSV(&_4, "\"", &_2, "\" ", &_3); - zephir_concat_self(&sql, &_4); - ZEPHIR_CALL_METHOD(&_5, column, "hasdefault", NULL, 0); + ZEPHIR_CALL_METHOD(&result, this_ptr, "processrender", NULL, 0, &controllerName, &actionName, ¶ms); zephir_check_call_status(); - if (zephir_is_true(&_5)) { - ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_6$$3); - zephir_fast_strtoupper(&_6$$3, &defaultValue); - if (zephir_memnstr_str(&_6$$3, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Sqlite.zep", 46)) { - zephir_concat_self_str(&sql, " DEFAULT CURRENT_TIMESTAMP", sizeof(" DEFAULT CURRENT_TIMESTAMP") - 1); - } else { - ZEPHIR_INIT_VAR(&_7$$5); - ZVAL_STRING(&_7$$5, "\""); - ZEPHIR_CALL_FUNCTION(&_8$$5, "addcslashes", NULL, 214, &defaultValue, &_7$$5); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_9$$5); - ZEPHIR_CONCAT_SVS(&_9$$5, " DEFAULT \"", &_8$$5, "\""); - zephir_concat_self(&sql, &_9$$5); - } + if (!(zephir_is_true(&result))) { + RETURN_MM_BOOL(0); } - ZEPHIR_CALL_METHOD(&_10, column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_10)) { - zephir_concat_self_str(&sql, " NOT NULL", sizeof(" NOT NULL") - 1); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, reset) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval __$true, __$false, __$null, _0, _1, _2; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + + + ZEPHIR_MM_GROW(); + + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$true); } else { - zephir_concat_self_str(&sql, " NULL", sizeof(" NULL") - 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("disabled"), &__$false); } - ZEPHIR_CALL_METHOD(&_11, column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_11)) { - zephir_concat_self_str(&sql, " PRIMARY KEY AUTOINCREMENT", sizeof(" PRIMARY KEY AUTOINCREMENT") - 1); + if (0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("engines"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("engines"), &__$false); } - RETURN_CTOR(&sql); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 5); + zephir_update_property_zval(this_ptr, ZEND_STRL("renderLevel"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("content"), &__$null); + ZEPHIR_INIT_VAR(&_1); + array_init(&_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesBefore"), &_1); + ZEPHIR_INIT_VAR(&_2); + array_init(&_2); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesAfter"), &_2); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addForeignKey) +static PHP_METHOD(Phalcon_Mvc_View, setBasePath) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *reference, reference_sub; - zval tableName, schemaName; + zval *basePath_param = NULL; + zval basePath; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&reference_sub); + ZVAL_UNDEF(&basePath); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(reference, phalcon_db_referenceinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(basePath) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &basePath_param); + zephir_get_strval(&basePath, basePath_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("basePath"), &basePath); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setContent) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *content_param = NULL; + zval content; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&content); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(content) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &content_param); + zephir_get_strval(&content, content_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("content"), &content); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setEventsManager) +{ + zval *eventsManager, eventsManager_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&eventsManager_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); +} + +static PHP_METHOD(Phalcon_Mvc_View, setLayout) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *layout_param = NULL; + zval layout; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&layout); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(layout) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &layout_param); + zephir_get_strval(&layout, layout_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("layout"), &layout); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setLayoutsDir) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *layoutsDir_param = NULL; + zval layoutsDir; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&layoutsDir); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(layoutsDir) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &layoutsDir_param); + zephir_get_strval(&layoutsDir, layoutsDir_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("layoutsDir"), &layoutsDir); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setMainView) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *viewPath_param = NULL; + zval viewPath; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&viewPath); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(viewPath) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewPath_param); + zephir_get_strval(&viewPath, viewPath_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("mainView"), &viewPath); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setPartialsDir) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *partialsDir_param = NULL; + zval partialsDir; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&partialsDir); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(partialsDir) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &partialsDir_param); + zephir_get_strval(&partialsDir, partialsDir_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("partialsDir"), &partialsDir); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setParamToView) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *key_param = NULL, *value, value_sub; + zval key; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&key); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Adding a foreign key constraint to an existing table is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 73); - return; + zephir_update_property_array(this_ptr, SL("viewParams"), &key, value); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addIndex) +static PHP_METHOD(Phalcon_Mvc_View, setRenderLevel) { + zval *level_param = NULL, _0; + zend_long level; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(level) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &level_param); + level = zephir_get_intval(level_param); + + + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, level); + zephir_update_property_zval(this_ptr, ZEND_STRL("renderLevel"), &_0); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setTemplateAfter) +{ + zval _0$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, indexType, _5, _6, _7, _0$$3, _1$$5, _2$$5, _3$$6, _4$$6; - zval tableName, schemaName, sql; + zval *templateAfter, templateAfter_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&indexType); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&templateAfter_sub); ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_4$$6); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(templateAfter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } + zephir_fetch_params(1, 1, 0, &templateAfter); - ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&indexType))) { + if (Z_TYPE_P(templateAfter) != IS_ARRAY) { ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_CONCAT_SVS(&_0$$3, "CREATE ", &indexType, " INDEX "); - zephir_get_strval(&sql, &_0$$3); - } else { - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, "CREATE INDEX "); - } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CALL_METHOD(&_1$$5, index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$5); - ZEPHIR_CONCAT_SVSVS(&_2$$5, "\"", &schemaName, "\".\"", &_1$$5, "\""); - zephir_concat_self(&sql, &_2$$5); + zephir_create_array(&_0$$3, 1, 0); + zephir_array_fast_append(&_0$$3, templateAfter); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesAfter"), &_0$$3); } else { - ZEPHIR_CALL_METHOD(&_3$$6, index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4$$6); - ZEPHIR_CONCAT_SVS(&_4$$6, "\"", &_3$$6, "\""); - zephir_concat_self(&sql, &_4$$6); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesAfter"), templateAfter); } - ZEPHIR_CALL_METHOD(&_6, index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getcolumnlist", NULL, 54, &_6); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_7); - ZEPHIR_CONCAT_SVSVS(&_7, " ON \"", &tableName, "\" (", &_5, ")"); - zephir_concat_self(&sql, &_7); - RETURN_CTOR(&sql); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_View, setTemplateBefore) { + zval _0$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub; - zval tableName, schemaName; + zval *templateBefore, templateBefore_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&templateBefore_sub); + ZVAL_UNDEF(&_0$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(templateBefore) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + zephir_fetch_params(1, 1, 0, &templateBefore); + + + if (Z_TYPE_P(templateBefore) != IS_ARRAY) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_create_array(&_0$$3, 1, 0); + zephir_array_fast_append(&_0$$3, templateBefore); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesBefore"), &_0$$3); } else { - ZEPHIR_INIT_VAR(&tableName); + zephir_update_property_zval(this_ptr, ZEND_STRL("templatesBefore"), templateBefore); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, setVar) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *key_param = NULL, *value, value_sub; + zval key; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &value); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&key); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Adding a primary key after table has been created is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 110); - return; + zephir_update_property_array(this_ptr, SL("viewParams"), &key, value); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) +static PHP_METHOD(Phalcon_Mvc_View, setVars) { - zend_bool hasPrimary = 0, _8$$7, _10$$7, _21$$15, _23$$15, _32$$24, _33$$24, _42$$27, _43$$27; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_6 = NULL, *_15 = NULL, *_37 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, columns, table, temporary, options, createLines, columnLine, column, indexes, index, indexName, indexType, references, reference, defaultValue, referenceSql, onDelete, onUpdate, *_2, _3, _69, _70, _0$$5, _1$$6, _4$$7, _5$$7, _7$$7, _9$$7, _11$$7, _17$$7, _12$$10, _13$$12, _14$$12, _16$$12, _18$$15, _19$$15, _20$$15, _22$$15, _24$$15, _29$$15, _25$$18, _26$$20, _27$$20, _28$$20, *_30$$23, _31$$23, _34$$24, _35$$25, _36$$25, _38$$25, _39$$26, _40$$26, _41$$26, _44$$27, _45$$28, _46$$28, _47$$28, _48$$29, _49$$29, _50$$29, *_51$$30, _52$$30, _53$$31, _54$$31, _55$$31, _56$$31, _57$$31, _58$$31, _59$$32, _60$$33, _61$$34, _62$$34, _63$$34, _64$$34, _65$$34, _66$$34, _67$$35, _68$$36; - zval tableName, schemaName, sql; + zend_bool merge; + zval *params_param = NULL, *merge_param = NULL, _0$$3, _1$$3; + zval params; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&temporary); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&createLines); - ZVAL_UNDEF(&columnLine); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&indexName); - ZVAL_UNDEF(&indexType); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&defaultValue); - ZVAL_UNDEF(&referenceSql); - ZVAL_UNDEF(&onDelete); - ZVAL_UNDEF(&onUpdate); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_69); - ZVAL_UNDEF(&_70); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_7$$7); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_17$$7); - ZVAL_UNDEF(&_12$$10); - ZVAL_UNDEF(&_13$$12); - ZVAL_UNDEF(&_14$$12); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_18$$15); - ZVAL_UNDEF(&_19$$15); - ZVAL_UNDEF(&_20$$15); - ZVAL_UNDEF(&_22$$15); - ZVAL_UNDEF(&_24$$15); - ZVAL_UNDEF(&_29$$15); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&_26$$20); - ZVAL_UNDEF(&_27$$20); - ZVAL_UNDEF(&_28$$20); - ZVAL_UNDEF(&_31$$23); - ZVAL_UNDEF(&_34$$24); - ZVAL_UNDEF(&_35$$25); - ZVAL_UNDEF(&_36$$25); - ZVAL_UNDEF(&_38$$25); - ZVAL_UNDEF(&_39$$26); - ZVAL_UNDEF(&_40$$26); - ZVAL_UNDEF(&_41$$26); - ZVAL_UNDEF(&_44$$27); - ZVAL_UNDEF(&_45$$28); - ZVAL_UNDEF(&_46$$28); - ZVAL_UNDEF(&_47$$28); - ZVAL_UNDEF(&_48$$29); - ZVAL_UNDEF(&_49$$29); - ZVAL_UNDEF(&_50$$29); - ZVAL_UNDEF(&_52$$30); - ZVAL_UNDEF(&_53$$31); - ZVAL_UNDEF(&_54$$31); - ZVAL_UNDEF(&_55$$31); - ZVAL_UNDEF(&_56$$31); - ZVAL_UNDEF(&_57$$31); - ZVAL_UNDEF(&_58$$31); - ZVAL_UNDEF(&_59$$32); - ZVAL_UNDEF(&_60$$33); - ZVAL_UNDEF(&_61$$34); - ZVAL_UNDEF(&_62$$34); - ZVAL_UNDEF(&_63$$34); - ZVAL_UNDEF(&_64$$34); - ZVAL_UNDEF(&_65$$34); - ZVAL_UNDEF(&_66$$34); - ZVAL_UNDEF(&_67$$35); - ZVAL_UNDEF(&_68$$36); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(params) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(merge) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param); + ZEPHIR_OBS_COPY_OR_DUP(¶ms, params_param); + if (!merge_param) { + merge = 1; } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + merge = zephir_get_boolval(merge_param); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + + + if (merge) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + zephir_fast_array_merge(&_0$$3, &_1$$3, ¶ms); + zephir_update_property_zval(this_ptr, ZEND_STRL("viewParams"), &_0$$3); } else { - ZEPHIR_INIT_VAR(&schemaName); + zephir_update_property_zval(this_ptr, ZEND_STRL("viewParams"), ¶ms); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + RETURN_THIS(); +} +static PHP_METHOD(Phalcon_Mvc_View, setViewsDir) +{ + zend_string *_5$$5; + zend_ulong _4$$5; + zend_bool _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *viewsDir, viewsDir_sub, position, directory, newViewsDir, _1$$4, *_2$$5, _3$$5, _6$$6, _7$$8; + zval *this_ptr = getThis(); - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&temporary); - ZVAL_BOOL(&temporary, 0); - ZEPHIR_OBS_VAR(&options); - if (zephir_array_isset_string_fetch(&options, &definition, SL("options"), 0)) { - ZEPHIR_OBS_NVAR(&temporary); - zephir_array_isset_string_fetch(&temporary, &options, SL("temporary"), 0); + ZVAL_UNDEF(&viewsDir_sub); + ZVAL_UNDEF(&position); + ZVAL_UNDEF(&directory); + ZVAL_UNDEF(&newViewsDir); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&_7$$8); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(viewsDir) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &viewsDir); + + + _0 = Z_TYPE_P(viewsDir) != IS_STRING; + if (_0) { + _0 = Z_TYPE_P(viewsDir) != IS_ARRAY; } - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/Db/Dialect/Sqlite.zep", 134); + if (_0) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Views directory must be a string or an array", "phalcon/Mvc/View.zep", 982); return; } - if (zephir_is_true(&temporary)) { - ZEPHIR_INIT_VAR(&_0$$5); - ZEPHIR_CONCAT_SV(&_0$$5, "CREATE TEMPORARY TABLE ", &table); - zephir_get_strval(&sql, &_0$$5); + if (Z_TYPE_P(viewsDir) == IS_STRING) { + ZEPHIR_CALL_METHOD(&_1$$4, this_ptr, "getdirseparator", NULL, 491, viewsDir); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("viewsDirs"), &_1$$4); } else { - ZEPHIR_INIT_VAR(&_1$$6); - ZEPHIR_CONCAT_SV(&_1$$6, "CREATE TABLE ", &table); - zephir_get_strval(&sql, &_1$$6); - } - zephir_concat_self_str(&sql, " (\n\t", sizeof(" (\n\t") - 1); - hasPrimary = 0; - ZEPHIR_INIT_VAR(&createLines); - array_init(&createLines); - zephir_is_iterable(&columns, 0, "phalcon/Db/Dialect/Sqlite.zep", 197); - if (Z_TYPE_P(&columns) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&columns), _2) - { - ZEPHIR_INIT_NVAR(&column); - ZVAL_COPY(&column, _2); - ZEPHIR_CALL_METHOD(&_4$$7, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_5$$7, this_ptr, "getcolumndefinition", &_6, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&columnLine); - ZEPHIR_CONCAT_SVSV(&columnLine, "`", &_4$$7, "` ", &_5$$7); - ZEPHIR_CALL_METHOD(&_7$$7, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - _8$$7 = zephir_is_true(&_7$$7); - if (_8$$7) { - _8$$7 = !hasPrimary; - } - if (_8$$7) { - zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY")); - hasPrimary = 1; - } - ZEPHIR_CALL_METHOD(&_9$$7, &column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - _10$$7 = zephir_is_true(&_9$$7); - if (_10$$7) { - _10$$7 = hasPrimary; - } - if (_10$$7) { - zephir_concat_self_str(&columnLine, SL(" AUTOINCREMENT")); - } - ZEPHIR_CALL_METHOD(&_11$$7, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_11$$7)) { - ZEPHIR_CALL_METHOD(&defaultValue, &column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_12$$10); - zephir_fast_strtoupper(&_12$$10, &defaultValue); - if (zephir_memnstr_str(&_12$$10, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Sqlite.zep", 175)) { - zephir_concat_self_str(&columnLine, SL(" DEFAULT CURRENT_TIMESTAMP")); + ZEPHIR_INIT_VAR(&newViewsDir); + array_init(&newViewsDir); + zephir_is_iterable(viewsDir, 0, "phalcon/Mvc/View.zep", 1000); + if (Z_TYPE_P(viewsDir) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(viewsDir), _4$$5, _5$$5, _2$$5) + { + ZEPHIR_INIT_NVAR(&position); + if (_5$$5 != NULL) { + ZVAL_STR_COPY(&position, _5$$5); } else { - ZEPHIR_INIT_NVAR(&_13$$12); - ZVAL_STRING(&_13$$12, "\""); - ZEPHIR_CALL_FUNCTION(&_14$$12, "addcslashes", &_15, 214, &defaultValue, &_13$$12); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_16$$12); - ZEPHIR_CONCAT_SVS(&_16$$12, " DEFAULT \"", &_14$$12, "\""); - zephir_concat_self(&columnLine, &_16$$12); - } - } - ZEPHIR_CALL_METHOD(&_17$$7, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_17$$7)) { - zephir_concat_self_str(&columnLine, SL(" NOT NULL")); - } else { - zephir_concat_self_str(&columnLine, SL(" NULL")); - } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 191); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columns, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &columns, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &columns, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_18$$15, &column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_19$$15, this_ptr, "getcolumndefinition", &_6, 0, &column); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&columnLine); - ZEPHIR_CONCAT_SVSV(&columnLine, "`", &_18$$15, "` ", &_19$$15); - ZEPHIR_CALL_METHOD(&_20$$15, &column, "isprimary", NULL, 0); - zephir_check_call_status(); - _21$$15 = zephir_is_true(&_20$$15); - if (_21$$15) { - _21$$15 = !hasPrimary; - } - if (_21$$15) { - zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY")); - hasPrimary = 1; - } - ZEPHIR_CALL_METHOD(&_22$$15, &column, "isautoincrement", NULL, 0); - zephir_check_call_status(); - _23$$15 = zephir_is_true(&_22$$15); - if (_23$$15) { - _23$$15 = hasPrimary; - } - if (_23$$15) { - zephir_concat_self_str(&columnLine, SL(" AUTOINCREMENT")); - } - ZEPHIR_CALL_METHOD(&_24$$15, &column, "hasdefault", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_24$$15)) { - ZEPHIR_CALL_METHOD(&defaultValue, &column, "getdefault", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_25$$18); - zephir_fast_strtoupper(&_25$$18, &defaultValue); - if (zephir_memnstr_str(&_25$$18, SL("CURRENT_TIMESTAMP"), "phalcon/Db/Dialect/Sqlite.zep", 175)) { - zephir_concat_self_str(&columnLine, SL(" DEFAULT CURRENT_TIMESTAMP")); - } else { - ZEPHIR_INIT_NVAR(&_26$$20); - ZVAL_STRING(&_26$$20, "\""); - ZEPHIR_CALL_FUNCTION(&_27$$20, "addcslashes", &_15, 214, &defaultValue, &_26$$20); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_28$$20); - ZEPHIR_CONCAT_SVS(&_28$$20, " DEFAULT \"", &_27$$20, "\""); - zephir_concat_self(&columnLine, &_28$$20); - } + ZVAL_LONG(&position, _4$$5); } - ZEPHIR_CALL_METHOD(&_29$$15, &column, "isnotnull", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_29$$15)) { - zephir_concat_self_str(&columnLine, SL(" NOT NULL")); - } else { - zephir_concat_self_str(&columnLine, SL(" NULL")); + ZEPHIR_INIT_NVAR(&directory); + ZVAL_COPY(&directory, _2$$5); + if (Z_TYPE_P(&directory) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Views directory item must be a string", "phalcon/Mvc/View.zep", 994); + return; } - zephir_array_append(&createLines, &columnLine, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 191); - ZEPHIR_CALL_METHOD(NULL, &columns, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&column); - ZEPHIR_OBS_VAR(&indexes); - if (zephir_array_isset_string_fetch(&indexes, &definition, SL("indexes"), 0)) { - zephir_is_iterable(&indexes, 0, "phalcon/Db/Dialect/Sqlite.zep", 211); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&indexes), _30$$23) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _30$$23); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); + ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "getdirseparator", NULL, 491, &directory); zephir_check_call_status(); - _32$$24 = ZEPHIR_IS_STRING(&indexName, "PRIMARY"); - if (_32$$24) { - _32$$24 = !hasPrimary; - } - _33$$24 = !(ZEPHIR_IS_EMPTY(&indexType)); - if (_33$$24) { - ZEPHIR_INIT_NVAR(&_34$$24); - zephir_fast_strtoupper(&_34$$24, &indexType); - _33$$24 = zephir_memnstr_str(&_34$$24, SL("UNIQUE"), "phalcon/Db/Dialect/Sqlite.zep", 207); - } - if (_32$$24) { - ZEPHIR_CALL_METHOD(&_36$$25, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_35$$25, this_ptr, "getcolumnlist", &_37, 54, &_36$$25); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_38$$25); - ZEPHIR_CONCAT_SVS(&_38$$25, "PRIMARY KEY (", &_35$$25, ")"); - zephir_array_append(&createLines, &_38$$25, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 206); - } else if (_33$$24) { - ZEPHIR_CALL_METHOD(&_40$$26, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_39$$26, this_ptr, "getcolumnlist", &_37, 54, &_40$$26); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_41$$26); - ZEPHIR_CONCAT_SVS(&_41$$26, "UNIQUE (", &_39$$26, ")"); - zephir_array_append(&createLines, &_41$$26, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 208); - } + zephir_array_update_zval(&newViewsDir, &position, &_6$$6, PH_COPY | PH_SEPARATE); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, viewsDir, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_31$$23, &indexes, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_3$$5, viewsDir, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_31$$23)) { + if (!zend_is_true(&_3$$5)) { break; } - ZEPHIR_CALL_METHOD(&index, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexName, &index, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexType, &index, "gettype", NULL, 0); - zephir_check_call_status(); - _42$$27 = ZEPHIR_IS_STRING(&indexName, "PRIMARY"); - if (_42$$27) { - _42$$27 = !hasPrimary; - } - _43$$27 = !(ZEPHIR_IS_EMPTY(&indexType)); - if (_43$$27) { - ZEPHIR_INIT_NVAR(&_44$$27); - zephir_fast_strtoupper(&_44$$27, &indexType); - _43$$27 = zephir_memnstr_str(&_44$$27, SL("UNIQUE"), "phalcon/Db/Dialect/Sqlite.zep", 207); - } - if (_42$$27) { - ZEPHIR_CALL_METHOD(&_46$$28, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_45$$28, this_ptr, "getcolumnlist", &_37, 54, &_46$$28); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_47$$28); - ZEPHIR_CONCAT_SVS(&_47$$28, "PRIMARY KEY (", &_45$$28, ")"); - zephir_array_append(&createLines, &_47$$28, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 206); - } else if (_43$$27) { - ZEPHIR_CALL_METHOD(&_49$$29, &index, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_48$$29, this_ptr, "getcolumnlist", &_37, 54, &_49$$29); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_50$$29); - ZEPHIR_CONCAT_SVS(&_50$$29, "UNIQUE (", &_48$$29, ")"); - zephir_array_append(&createLines, &_50$$29, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 208); - } - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - } - ZEPHIR_OBS_VAR(&references); - if (zephir_array_isset_string_fetch(&references, &definition, SL("references"), 0)) { - zephir_is_iterable(&references, 0, "phalcon/Db/Dialect/Sqlite.zep", 233); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&references), _51$$30) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _51$$30); - ZEPHIR_CALL_METHOD(&_53$$31, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_55$$31, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_54$$31, this_ptr, "getcolumnlist", &_37, 54, &_55$$31); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_56$$31, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_58$$31, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_57$$31, this_ptr, "getcolumnlist", &_37, 54, &_58$$31); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&referenceSql); - ZEPHIR_CONCAT_SVSVSSVSVS(&referenceSql, "CONSTRAINT `", &_53$$31, "` FOREIGN KEY (", &_54$$31, ")", " REFERENCES `", &_56$$31, "`(", &_57$$31, ")"); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_59$$32); - ZEPHIR_CONCAT_SV(&_59$$32, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_59$$32); - } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_60$$33); - ZEPHIR_CONCAT_SV(&_60$$33, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_60$$33); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 231); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_52$$30, &references, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&position, viewsDir, "key", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_52$$30)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &references, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&directory, viewsDir, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_61$$34, &reference, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_63$$34, &reference, "getcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_62$$34, this_ptr, "getcolumnlist", &_37, 54, &_63$$34); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_64$$34, &reference, "getreferencedtable", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_66$$34, &reference, "getreferencedcolumns", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_65$$34, this_ptr, "getcolumnlist", &_37, 54, &_66$$34); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&referenceSql); - ZEPHIR_CONCAT_SVSVSSVSVS(&referenceSql, "CONSTRAINT `", &_61$$34, "` FOREIGN KEY (", &_62$$34, ")", " REFERENCES `", &_64$$34, "`(", &_65$$34, ")"); - ZEPHIR_CALL_METHOD(&onDelete, &reference, "getondelete", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onDelete))) { - ZEPHIR_INIT_NVAR(&_67$$35); - ZEPHIR_CONCAT_SV(&_67$$35, " ON DELETE ", &onDelete); - zephir_concat_self(&referenceSql, &_67$$35); + if (Z_TYPE_P(&directory) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "Views directory item must be a string", "phalcon/Mvc/View.zep", 994); + return; } - ZEPHIR_CALL_METHOD(&onUpdate, &reference, "getonupdate", NULL, 0); + ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "getdirseparator", NULL, 491, &directory); zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&onUpdate))) { - ZEPHIR_INIT_NVAR(&_68$$36); - ZEPHIR_CONCAT_SV(&_68$$36, " ON UPDATE ", &onUpdate); - zephir_concat_self(&referenceSql, &_68$$36); - } - zephir_array_append(&createLines, &referenceSql, PH_SEPARATE, "phalcon/Db/Dialect/Sqlite.zep", 231); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); + zephir_array_update_zval(&newViewsDir, &position, &_7$$8, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, viewsDir, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&reference); + ZEPHIR_INIT_NVAR(&directory); + ZEPHIR_INIT_NVAR(&position); + zephir_update_property_zval(this_ptr, ZEND_STRL("viewsDirs"), &newViewsDir); } - ZEPHIR_INIT_VAR(&_69); - zephir_fast_join_str(&_69, SL(",\n\t"), &createLines); - ZEPHIR_INIT_VAR(&_70); - ZEPHIR_CONCAT_VS(&_70, &_69, "\n)"); - zephir_concat_self(&sql, &_70); - RETURN_CTOR(&sql); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createView) +static PHP_METHOD(Phalcon_Mvc_View, start) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval __$null; zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, viewSql, _0; - zval viewName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&viewSql); + ZVAL_NULL(&__$null); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 389); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("content"), &__$null); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_View, toString) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval params; + zval *controllerName_param = NULL, *actionName_param = NULL, *params_param = NULL, result, _0; + zval controllerName, actionName; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(¶ms); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(viewName) - Z_PARAM_ARRAY(definition) + Z_PARAM_STR(controllerName) + Z_PARAM_STR(actionName) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &controllerName_param, &actionName_param, ¶ms_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_INIT_VAR(&viewName); + ZEPHIR_INIT_VAR(&controllerName); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + if (UNEXPECTED(Z_TYPE_P(actionName_param) != IS_STRING && Z_TYPE_P(actionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(actionName_param) == IS_STRING)) { + zephir_get_strval(&actionName, actionName_param); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_INIT_VAR(&actionName); + } + if (!params_param) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else { + zephir_get_arrval(¶ms, params_param); } - ZEPHIR_OBS_VAR(&viewSql); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&viewSql, &definition, SL("sql"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/Db/Dialect/Sqlite.zep", 250); - return; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "start", NULL, 0); + zephir_check_call_status(); + ZVAL_BOOL(&_0, 0); + ZEPHIR_CALL_METHOD(&result, this_ptr, "processrender", NULL, 0, &controllerName, &actionName, ¶ms, &_0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "finish", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&result))) { + RETURN_MM_STRING(""); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getcontent", NULL, 0); zephir_check_call_status(); - ZEPHIR_CONCAT_SVSV(return_value, "CREATE VIEW ", &_0, " AS ", &viewSql); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeColumns) +static PHP_METHOD(Phalcon_Mvc_View, engineRender) { + zend_string *_9$$3, *_28$$16; + zend_ulong _8$$3, _27$$16; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zephir_fcall_cache_entry *_5 = NULL, *_13 = NULL, *_16 = NULL, *_20 = NULL, *_23 = NULL, *_32 = NULL, *_35 = NULL, *_39 = NULL, *_42 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zend_bool silence, mustClean; + zval viewPath, _45$$30; + zval *engines_param = NULL, *viewPath_param = NULL, *silence_param = NULL, *mustClean_param = NULL, basePath, engine, eventsManager, extension, viewsDir, viewsDirPath, viewEnginePath, viewEnginePaths, viewParams, _0, _1, *_2, _3, _4$$3, *_6$$3, _7$$3, _11$$8, _12$$8, _14$$7, _15$$10, _18$$13, _19$$13, _21$$12, _22$$15, _24$$16, *_25$$16, _26$$16, _30$$21, _31$$21, _33$$20, _34$$23, _37$$26, _38$$26, _40$$25, _41$$28, _43$$29, _44$$30; + zval engines, _10$$8, _17$$13, _29$$21, _36$$26; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&engines); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_17$$13); + ZVAL_UNDEF(&_29$$21); + ZVAL_UNDEF(&_36$$26); + ZVAL_UNDEF(&basePath); + ZVAL_UNDEF(&engine); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&extension); + ZVAL_UNDEF(&viewsDir); + ZVAL_UNDEF(&viewsDirPath); + ZVAL_UNDEF(&viewEnginePath); + ZVAL_UNDEF(&viewEnginePaths); + ZVAL_UNDEF(&viewParams); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_14$$7); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_18$$13); + ZVAL_UNDEF(&_19$$13); + ZVAL_UNDEF(&_21$$12); + ZVAL_UNDEF(&_22$$15); + ZVAL_UNDEF(&_24$$16); + ZVAL_UNDEF(&_26$$16); + ZVAL_UNDEF(&_30$$21); + ZVAL_UNDEF(&_31$$21); + ZVAL_UNDEF(&_33$$20); + ZVAL_UNDEF(&_34$$23); + ZVAL_UNDEF(&_37$$26); + ZVAL_UNDEF(&_38$$26); + ZVAL_UNDEF(&_40$$25); + ZVAL_UNDEF(&_41$$28); + ZVAL_UNDEF(&_43$$29); + ZVAL_UNDEF(&_44$$30); + ZVAL_UNDEF(&viewPath); + ZVAL_UNDEF(&_45$$30); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ARRAY(engines) + Z_PARAM_STR(viewPath) + Z_PARAM_BOOL(silence) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_BOOL(mustClean) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + zephir_fetch_params(1, 3, 1, &engines_param, &viewPath_param, &silence_param, &mustClean_param); + zephir_get_arrval(&engines, engines_param); + zephir_get_strval(&viewPath, viewPath_param); + silence = zephir_get_boolval(silence_param); + if (!mustClean_param) { + mustClean = 1; } else { - zephir_get_strval(&schema, schema_param); + mustClean = zephir_get_boolval(mustClean_param); } - ZEPHIR_CONCAT_SVS(return_value, "PRAGMA table_info('", &table, "')"); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("basePath"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&basePath, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&viewParams, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_0); + ZEPHIR_INIT_VAR(&viewEnginePaths); + array_init(&viewEnginePaths); + ZEPHIR_CALL_METHOD(&_1, this_ptr, "getviewsdirs", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&_1, 0, "phalcon/Mvc/View.zep", 1106); + if (Z_TYPE_P(&_1) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_1), _2) + { + ZEPHIR_INIT_NVAR(&viewsDir); + ZVAL_COPY(&viewsDir, _2); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "isabsolutepath", &_5, 492, &viewPath); + zephir_check_call_status(); + if (!(zephir_is_true(&_4$$3))) { + ZEPHIR_INIT_NVAR(&viewsDirPath); + ZEPHIR_CONCAT_VVV(&viewsDirPath, &basePath, &viewsDir, &viewPath); + } else { + ZEPHIR_CPY_WRT(&viewsDirPath, &viewPath); + } + zephir_is_iterable(&engines, 0, "phalcon/Mvc/View.zep", 1101); + if (Z_TYPE_P(&engines) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&engines), _8$$3, _9$$3, _6$$3) + { + ZEPHIR_INIT_NVAR(&extension); + if (_9$$3 != NULL) { + ZVAL_STR_COPY(&extension, _9$$3); + } else { + ZVAL_LONG(&extension, _8$$3); + } + ZEPHIR_INIT_NVAR(&engine); + ZVAL_COPY(&engine, _6$$3); + ZEPHIR_INIT_NVAR(&viewEnginePath); + ZEPHIR_CONCAT_VV(&viewEnginePath, &viewsDirPath, &extension); + if ((zephir_file_exists(&viewEnginePath) == SUCCESS)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_10$$8); + zephir_create_array(&_10$$8, 1, 0); + zephir_array_fast_append(&_10$$8, &viewEnginePath); + zephir_update_property_zval(this_ptr, ZEND_STRL("activeRenderPaths"), &_10$$8); + ZEPHIR_INIT_NVAR(&_12$$8); + ZVAL_STRING(&_12$$8, "view:beforeRenderView"); + ZEPHIR_CALL_METHOD(&_11$$8, &eventsManager, "fire", &_13, 0, &_12$$8, this_ptr, &viewEnginePath); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_11$$8)) { + continue; + } + } + if (mustClean) { + ZVAL_BOOL(&_14$$7, 1); + } else { + ZVAL_BOOL(&_14$$7, 0); + } + ZEPHIR_CALL_METHOD(NULL, &engine, "render", NULL, 0, &viewEnginePath, &viewParams, &_14$$7); + zephir_check_call_status(); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_15$$10); + ZVAL_STRING(&_15$$10, "view:afterRenderView"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_16, 0, &_15$$10, this_ptr); + zephir_check_call_status(); + } + RETURN_MM_NULL(); + } + zephir_array_append(&viewEnginePaths, &viewEnginePath, PH_SEPARATE, "phalcon/Mvc/View.zep", 1099); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &engines, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_7$$3, &engines, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_7$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&extension, &engines, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&engine, &engines, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&viewEnginePath); + ZEPHIR_CONCAT_VV(&viewEnginePath, &viewsDirPath, &extension); + if ((zephir_file_exists(&viewEnginePath) == SUCCESS)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_17$$13); + zephir_create_array(&_17$$13, 1, 0); + zephir_array_fast_append(&_17$$13, &viewEnginePath); + zephir_update_property_zval(this_ptr, ZEND_STRL("activeRenderPaths"), &_17$$13); + ZEPHIR_INIT_NVAR(&_19$$13); + ZVAL_STRING(&_19$$13, "view:beforeRenderView"); + ZEPHIR_CALL_METHOD(&_18$$13, &eventsManager, "fire", &_20, 0, &_19$$13, this_ptr, &viewEnginePath); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_18$$13)) { + continue; + } + } + if (mustClean) { + ZVAL_BOOL(&_21$$12, 1); + } else { + ZVAL_BOOL(&_21$$12, 0); + } + ZEPHIR_CALL_METHOD(NULL, &engine, "render", NULL, 0, &viewEnginePath, &viewParams, &_21$$12); + zephir_check_call_status(); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_22$$15); + ZVAL_STRING(&_22$$15, "view:afterRenderView"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_23, 0, &_22$$15, this_ptr); + zephir_check_call_status(); + } + RETURN_MM_NULL(); + } + zephir_array_append(&viewEnginePaths, &viewEnginePath, PH_SEPARATE, "phalcon/Mvc/View.zep", 1099); + ZEPHIR_CALL_METHOD(NULL, &engines, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&engine); + ZEPHIR_INIT_NVAR(&extension); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_1, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&viewsDir, &_1, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_24$$16, this_ptr, "isabsolutepath", &_5, 492, &viewPath); + zephir_check_call_status(); + if (!(zephir_is_true(&_24$$16))) { + ZEPHIR_INIT_NVAR(&viewsDirPath); + ZEPHIR_CONCAT_VVV(&viewsDirPath, &basePath, &viewsDir, &viewPath); + } else { + ZEPHIR_CPY_WRT(&viewsDirPath, &viewPath); + } + zephir_is_iterable(&engines, 0, "phalcon/Mvc/View.zep", 1101); + if (Z_TYPE_P(&engines) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&engines), _27$$16, _28$$16, _25$$16) + { + ZEPHIR_INIT_NVAR(&extension); + if (_28$$16 != NULL) { + ZVAL_STR_COPY(&extension, _28$$16); + } else { + ZVAL_LONG(&extension, _27$$16); + } + ZEPHIR_INIT_NVAR(&engine); + ZVAL_COPY(&engine, _25$$16); + ZEPHIR_INIT_NVAR(&viewEnginePath); + ZEPHIR_CONCAT_VV(&viewEnginePath, &viewsDirPath, &extension); + if ((zephir_file_exists(&viewEnginePath) == SUCCESS)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_29$$21); + zephir_create_array(&_29$$21, 1, 0); + zephir_array_fast_append(&_29$$21, &viewEnginePath); + zephir_update_property_zval(this_ptr, ZEND_STRL("activeRenderPaths"), &_29$$21); + ZEPHIR_INIT_NVAR(&_31$$21); + ZVAL_STRING(&_31$$21, "view:beforeRenderView"); + ZEPHIR_CALL_METHOD(&_30$$21, &eventsManager, "fire", &_32, 0, &_31$$21, this_ptr, &viewEnginePath); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_30$$21)) { + continue; + } + } + if (mustClean) { + ZVAL_BOOL(&_33$$20, 1); + } else { + ZVAL_BOOL(&_33$$20, 0); + } + ZEPHIR_CALL_METHOD(NULL, &engine, "render", NULL, 0, &viewEnginePath, &viewParams, &_33$$20); + zephir_check_call_status(); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_34$$23); + ZVAL_STRING(&_34$$23, "view:afterRenderView"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_35, 0, &_34$$23, this_ptr); + zephir_check_call_status(); + } + RETURN_MM_NULL(); + } + zephir_array_append(&viewEnginePaths, &viewEnginePath, PH_SEPARATE, "phalcon/Mvc/View.zep", 1099); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &engines, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_26$$16, &engines, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_26$$16)) { + break; + } + ZEPHIR_CALL_METHOD(&extension, &engines, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&engine, &engines, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&viewEnginePath); + ZEPHIR_CONCAT_VV(&viewEnginePath, &viewsDirPath, &extension); + if ((zephir_file_exists(&viewEnginePath) == SUCCESS)) { + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_36$$26); + zephir_create_array(&_36$$26, 1, 0); + zephir_array_fast_append(&_36$$26, &viewEnginePath); + zephir_update_property_zval(this_ptr, ZEND_STRL("activeRenderPaths"), &_36$$26); + ZEPHIR_INIT_NVAR(&_38$$26); + ZVAL_STRING(&_38$$26, "view:beforeRenderView"); + ZEPHIR_CALL_METHOD(&_37$$26, &eventsManager, "fire", &_39, 0, &_38$$26, this_ptr, &viewEnginePath); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_37$$26)) { + continue; + } + } + if (mustClean) { + ZVAL_BOOL(&_40$$25, 1); + } else { + ZVAL_BOOL(&_40$$25, 0); + } + ZEPHIR_CALL_METHOD(NULL, &engine, "render", NULL, 0, &viewEnginePath, &viewParams, &_40$$25); + zephir_check_call_status(); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + ZEPHIR_INIT_NVAR(&_41$$28); + ZVAL_STRING(&_41$$28, "view:afterRenderView"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", &_42, 0, &_41$$28, this_ptr); + zephir_check_call_status(); + } + RETURN_MM_NULL(); + } + zephir_array_append(&viewEnginePaths, &viewEnginePath, PH_SEPARATE, "phalcon/Mvc/View.zep", 1099); + ZEPHIR_CALL_METHOD(NULL, &engines, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&engine); + ZEPHIR_INIT_NVAR(&extension); + ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&viewsDir); + if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { + zephir_update_property_zval(this_ptr, ZEND_STRL("activeRenderPaths"), &viewEnginePaths); + ZEPHIR_INIT_VAR(&_43$$29); + ZVAL_STRING(&_43$$29, "view:notFoundView"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_43$$29, this_ptr, &viewEnginePath); + zephir_check_call_status(); + } + if (!(silence)) { + ZEPHIR_INIT_VAR(&_44$$30); + object_init_ex(&_44$$30, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_VAR(&_45$$30); + ZEPHIR_CONCAT_SVS(&_45$$30, "View '", &viewPath, "' was not found in any of the views directory"); + ZEPHIR_CALL_METHOD(NULL, &_44$$30, "__construct", NULL, 32, &_45$$30); + zephir_check_call_status(); + zephir_throw_exception_debug(&_44$$30, "phalcon/Mvc/View.zep", 1115); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndex) +static PHP_METHOD(Phalcon_Mvc_View, isAbsolutePath) { + unsigned char _6, _2$$3, _4$$3; + zend_bool _5, _1$$3, _3$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *index_param = NULL; - zval index; + zval *path_param = NULL, _0; + zval path; zval *this_ptr = getThis(); - ZVAL_UNDEF(&index); + ZVAL_UNDEF(&path); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(index) + Z_PARAM_STR(path) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &index_param); - if (UNEXPECTED(Z_TYPE_P(index_param) != IS_STRING && Z_TYPE_P(index_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'index' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(index_param) == IS_STRING)) { - zephir_get_strval(&index, index_param); - } else { - ZEPHIR_INIT_VAR(&index); - } + zephir_fetch_params(1, 1, 0, &path_param); + zephir_get_strval(&path, path_param); - ZEPHIR_CONCAT_SVS(return_value, "PRAGMA index_info('", &index, "')"); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_GET_CONSTANT(&_0, "PHP_OS"); + if (ZEPHIR_IS_STRING_IDENTICAL(&_0, "WINNT")) { + _1$$3 = zephir_fast_strlen_ev(&path) >= 3; + if (_1$$3) { + _2$$3 = ZEPHIR_STRING_OFFSET(&path, 1); + _1$$3 = _2$$3 == ':'; + } + _3$$3 = _1$$3; + if (_3$$3) { + _4$$3 = ZEPHIR_STRING_OFFSET(&path, 2); + _3$$3 = _4$$3 == '\\'; + } + RETURN_MM_BOOL(_3$$3); + } + _5 = zephir_fast_strlen_ev(&path) >= 1; + if (_5) { + _6 = ZEPHIR_STRING_OFFSET(&path, 0); + _5 = _6 == '/'; + } + RETURN_MM_BOOL(_5); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_View, loadTemplateEngines) { + zval _15$$11, _21$$17; + zend_class_entry *_8$$9, *_17$$15; + zend_string *_6$$5; + zend_ulong _5$$5; + zval engines, di, registeredEngines, engineService, extension, _0, _1$$3, _2$$4, *_3$$5, _4$$5, _7$$9, _11$$12, _12$$12, _14$$11, _16$$15, _18$$18, _19$$18, _20$$17; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zephir_fcall_cache_entry *_9 = NULL, *_10 = NULL, *_13 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - ZEND_PARSE_PARAMETERS_END(); -#endif + ZVAL_UNDEF(&engines); + ZVAL_UNDEF(&di); + ZVAL_UNDEF(®isteredEngines); + ZVAL_UNDEF(&engineService); + ZVAL_UNDEF(&extension); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_7$$9); + ZVAL_UNDEF(&_11$$12); + ZVAL_UNDEF(&_12$$12); + ZVAL_UNDEF(&_14$$11); + ZVAL_UNDEF(&_16$$15); + ZVAL_UNDEF(&_18$$18); + ZVAL_UNDEF(&_19$$18); + ZVAL_UNDEF(&_20$$17); + ZVAL_UNDEF(&_15$$11); + ZVAL_UNDEF(&_21$$17); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } - - ZEPHIR_CONCAT_SVS(return_value, "PRAGMA index_list('", &table, "')"); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("engines"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&engines, &_0); + if (ZEPHIR_IS_FALSE_IDENTICAL(&engines)) { + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&di, &_1$$3); + ZEPHIR_INIT_NVAR(&engines); + array_init(&engines); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("registeredEngines"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(®isteredEngines, &_1$$3); + if (ZEPHIR_IS_EMPTY(®isteredEngines)) { + ZEPHIR_INIT_VAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_mvc_view_engine_php_ce); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 493, this_ptr, &di); + zephir_check_call_status(); + zephir_array_update_string(&engines, SL(".phtml"), &_2$$4, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&di) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injection container is required to access application services", "phalcon/Mvc/View.zep", 1158); + return; + } + zephir_is_iterable(®isteredEngines, 0, "phalcon/Mvc/View.zep", 1195); + if (Z_TYPE_P(®isteredEngines) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(®isteredEngines), _5$$5, _6$$5, _3$$5) + { + ZEPHIR_INIT_NVAR(&extension); + if (_6$$5 != NULL) { + ZVAL_STR_COPY(&extension, _6$$5); + } else { + ZVAL_LONG(&extension, _5$$5); + } + ZEPHIR_INIT_NVAR(&engineService); + ZVAL_COPY(&engineService, _3$$5); + if (Z_TYPE_P(&engineService) == IS_OBJECT) { + if (zephir_is_instance_of(&engineService, SL("Closure"))) { + _8$$9 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_CALL_CE_STATIC(&_7$$9, _8$$9, "bind", &_9, 0, &engineService, &di); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&engineService, &_7$$9); + ZEPHIR_CALL_FUNCTION(&_7$$9, "call_user_func", &_10, 187, &engineService, this_ptr); + zephir_check_call_status(); + zephir_array_update_zval(&engines, &extension, &_7$$9, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&engines, &extension, &engineService, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&engineService) != IS_STRING) { + ZEPHIR_INIT_NVAR(&_11$$12); + object_init_ex(&_11$$12, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_NVAR(&_12$$12); + ZEPHIR_CONCAT_SV(&_12$$12, "Invalid template engine registration for extension: ", &extension); + ZEPHIR_CALL_METHOD(NULL, &_11$$12, "__construct", &_13, 32, &_12$$12); + zephir_check_call_status(); + zephir_throw_exception_debug(&_11$$12, "phalcon/Mvc/View.zep", 1186); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_NVAR(&_15$$11); + zephir_create_array(&_15$$11, 1, 0); + zephir_array_fast_append(&_15$$11, this_ptr); + ZEPHIR_CALL_METHOD(&_14$$11, &di, "get", NULL, 0, &engineService, &_15$$11); + zephir_check_call_status(); + zephir_array_update_zval(&engines, &extension, &_14$$11, PH_COPY | PH_SEPARATE); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, ®isteredEngines, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_4$$5, ®isteredEngines, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4$$5)) { + break; + } + ZEPHIR_CALL_METHOD(&extension, ®isteredEngines, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&engineService, ®isteredEngines, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&engineService) == IS_OBJECT) { + if (zephir_is_instance_of(&engineService, SL("Closure"))) { + _17$$15 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_CALL_CE_STATIC(&_16$$15, _17$$15, "bind", &_9, 0, &engineService, &di); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&engineService, &_16$$15); + ZEPHIR_CALL_FUNCTION(&_16$$15, "call_user_func", &_10, 187, &engineService, this_ptr); + zephir_check_call_status(); + zephir_array_update_zval(&engines, &extension, &_16$$15, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&engines, &extension, &engineService, PH_COPY | PH_SEPARATE); + } + } else { + if (Z_TYPE_P(&engineService) != IS_STRING) { + ZEPHIR_INIT_NVAR(&_18$$18); + object_init_ex(&_18$$18, phalcon_mvc_view_exception_ce); + ZEPHIR_INIT_NVAR(&_19$$18); + ZEPHIR_CONCAT_SV(&_19$$18, "Invalid template engine registration for extension: ", &extension); + ZEPHIR_CALL_METHOD(NULL, &_18$$18, "__construct", &_13, 32, &_19$$18); + zephir_check_call_status(); + zephir_throw_exception_debug(&_18$$18, "phalcon/Mvc/View.zep", 1186); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_NVAR(&_21$$17); + zephir_create_array(&_21$$17, 1, 0); + zephir_array_fast_append(&_21$$17, this_ptr); + ZEPHIR_CALL_METHOD(&_20$$17, &di, "get", NULL, 0, &engineService, &_21$$17); + zephir_check_call_status(); + zephir_array_update_zval(&engines, &extension, &_20$$17, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, ®isteredEngines, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&engineService); + ZEPHIR_INIT_NVAR(&extension); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("engines"), &engines); + } + RETURN_CCTOR(&engines); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeReferences) +static PHP_METHOD(Phalcon_Mvc_View, processRender) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; + zend_long ZEPHIR_LAST_CALL_STATUS, renderLevel = 0; + zend_bool fireEvents, silence = 0, _5, _30; + zval params; + zval *controllerName_param = NULL, *actionName_param = NULL, *params_param = NULL, *fireEvents_param = NULL, layoutsDir, layout, pickView, layoutName, engines, renderView, pickViewAction, eventsManager, disabledLevels, templatesBefore, templatesAfter, templateBefore, templateAfter, _0, _2, _4, _8, _9, _1$$3, _6$$11, _7$$11, _10$$15, _11$$17, *_12$$17, _13$$17, _14$$18, _15$$18, _16$$19, _17$$19, _18$$21, _19$$21, _20$$23, *_21$$23, _22$$23, _23$$24, _24$$24, _25$$25, _26$$25, _27$$27, _28$$27, _29$$13, _31$$28; + zval controllerName, actionName, _3$$7; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&layoutsDir); + ZVAL_UNDEF(&layout); + ZVAL_UNDEF(&pickView); + ZVAL_UNDEF(&layoutName); + ZVAL_UNDEF(&engines); + ZVAL_UNDEF(&renderView); + ZVAL_UNDEF(&pickViewAction); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&disabledLevels); + ZVAL_UNDEF(&templatesBefore); + ZVAL_UNDEF(&templatesAfter); + ZVAL_UNDEF(&templateBefore); + ZVAL_UNDEF(&templateAfter); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_9); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_6$$11); + ZVAL_UNDEF(&_7$$11); + ZVAL_UNDEF(&_10$$15); + ZVAL_UNDEF(&_11$$17); + ZVAL_UNDEF(&_13$$17); + ZVAL_UNDEF(&_14$$18); + ZVAL_UNDEF(&_15$$18); + ZVAL_UNDEF(&_16$$19); + ZVAL_UNDEF(&_17$$19); + ZVAL_UNDEF(&_18$$21); + ZVAL_UNDEF(&_19$$21); + ZVAL_UNDEF(&_20$$23); + ZVAL_UNDEF(&_22$$23); + ZVAL_UNDEF(&_23$$24); + ZVAL_UNDEF(&_24$$24); + ZVAL_UNDEF(&_25$$25); + ZVAL_UNDEF(&_26$$25); + ZVAL_UNDEF(&_27$$27); + ZVAL_UNDEF(&_28$$27); + ZVAL_UNDEF(&_29$$13); + ZVAL_UNDEF(&_31$$28); + ZVAL_UNDEF(¶ms); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(2, 4) + Z_PARAM_STR(controllerName) + Z_PARAM_STR(actionName) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ARRAY(params) + Z_PARAM_BOOL(fireEvents) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 2, 2, &controllerName_param, &actionName_param, ¶ms_param, &fireEvents_param); + if (UNEXPECTED(Z_TYPE_P(controllerName_param) != IS_STRING && Z_TYPE_P(controllerName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(controllerName_param) == IS_STRING)) { + zephir_get_strval(&controllerName, controllerName_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&controllerName); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (UNEXPECTED(Z_TYPE_P(actionName_param) != IS_STRING && Z_TYPE_P(actionName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(actionName_param) == IS_STRING)) { + zephir_get_strval(&actionName, actionName_param); } else { - zephir_get_strval(&schema, schema_param); + ZEPHIR_INIT_VAR(&actionName); + } + if (!params_param) { + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + } else { + zephir_get_arrval(¶ms, params_param); + } + if (!fireEvents_param) { + fireEvents = 1; + } else { + fireEvents = zephir_get_boolval(fireEvents_param); } - ZEPHIR_CONCAT_SVS(return_value, "PRAGMA foreign_key_list('", &table, "')"); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropColumn) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL; - zval tableName, schemaName, columnName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&columnName); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("disabled"), PH_NOISY_CC | PH_READONLY); + if (!ZEPHIR_IS_FALSE_IDENTICAL(&_0)) { + ZEPHIR_CALL_FUNCTION(&_1$$3, "ob_get_contents", NULL, 494); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("content"), &_1$$3); + RETURN_MM_BOOL(0); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("controllerName"), &controllerName); + zephir_update_property_zval(this_ptr, ZEND_STRL("actionName"), &actionName); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvars", NULL, 0, ¶ms); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("layoutsDir"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&layoutsDir, &_2); + if (!(zephir_is_true(&layoutsDir))) { + ZEPHIR_INIT_NVAR(&layoutsDir); + ZVAL_STRING(&layoutsDir, "layouts/"); + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("layout"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&layout, &_2); + if (zephir_is_true(&layout)) { + ZEPHIR_CPY_WRT(&layoutName, &layout); + } else { + ZEPHIR_CPY_WRT(&layoutName, &controllerName); + } + ZEPHIR_CALL_METHOD(&engines, this_ptr, "loadtemplateengines", NULL, 0); + zephir_check_call_status(); + zephir_read_property(&_2, this_ptr, ZEND_STRL("pickView"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&pickView, &_2); + if (Z_TYPE_P(&pickView) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$7); + ZEPHIR_CONCAT_VSV(&_3$$7, &controllerName, "/", &actionName); + ZEPHIR_CPY_WRT(&renderView, &_3$$7); + } else { + ZEPHIR_OBS_NVAR(&renderView); + zephir_array_fetch_long(&renderView, &pickView, 0, PH_NOISY, "phalcon/Mvc/View.zep", 1273); + if (Z_TYPE_P(&layoutName) == IS_NULL) { + ZEPHIR_OBS_VAR(&pickViewAction); + if (zephir_array_isset_long_fetch(&pickViewAction, &pickView, 1, 0)) { + ZEPHIR_CPY_WRT(&layoutName, &pickViewAction); + } + } + } + zephir_read_property(&_2, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&eventsManager, &_2); + ZEPHIR_INIT_VAR(&_4); + ZEPHIR_CREATE_SYMBOL_TABLE(); + + _5 = fireEvents; + if (_5) { + _5 = Z_TYPE_P(&eventsManager) == IS_OBJECT; + } + if (_5) { + ZEPHIR_INIT_VAR(&_7$$11); + ZVAL_STRING(&_7$$11, "view:beforeRender"); + ZEPHIR_CALL_METHOD(&_6$$11, &eventsManager, "fire", NULL, 0, &_7$$11, this_ptr); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_6$$11)) { + RETURN_MM_BOOL(0); + } + } + ZEPHIR_CALL_FUNCTION(&_8, "ob_get_contents", NULL, 494); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("content"), &_8); + silence = 1; + zephir_read_property(&_2, this_ptr, ZEND_STRL("disabledLevels"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&disabledLevels, &_2); + ZEPHIR_OBS_VAR(&_9); + zephir_read_property(&_9, this_ptr, ZEND_STRL("renderLevel"), PH_NOISY_CC); + renderLevel = zephir_get_intval(&_9); + if (renderLevel) { + if (renderLevel >= 1) { + if (!(zephir_array_isset_long(&disabledLevels, 1))) { + ZEPHIR_INIT_ZVAL_NREF(_10$$15); + ZVAL_LONG(&_10$$15, 1); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_10$$15); + if (silence) { + ZVAL_BOOL(&_10$$15, 1); + } else { + ZVAL_BOOL(&_10$$15, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &renderView, &_10$$15); + zephir_check_call_status(); + } + } + if (renderLevel >= 2) { + if (!(zephir_array_isset_long(&disabledLevels, 2))) { + ZEPHIR_INIT_ZVAL_NREF(_11$$17); + ZVAL_LONG(&_11$$17, 2); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_11$$17); + zephir_read_property(&_11$$17, this_ptr, ZEND_STRL("templatesBefore"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&templatesBefore, &_11$$17); + silence = 0; + zephir_is_iterable(&templatesBefore, 0, "phalcon/Mvc/View.zep", 1349); + if (Z_TYPE_P(&templatesBefore) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&templatesBefore), _12$$17) + { + ZEPHIR_INIT_NVAR(&templateBefore); + ZVAL_COPY(&templateBefore, _12$$17); + ZEPHIR_INIT_NVAR(&_14$$18); + ZEPHIR_CONCAT_VV(&_14$$18, &layoutsDir, &templateBefore); + if (silence) { + ZVAL_BOOL(&_15$$18, 1); + } else { + ZVAL_BOOL(&_15$$18, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_14$$18, &_15$$18); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &templatesBefore, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_13$$17, &templatesBefore, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_13$$17)) { + break; + } + ZEPHIR_CALL_METHOD(&templateBefore, &templatesBefore, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_16$$19); + ZEPHIR_CONCAT_VV(&_16$$19, &layoutsDir, &templateBefore); + if (silence) { + ZVAL_BOOL(&_17$$19, 1); + } else { + ZVAL_BOOL(&_17$$19, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_16$$19, &_17$$19); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &templatesBefore, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&templateBefore); + silence = 1; + } + } + if (renderLevel >= 3) { + if (!(zephir_array_isset_long(&disabledLevels, 3))) { + ZEPHIR_INIT_ZVAL_NREF(_18$$21); + ZVAL_LONG(&_18$$21, 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_18$$21); + ZEPHIR_INIT_VAR(&_19$$21); + ZEPHIR_CONCAT_VV(&_19$$21, &layoutsDir, &layoutName); + if (silence) { + ZVAL_BOOL(&_18$$21, 1); + } else { + ZVAL_BOOL(&_18$$21, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_19$$21, &_18$$21); + zephir_check_call_status(); + } + } + if (renderLevel >= 4) { + if (!(zephir_array_isset_long(&disabledLevels, 4))) { + ZEPHIR_INIT_ZVAL_NREF(_20$$23); + ZVAL_LONG(&_20$$23, 4); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_20$$23); + zephir_read_property(&_20$$23, this_ptr, ZEND_STRL("templatesAfter"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&templatesAfter, &_20$$23); + silence = 0; + zephir_is_iterable(&templatesAfter, 0, "phalcon/Mvc/View.zep", 1385); + if (Z_TYPE_P(&templatesAfter) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&templatesAfter), _21$$23) + { + ZEPHIR_INIT_NVAR(&templateAfter); + ZVAL_COPY(&templateAfter, _21$$23); + ZEPHIR_INIT_NVAR(&_23$$24); + ZEPHIR_CONCAT_VV(&_23$$24, &layoutsDir, &templateAfter); + if (silence) { + ZVAL_BOOL(&_24$$24, 1); + } else { + ZVAL_BOOL(&_24$$24, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_23$$24, &_24$$24); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &templatesAfter, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_22$$23, &templatesAfter, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_22$$23)) { + break; + } + ZEPHIR_CALL_METHOD(&templateAfter, &templatesAfter, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_25$$25); + ZEPHIR_CONCAT_VV(&_25$$25, &layoutsDir, &templateAfter); + if (silence) { + ZVAL_BOOL(&_26$$25, 1); + } else { + ZVAL_BOOL(&_26$$25, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_25$$25, &_26$$25); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &templatesAfter, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&templateAfter); + silence = 1; + } + } + if (renderLevel >= 5) { + if (!(zephir_array_isset_long(&disabledLevels, 5))) { + ZEPHIR_INIT_ZVAL_NREF(_27$$27); + ZVAL_LONG(&_27$$27, 5); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_27$$27); + zephir_read_property(&_27$$27, this_ptr, ZEND_STRL("mainView"), PH_NOISY_CC | PH_READONLY); + if (silence) { + ZVAL_BOOL(&_28$$27, 1); + } else { + ZVAL_BOOL(&_28$$27, 0); + } + ZEPHIR_CALL_METHOD(NULL, this_ptr, "enginerender", NULL, 0, &engines, &_27$$27, &_28$$27); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_ZVAL_NREF(_29$$13); + ZVAL_LONG(&_29$$13, 0); + zephir_update_property_zval(this_ptr, ZEND_STRL("currentRenderLevel"), &_29$$13); + } + _30 = fireEvents; + if (_30) { + _30 = Z_TYPE_P(&eventsManager) == IS_OBJECT; + } + if (_30) { + ZEPHIR_INIT_VAR(&_31$$28); + ZVAL_STRING(&_31$$28, "view:afterRender"); + ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_31$$28, this_ptr); + zephir_check_call_status(); + } + RETURN_MM_BOOL(1); +} + +static PHP_METHOD(Phalcon_Mvc_View, getDirSeparator) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *directory_param = NULL, _0, _1; + zval directory; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&directory); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(columnName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(directory) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &directory_param); + if (UNEXPECTED(Z_TYPE_P(directory_param) != IS_STRING && Z_TYPE_P(directory_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'directory' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(directory_param) == IS_STRING)) { + zephir_get_strval(&directory, directory_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&directory); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + + + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "/"); + zephir_fast_trim(&_0, &directory, &_1, ZEPHIR_TRIM_RIGHT); + ZEPHIR_CONCAT_VS(return_value, &_0, "/"); + RETURN_MM(); +} + +zend_object *zephir_init_properties_Phalcon_Mvc_View(zend_class_entry *class_type) +{ + zval _0, _2, _4, _6, _8, _10, _12, _14, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8, _13$$9, _15$$10; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_14); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_13$$9); + ZVAL_UNDEF(&_15$$10); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("viewParams"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("viewParams"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("viewsDirs"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("viewsDirs"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("templatesBefore"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("templatesBefore"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("templatesAfter"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("templatesAfter"), &_7$$6); + } + zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("registeredEngines"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_8) == IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$7); + array_init(&_9$$7); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("registeredEngines"), &_9$$7); + } + zephir_read_property_ex(&_10, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_10) == IS_NULL) { + ZEPHIR_INIT_VAR(&_11$$8); + array_init(&_11$$8); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_11$$8); + } + zephir_read_property_ex(&_12, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_12) == IS_NULL) { + ZEPHIR_INIT_VAR(&_13$$9); + array_init(&_13$$9); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("options"), &_13$$9); + } + zephir_read_property_ex(&_14, this_ptr, ZEND_STRL("disabledLevels"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_14) == IS_NULL) { + ZEPHIR_INIT_VAR(&_15$$10); + array_init(&_15$$10); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("disabledLevels"), &_15$$10); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_ViewBaseInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ViewBaseInterface, phalcon, mvc_viewbaseinterface, phalcon_mvc_viewbaseinterface_method_entry); + + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getContent); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getParamsToView); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getViewsDir); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, partial); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setContent); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setParamToView); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setVar); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setViewsDir); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_ViewInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ViewInterface, phalcon, mvc_viewinterface, phalcon_mvc_viewinterface_method_entry); + + zend_class_implements(phalcon_mvc_viewinterface_ce, 1, phalcon_mvc_viewbaseinterface_ce); + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, cleanTemplateAfter); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, cleanTemplateBefore); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, disable); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, enable); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, finish); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getActionName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getActiveRenderPath); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getBasePath); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getControllerName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getLayout); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getLayoutsDir); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getMainView); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getPartialsDir); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, isDisabled); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, pick); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, registerEngines); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, render); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, reset); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setBasePath); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setLayout); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setLayoutsDir); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setMainView); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setPartialsDir); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setRenderLevel); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setTemplateAfter); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setTemplateBefore); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, start); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Dispatcher_Exception) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Dispatcher, Exception, phalcon, mvc_dispatcher_exception, phalcon_dispatcher_exception_ce, NULL, 0); + + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro_Collection) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Micro, Collection, phalcon, mvc_micro_collection, phalcon_mvc_micro_collection_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_micro_collection_ce, SL("handler"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_collection_ce, SL("handlers"), ZEND_ACC_PROTECTED); + zend_declare_property_bool(phalcon_mvc_micro_collection_ce, SL("lazy"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_micro_collection_ce, SL("prefix"), "", ZEND_ACC_PROTECTED); + phalcon_mvc_micro_collection_ce->create_object = zephir_init_properties_Phalcon_Mvc_Micro_Collection; + + zend_class_implements(phalcon_mvc_micro_collection_ce, 1, phalcon_mvc_micro_collectioninterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, delete) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&routePattern); } - if (EXPECTED(Z_TYPE_P(columnName_param) == IS_STRING)) { - zephir_get_strval(&columnName, columnName_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - ZEPHIR_INIT_VAR(&columnName); + zephir_get_strval(&name, name_param); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Dropping DB column is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 299); - return; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "DELETE"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropForeignKey) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL; - zval tableName, schemaName, referenceName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&referenceName); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(referenceName) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (UNEXPECTED(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&routePattern); } - if (EXPECTED(Z_TYPE_P(referenceName_param) == IS_STRING)) { - zephir_get_strval(&referenceName, referenceName_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - ZEPHIR_INIT_VAR(&referenceName); + zephir_get_strval(&name, name_param); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Dropping a foreign key constraint is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 309); - return; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "GET"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropIndex) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, getHandler) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "handler"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, getHandlers) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "handlers"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, getPrefix) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "prefix"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, head) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL; - zval tableName, schemaName, indexName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexName); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(indexName) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&routePattern); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - ZEPHIR_INIT_VAR(&schemaName); + zephir_get_strval(&name, name_param); } - if (UNEXPECTED(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be of the type string")); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HEAD"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, isLazy) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "lazy"); +} + +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, map) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(indexName_param) == IS_STRING)) { - zephir_get_strval(&indexName, indexName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&indexName); + ZEPHIR_INIT_VAR(&routePattern); + } + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + } else { + zephir_get_strval(&name, name_param); } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_CONCAT_SVSVS(return_value, "DROP INDEX \"", &schemaName, "\".\"", &indexName, "\""); - RETURN_MM(); - } - ZEPHIR_CONCAT_SVS(return_value, "DROP INDEX \"", &indexName, "\""); - RETURN_MM(); + ZVAL_NULL(&_0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, mapVia) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *method, method_sub, *name_param = NULL; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&method_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_ZVAL(method) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 3, 1, &routePattern_param, &handler, &method, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&routePattern); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - ZEPHIR_INIT_VAR(&schemaName); + zephir_get_strval(&name, name_param); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Removing a primary key after table has been created is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 331); - return; + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, method, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, options) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, table; - zval tableName, schemaName; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(tableName) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_INIT_VAR(&routePattern); } - if (!ifExists_param) { - ifExists = 1; + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); + zephir_get_strval(&name, name_param); } - ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, &tableName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "OPTIONS"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE IF EXISTS ", &table); - RETURN_MM(); - } - ZEPHIR_CONCAT_SV(return_value, "DROP TABLE ", &table); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, patch) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, view; - zval viewName, schemaName; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&view); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(viewName) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_INIT_VAR(&routePattern); } - if (!ifExists_param) { - ifExists = 1; + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - if (UNEXPECTED(Z_TYPE_P(ifExists_param) != IS_TRUE && Z_TYPE_P(ifExists_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be of the type bool")); - RETURN_MM_NULL(); - } - ifExists = (Z_TYPE_P(ifExists_param) == IS_TRUE); + zephir_get_strval(&name, name_param); } - ZEPHIR_CALL_METHOD(&view, this_ptr, "preparetable", NULL, 0, &viewName, &schemaName); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PATCH"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); zephir_check_call_status(); - if (ifExists) { - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW IF EXISTS ", &view); - RETURN_MM(); - } - ZEPHIR_CONCAT_SV(return_value, "DROP VIEW ", &view); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, forUpdate) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, post) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL; - zval sqlQuery; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&sqlQuery); + ZEPHIR_INIT_VAR(&routePattern); + } + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + } else { + zephir_get_strval(&name, name_param); } - RETURN_CTOR(&sqlQuery); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "POST"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, put) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_12 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, columnType, columnSql, typeValues, _0$$3, _1$$10, _2$$16, _3$$18, _4$$35, _5$$38, _6$$38, _7$$38, value$$40, valueSql$$40, *_8$$40, _9$$40, _17$$40, _18$$40, _19$$40, _20$$40, _10$$41, _11$$41, _13$$41, _14$$42, _15$$42, _16$$42, _21$$43, _22$$43, _23$$43; + zval *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL, _0; + zval routePattern, name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&columnSql); - ZVAL_UNDEF(&typeValues); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$10); - ZVAL_UNDEF(&_2$$16); - ZVAL_UNDEF(&_3$$18); - ZVAL_UNDEF(&_4$$35); - ZVAL_UNDEF(&_5$$38); - ZVAL_UNDEF(&_6$$38); - ZVAL_UNDEF(&_7$$38); - ZVAL_UNDEF(&value$$40); - ZVAL_UNDEF(&valueSql$$40); - ZVAL_UNDEF(&_9$$40); - ZVAL_UNDEF(&_17$$40); - ZVAL_UNDEF(&_18$$40); - ZVAL_UNDEF(&_19$$40); - ZVAL_UNDEF(&_20$$40); - ZVAL_UNDEF(&_10$$41); - ZVAL_UNDEF(&_11$$41); - ZVAL_UNDEF(&_13$$41); - ZVAL_UNDEF(&_14$$42); - ZVAL_UNDEF(&_15$$42); - ZVAL_UNDEF(&_16$$42); - ZVAL_UNDEF(&_21$$43); - ZVAL_UNDEF(&_22$$43); - ZVAL_UNDEF(&_23$$43); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 2, 1, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); + } else { + ZEPHIR_INIT_VAR(&routePattern); + } + if (!name_param) { + ZEPHIR_INIT_VAR(&name); + } else { + zephir_get_strval(&name, name_param); + } - ZEPHIR_CALL_METHOD(&columnSql, this_ptr, "checkcolumntypesql", NULL, 0, column); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&columnType, this_ptr, "checkcolumntype", NULL, 0, column); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PUT"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "addmap", NULL, 0, &_0, &routePattern, handler, &name); zephir_check_call_status(); - do { - if (ZEPHIR_IS_LONG(&columnType, 14)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BIGINT")); - } - ZEPHIR_CALL_METHOD(&_0$$3, column, "isunsigned", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_0$$3)) { - zephir_concat_self_str(&columnSql, SL(" UNSIGNED")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 11)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("BLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 8)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYINT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 5)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("CHARACTER")); - } - ZEPHIR_CALL_METHOD(&_1$$10, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_1$$10); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 1)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DATE")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 4)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DATETIME")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 3)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("NUMERIC")); - } - ZEPHIR_CALL_METHOD(&_2$$16, this_ptr, "getcolumnsizeandscale", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_2$$16); - break; - } - if (ZEPHIR_IS_LONG(&columnType, 9)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("DOUBLE")); - } - ZEPHIR_CALL_METHOD(&_3$$18, column, "isunsigned", NULL, 0); - zephir_check_call_status(); - if (zephir_is_true(&_3$$18)) { - zephir_concat_self_str(&columnSql, SL(" UNSIGNED")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 7)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("FLOAT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 0)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("INTEGER")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 13)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("LONGBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 12)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("MEDIUMBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 6)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TEXT")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 17)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TIMESTAMP")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 10)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("TINYBLOB")); - } - break; - } - if (ZEPHIR_IS_LONG(&columnType, 2)) { - if (ZEPHIR_IS_EMPTY(&columnSql)) { - zephir_concat_self_str(&columnSql, SL("VARCHAR")); - } - ZEPHIR_CALL_METHOD(&_4$$35, this_ptr, "getcolumnsize", NULL, 0, column); - zephir_check_call_status(); - zephir_concat_self(&columnSql, &_4$$35); - break; - } - if (ZEPHIR_IS_EMPTY(&columnSql)) { - ZEPHIR_INIT_VAR(&_5$$38); - object_init_ex(&_5$$38, phalcon_db_exception_ce); - ZEPHIR_CALL_METHOD(&_6$$38, column, "getname", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_7$$38); - ZEPHIR_CONCAT_SV(&_7$$38, "Unrecognized SQLite data type at column ", &_6$$38); - ZEPHIR_CALL_METHOD(NULL, &_5$$38, "__construct", NULL, 29, &_7$$38); - zephir_check_call_status(); - zephir_throw_exception_debug(&_5$$38, "phalcon/Db/Dialect/Sqlite.zep", 520); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL, 0); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&typeValues))) { - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&valueSql$$40); - ZVAL_STRING(&valueSql$$40, ""); - zephir_is_iterable(&typeValues, 0, "phalcon/Db/Dialect/Sqlite.zep", 534); - if (Z_TYPE_P(&typeValues) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&typeValues), _8$$40) - { - ZEPHIR_INIT_NVAR(&value$$40); - ZVAL_COPY(&value$$40, _8$$40); - ZEPHIR_INIT_NVAR(&_10$$41); - ZVAL_STRING(&_10$$41, "\""); - ZEPHIR_CALL_FUNCTION(&_11$$41, "addcslashes", &_12, 214, &value$$40, &_10$$41); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_13$$41); - ZEPHIR_CONCAT_SVS(&_13$$41, "\"", &_11$$41, "\", "); - zephir_concat_self(&valueSql$$40, &_13$$41); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &typeValues, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9$$40, &typeValues, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9$$40)) { - break; - } - ZEPHIR_CALL_METHOD(&value$$40, &typeValues, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_14$$42); - ZVAL_STRING(&_14$$42, "\""); - ZEPHIR_CALL_FUNCTION(&_15$$42, "addcslashes", &_12, 214, &value$$40, &_14$$42); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_16$$42); - ZEPHIR_CONCAT_SVS(&_16$$42, "\"", &_15$$42, "\", "); - zephir_concat_self(&valueSql$$40, &_16$$42); - ZEPHIR_CALL_METHOD(NULL, &typeValues, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value$$40); - ZVAL_LONG(&_17$$40, 0); - ZVAL_LONG(&_18$$40, -2); - ZEPHIR_INIT_VAR(&_19$$40); - zephir_substr(&_19$$40, &valueSql$$40, 0 , -2 , 0); - ZEPHIR_INIT_VAR(&_20$$40); - ZEPHIR_CONCAT_SVS(&_20$$40, "(", &_19$$40, ")"); - zephir_concat_self(&columnSql, &_20$$40); - } else { - ZEPHIR_INIT_VAR(&_21$$43); - ZVAL_STRING(&_21$$43, "\""); - ZEPHIR_CALL_FUNCTION(&_22$$43, "addcslashes", &_12, 214, &typeValues, &_21$$43); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_23$$43); - ZEPHIR_CONCAT_SVS(&_23$$43, "(\"", &_22$$43, "\")"); - zephir_concat_self(&columnSql, &_23$$43); - } - } - } while(0); - - RETURN_CCTOR(&columnSql); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listIndexesSql) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, setHandler) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, *keyName_param = NULL, _0, _1, _2$$3, _3$$3; - zval table, schema, keyName, sql; + zend_bool lazy; + zval *handler, handler_sub, *lazy_param = NULL, __$true, __$false; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&handler_sub); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ZVAL(handler) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - Z_PARAM_STR_OR_NULL(keyName) + Z_PARAM_BOOL(lazy) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &table_param, &schema_param, &keyName_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } - if (!keyName_param) { - ZEPHIR_INIT_VAR(&keyName); + zephir_fetch_params_without_memory_grow(1, 1, &handler, &lazy_param); + if (!lazy_param) { + lazy = 0; } else { - zephir_get_strval(&keyName, keyName_param); + lazy = zephir_get_boolval(lazy_param); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 53, &table); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_CONCAT_SVS(&_1, "SELECT sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ", &_0, " COLLATE NOCASE"); - zephir_get_strval(&sql, &_1); - if (!(ZEPHIR_IS_EMPTY(&keyName))) { - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "escape", NULL, 53, &keyName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_3$$3); - ZEPHIR_CONCAT_SVS(&_3$$3, " AND name = ", &_2$$3, " COLLATE NOCASE"); - zephir_concat_self(&sql, &_3$$3); + zephir_update_property_zval(this_ptr, ZEND_STRL("handler"), handler); + if (lazy) { + zephir_update_property_zval(this_ptr, ZEND_STRL("lazy"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("lazy"), &__$false); } - RETURN_CTOR(&sql); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listTables) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, setLazy) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; + zval *lazy_param = NULL, __$true, __$false; + zend_bool lazy; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_BOOL(lazy) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); + zephir_fetch_params_without_memory_grow(1, 0, &lazy_param); + if (UNEXPECTED(Z_TYPE_P(lazy_param) != IS_TRUE && Z_TYPE_P(lazy_param) != IS_FALSE)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'lazy' must be of the type bool")); + RETURN_NULL(); } + lazy = (Z_TYPE_P(lazy_param) == IS_TRUE); - RETURN_MM_STRING("SELECT tbl_name FROM sqlite_master WHERE type = 'table' ORDER BY tbl_name"); + if (lazy) { + zephir_update_property_zval(this_ptr, ZEND_STRL("lazy"), &__$true); + } else { + zephir_update_property_zval(this_ptr, ZEND_STRL("lazy"), &__$false); + } + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listViews) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, setPrefix) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *schemaName_param = NULL; - zval schemaName; + zval *prefix_param = NULL; + zval prefix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&prefix); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(prefix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &prefix_param); + if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(&prefix, prefix_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } + ZEPHIR_INIT_VAR(&prefix); } - RETURN_MM_STRING("SELECT tbl_name FROM sqlite_master WHERE type = 'view' ORDER BY tbl_name"); + zephir_update_property_zval(this_ptr, ZEND_STRL("prefix"), &prefix); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, modifyColumn) +static PHP_METHOD(Phalcon_Mvc_Micro_Collection, addMap) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, *currentColumn = NULL, currentColumn_sub, __$null; - zval tableName, schemaName; + zval routePattern, name; + zval *method, method_sub, *routePattern_param = NULL, *handler, handler_sub, *name_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(¤tColumn_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&method_sub); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&routePattern); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + Z_PARAM_ZVAL(method) + Z_PARAM_STR(routePattern) + Z_PARAM_ZVAL(handler) Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(currentColumn, phalcon_db_columninterface_ce) + Z_PARAM_STR_OR_NULL(name) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 3, 1, &method, &routePattern_param, &handler, &name_param); + if (UNEXPECTED(Z_TYPE_P(routePattern_param) != IS_STRING && Z_TYPE_P(routePattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'routePattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(routePattern_param) == IS_STRING)) { + zephir_get_strval(&routePattern, routePattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&routePattern); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!name_param) { + ZEPHIR_INIT_VAR(&name); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!currentColumn) { - currentColumn = ¤tColumn_sub; - currentColumn = &__$null; + zephir_get_strval(&name, name_param); } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Altering a DB column is not supported by SQLite", "phalcon/Db/Dialect/Sqlite.zep", 593); - return; + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 4, 0); + zephir_array_fast_append(&_0, method); + zephir_array_fast_append(&_0, &routePattern); + zephir_array_fast_append(&_0, handler); + zephir_array_fast_append(&_0, &name); + zephir_update_property_array_append(this_ptr, SL("handlers"), &_0); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, sharedLock) +zend_object *zephir_init_properties_Phalcon_Mvc_Micro_Collection(zend_class_entry *class_type) { + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlQuery_param = NULL; - zval sqlQuery; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlQuery); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) - ZEND_PARSE_PARAMETERS_END(); -#endif - + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("handlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("handlers"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } +} - RETURN_CTOR(&sqlQuery); -} -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableExists) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM sqlite_master WHERE type='table' AND tbl_name='", &tableName, "'"); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableOptions) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro_CollectionInterface) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *table_param = NULL, *schema_param = NULL; - zval table, schema; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - ZEND_PARSE_PARAMETERS_END(); -#endif - + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Micro, CollectionInterface, phalcon, mvc_micro_collectioninterface, phalcon_mvc_micro_collectioninterface_method_entry); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - zephir_get_strval(&schema, schema_param); - } + return SUCCESS; +} +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, delete); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, get); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, getHandler); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, getHandlers); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, getPrefix); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, head); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, isLazy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, map); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, options); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, patch); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, post); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, put); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, setHandler); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, setLazy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_CollectionInterface, setPrefix); - RETURN_MM_STRING(""); -} -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, truncateTable) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *tableName_param = NULL, *schemaName_param = NULL; - zval tableName, schemaName, table; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&table); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!(ZEPHIR_IS_EMPTY(&schemaName))) { - ZEPHIR_INIT_VAR(&table); - ZEPHIR_CONCAT_SVSVS(&table, "\"", &schemaName, "\".\"", &tableName, "\""); - } else { - ZEPHIR_INIT_NVAR(&table); - ZEPHIR_CONCAT_SVS(&table, "\"", &tableName, "\""); - } - ZEPHIR_CONCAT_SV(return_value, "DELETE FROM ", &table); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro_Exception) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *viewName_param = NULL, *schemaName_param = NULL; - zval viewName, schemaName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Micro, Exception, phalcon, mvc_micro_exception, zend_ce_exception, NULL, 0); - ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM sqlite_master WHERE type='view' AND tbl_name='", &viewName, "'"); - RETURN_MM(); + return SUCCESS; } @@ -55036,745 +60006,505 @@ static PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) - - -ZEPHIR_INIT_CLASS(Phalcon_Db_Result_PdoResult) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro_LazyLoader) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Db\\Result, PdoResult, phalcon, db_result_pdoresult, phalcon_db_result_pdoresult_method_entry, 0); - - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("bindParams"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("bindTypes"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("connection"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_result_pdoresult_ce, SL("fetchMode"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("pdoStatement"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("result"), ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_result_pdoresult_ce, SL("rowCount"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_result_pdoresult_ce, SL("sqlStatement"), ZEND_ACC_PROTECTED); - phalcon_db_result_pdoresult_ce->create_object = zephir_init_properties_Phalcon_Db_Result_PdoResult; + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Micro, LazyLoader, phalcon, mvc_micro_lazyloader, phalcon_mvc_micro_lazyloader_method_entry, 0); - zend_class_implements(phalcon_db_result_pdoresult_ce, 1, phalcon_db_resultinterface_ce); + zend_declare_property_null(phalcon_mvc_micro_lazyloader_ce, SL("definition"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_micro_lazyloader_ce, SL("handler"), ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Result_PdoResult, __construct) +static PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __construct) { - zval *connection, connection_sub, *result, result_sub, *sqlStatement = NULL, sqlStatement_sub, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *definition_param = NULL; + zval definition; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection_sub); - ZVAL_UNDEF(&result_sub); - ZVAL_UNDEF(&sqlStatement_sub); - ZVAL_UNDEF(&bindParams_sub); - ZVAL_UNDEF(&bindTypes_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&definition); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 5) - Z_PARAM_OBJECT_OF_CLASS(connection, phalcon_db_adapter_adapterinterface_ce) - Z_PARAM_OBJECT_OF_CLASS(result, zephir_get_internal_ce(SL("pdostatement"))) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(sqlStatement) - Z_PARAM_ZVAL_OR_NULL(bindParams) - Z_PARAM_ZVAL_OR_NULL(bindTypes) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(definition) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(2, 3, &connection, &result, &sqlStatement, &bindParams, &bindTypes); - if (!sqlStatement) { - sqlStatement = &sqlStatement_sub; - sqlStatement = &__$null; - } - if (!bindParams) { - bindParams = &bindParams_sub; - bindParams = &__$null; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &definition_param); + if (UNEXPECTED(Z_TYPE_P(definition_param) != IS_STRING && Z_TYPE_P(definition_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'definition' must be of the type string")); + RETURN_MM_NULL(); } - if (!bindTypes) { - bindTypes = &bindTypes_sub; - bindTypes = &__$null; + if (EXPECTED(Z_TYPE_P(definition_param) == IS_STRING)) { + zephir_get_strval(&definition, definition_param); + } else { + ZEPHIR_INIT_VAR(&definition); } - zephir_update_property_zval(this_ptr, ZEND_STRL("connection"), connection); - zephir_update_property_zval(this_ptr, ZEND_STRL("pdoStatement"), result); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlStatement"), sqlStatement); - zephir_update_property_zval(this_ptr, ZEND_STRL("bindParams"), bindParams); - zephir_update_property_zval(this_ptr, ZEND_STRL("bindTypes"), bindTypes); + zephir_update_property_zval(this_ptr, ZEND_STRL("definition"), &definition); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Result_PdoResult, dataSeek) +static PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, callMethod) { - long n = 0; + zval _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zval *number_param = NULL, connection, pdo, sqlStatement, bindParams, statement, _0, _1$$4, _2$$4, _3$$6; - zend_long number, ZEPHIR_LAST_CALL_STATUS; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *method_param = NULL, *arguments = NULL, arguments_sub, *modelBinder = NULL, modelBinder_sub, __$null, handler, definition, bindCacheKey, _0, _1$$4, _2$$4, _3$$5; + zval method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&connection); - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&bindParams); - ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&arguments_sub); + ZVAL_UNDEF(&modelBinder_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&bindCacheKey); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_LONG(number) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(method) + Z_PARAM_ZVAL(arguments) + Z_PARAM_OPTIONAL + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(modelBinder, phalcon_mvc_model_binderinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &number_param); - number = zephir_get_intval(number_param); + zephir_fetch_params(1, 2, 1, &method_param, &arguments, &modelBinder); + if (UNEXPECTED(Z_TYPE_P(method_param) != IS_STRING && Z_TYPE_P(method_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'method' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(method_param) == IS_STRING)) { + zephir_get_strval(&method, method_param); + } else { + ZEPHIR_INIT_VAR(&method); + } + ZEPHIR_SEPARATE_PARAM(arguments); + if (!modelBinder) { + modelBinder = &modelBinder_sub; + modelBinder = &__$null; + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&connection, &_0); - ZEPHIR_CALL_METHOD(&pdo, &connection, "getinternalhandler", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("sqlStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&sqlStatement, &_0); - zephir_read_property(&_0, this_ptr, ZEND_STRL("bindParams"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&bindParams, &_0); - if (Z_TYPE_P(&bindParams) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&statement, &pdo, "prepare", NULL, 0, &sqlStatement); - zephir_check_call_status(); - if (Z_TYPE_P(&statement) == IS_OBJECT) { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("bindTypes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1$$4, &connection, "executeprepared", NULL, 0, &statement, &bindParams, &_2$$4); + zephir_read_property(&_0, this_ptr, ZEND_STRL("handler"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&handler, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("definition"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&definition, &_0); + if (Z_TYPE_P(&handler) != IS_OBJECT) { + if (!(zephir_class_exists(&definition, 1))) { + ZEPHIR_INIT_VAR(&_1$$4); + object_init_ex(&_1$$4, phalcon_mvc_micro_exception_ce); + ZEPHIR_INIT_VAR(&_2$$4); + ZEPHIR_CONCAT_SVS(&_2$$4, "Handler '", &definition, "' doesn't exist"); + ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", NULL, 32, &_2$$4); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&statement, &_1$$4); + zephir_throw_exception_debug(&_1$$4, "phalcon/Mvc/Micro/LazyLoader.zep", 55); + ZEPHIR_MM_RESTORE(); + return; } - } else { - ZEPHIR_CALL_METHOD(&statement, &pdo, "query", NULL, 0, &sqlStatement); + ZEPHIR_INIT_NVAR(&handler); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&handler, &definition); zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("handler"), &handler); } - zephir_update_property_zval(this_ptr, ZEND_STRL("pdoStatement"), &statement); - n = -1; - number--; - while (1) { - if (!(n != number)) { - break; - } - zephir_read_property(&_3$$6, this_ptr, ZEND_STRL("fetchMode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(NULL, &statement, "fetch", &_4, 0, &_3$$6); + if (Z_TYPE_P(modelBinder) != IS_NULL) { + ZEPHIR_INIT_VAR(&bindCacheKey); + ZEPHIR_CONCAT_SVSV(&bindCacheKey, "_PHMB_", &definition, "_", &method); + ZEPHIR_CALL_METHOD(&_3$$5, modelBinder, "bindtohandler", NULL, 0, &handler, arguments, &bindCacheKey, &method); zephir_check_call_status(); - n++; + ZEPHIR_CPY_WRT(arguments, &_3$$5); } - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&_4); + zephir_create_array(&_4, 2, 0); + zephir_array_fast_append(&_4, &handler); + zephir_array_fast_append(&_4, &method); + ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_4, arguments); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Result_PdoResult, execute) +static PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, getDefinition) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "execute", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "definition"); } -static PHP_METHOD(Phalcon_Db_Result_PdoResult, fetch) +static PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, getHandler) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *fetchStyle_param = NULL, *cursorOrientation_param = NULL, *cursorOffset_param = NULL, mode, _0, _1, _2; - zend_long fetchStyle, cursorOrientation, cursorOffset, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&mode); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 3) - Z_PARAM_OPTIONAL - Z_PARAM_LONG_OR_NULL(fetchStyle, is_null_true) - Z_PARAM_LONG(cursorOrientation) - Z_PARAM_LONG(cursorOffset) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &fetchStyle_param, &cursorOrientation_param, &cursorOffset_param); - if (!fetchStyle_param) { - fetchStyle = 0; - } else { - fetchStyle = zephir_get_intval(fetchStyle_param); - } - if (!cursorOrientation_param) { - cursorOrientation = 0; - } else { - cursorOrientation = zephir_get_intval(cursorOrientation_param); - } - if (!cursorOffset_param) { - cursorOffset = 0; - } else { - cursorOffset = zephir_get_intval(cursorOffset_param); - } + RETURN_MEMBER(getThis(), "handler"); +} - if (1 == 1) { - ZEPHIR_INIT_VAR(&mode); - ZVAL_LONG(&mode, fetchStyle); - } else { - ZEPHIR_OBS_NVAR(&mode); - zephir_read_property(&mode, this_ptr, ZEND_STRL("fetchMode"), PH_NOISY_CC); - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, cursorOrientation); - ZVAL_LONG(&_2, cursorOffset); - ZEPHIR_RETURN_CALL_METHOD(&_0, "fetch", NULL, 0, &mode, &_1, &_2); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Result_PdoResult, fetchAll) -{ - zend_bool _2; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *mode_param = NULL, *fetchArgument = NULL, fetchArgument_sub, *constructorArgs = NULL, constructorArgs_sub, __$null, _0$$3, _1$$3, _5, _6, _3$$4, _4$$4; - zend_long mode, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&fetchArgument_sub); - ZVAL_UNDEF(&constructorArgs_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 3) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(mode) - Z_PARAM_ZVAL(fetchArgument) - Z_PARAM_ZVAL_OR_NULL(constructorArgs) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 3, &mode_param, &fetchArgument, &constructorArgs); - if (!mode_param) { - mode = 0; - } else { - mode = zephir_get_intval(mode_param); - } - if (!fetchArgument) { - fetchArgument = &fetchArgument_sub; - ZEPHIR_INIT_VAR(fetchArgument); - ZVAL_LONG(fetchArgument, 0); - } - if (!constructorArgs) { - constructorArgs = &constructorArgs_sub; - constructorArgs = &__$null; - } - if (mode == 8) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1$$3, mode); - ZEPHIR_RETURN_CALL_METHOD(&_0$$3, "fetchall", NULL, 0, &_1$$3, fetchArgument, constructorArgs); - zephir_check_call_status(); - RETURN_MM(); - } - _2 = mode == 7; - if (!(_2)) { - _2 = mode == 10; - } - if (_2) { - zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_4$$4, mode); - ZEPHIR_RETURN_CALL_METHOD(&_3$$4, "fetchall", NULL, 0, &_4$$4, fetchArgument); - zephir_check_call_status(); - RETURN_MM(); - } - zephir_read_property(&_5, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_6, mode); - ZEPHIR_RETURN_CALL_METHOD(&_5, "fetchall", NULL, 0, &_6); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Result_PdoResult, fetchArray) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Micro_MiddlewareInterface) { - zval _0, _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Micro, MiddlewareInterface, phalcon, mvc_micro_middlewareinterface, phalcon_mvc_micro_middlewareinterface_method_entry); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + return SUCCESS; +} +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Micro_MiddlewareInterface, call); - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("fetchMode"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "fetch", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Result_PdoResult, getInternalResult) -{ - zval *this_ptr = getThis(); +#ifdef HAVE_CONFIG_H +#endif - RETURN_MEMBER(getThis(), "pdoStatement"); -} -static PHP_METHOD(Phalcon_Db_Result_PdoResult, numRows) -{ - zend_bool _2$$3; - zval sqlStatement, rowCount, connection, type, pdoStatement, matches, result, row, _0, _1$$3, _3$$4, _4$$5, _5$$6, _6$$6, _7$$6, _8$$7, _9$$7, _10$$7, _11$$7; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&rowCount); - ZVAL_UNDEF(&connection); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&pdoStatement); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&row); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_9$$7); - ZVAL_UNDEF(&_10$$7); - ZVAL_UNDEF(&_11$$7); +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Url, Exception, phalcon, mvc_url_exception, zend_ce_exception, NULL, 0); + return SUCCESS; +} - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("rowCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&rowCount, &_0); - if (ZEPHIR_IS_FALSE_IDENTICAL(&rowCount)) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("connection"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&connection, &_1$$3); - ZEPHIR_CALL_METHOD(&type, &connection, "gettype", NULL, 0); - zephir_check_call_status(); - _2$$3 = ZEPHIR_IS_STRING_IDENTICAL(&type, "mysql"); - if (!(_2$$3)) { - _2$$3 = ZEPHIR_IS_STRING_IDENTICAL(&type, "pgsql"); - } - if (_2$$3) { - zephir_read_property(&_3$$4, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdoStatement, &_3$$4); - ZEPHIR_CALL_METHOD(&rowCount, &pdoStatement, "rowcount", NULL, 0); - zephir_check_call_status(); - } - if (ZEPHIR_IS_FALSE_IDENTICAL(&rowCount)) { - zephir_read_property(&_4$$5, this_ptr, ZEND_STRL("sqlStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&sqlStatement, &_4$$5); - if (!(zephir_start_with_str(&sqlStatement, SL("SELECT COUNT(*) ")))) { - ZEPHIR_INIT_VAR(&matches); - ZVAL_NULL(&matches); - ZEPHIR_INIT_VAR(&_5$$6); - ZVAL_STRING(&_5$$6, "/^SELECT\\s+(.*)/i"); - ZEPHIR_INIT_VAR(&_6$$6); - ZEPHIR_INIT_VAR(&_7$$6); - ZVAL_STRING(&_7$$6, "/^SELECT\\s+(.*)/i"); - zephir_preg_match(&_6$$6, &_7$$6, &sqlStatement, &matches, 0, 0 , 0 ); - if (zephir_is_true(&_6$$6)) { - zephir_array_fetch_long(&_8$$7, &matches, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Result/PdoResult.zep", 315); - ZEPHIR_INIT_VAR(&_9$$7); - ZEPHIR_CONCAT_SVS(&_9$$7, "SELECT COUNT(*) \"numrows\" FROM (SELECT ", &_8$$7, ")"); - zephir_read_property(&_10$$7, this_ptr, ZEND_STRL("bindParams"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_11$$7, this_ptr, ZEND_STRL("bindTypes"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&result, &connection, "query", NULL, 0, &_9$$7, &_10$$7, &_11$$7); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&row, &result, "fetch", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&rowCount); - zephir_array_fetch_string(&rowCount, &row, SL("numrows"), PH_NOISY, "phalcon/Db/Result/PdoResult.zep", 321); - } - } else { - ZEPHIR_INIT_NVAR(&rowCount); - ZVAL_LONG(&rowCount, 1); - } - } - zephir_update_property_zval(this_ptr, ZEND_STRL("rowCount"), &rowCount); - } - RETURN_CCTOR(&rowCount); -} -static PHP_METHOD(Phalcon_Db_Result_PdoResult, setFetchMode) -{ - zend_bool _1; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *fetchMode_param = NULL, *colNoOrClassNameOrObject = NULL, colNoOrClassNameOrObject_sub, *ctorargs = NULL, ctorargs_sub, __$null, pdoStatement, _0, _2$$3, _3$$3, _4$$5, _5$$5, _6$$7, _7$$7; - zend_long fetchMode, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&colNoOrClassNameOrObject_sub); - ZVAL_UNDEF(&ctorargs_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&pdoStatement); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$5); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$7); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_LONG(fetchMode) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(colNoOrClassNameOrObject) - Z_PARAM_ZVAL_OR_NULL(ctorargs) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &fetchMode_param, &colNoOrClassNameOrObject, &ctorargs); - fetchMode = zephir_get_intval(fetchMode_param); - if (!colNoOrClassNameOrObject) { - colNoOrClassNameOrObject = &colNoOrClassNameOrObject_sub; - colNoOrClassNameOrObject = &__$null; - } - if (!ctorargs) { - ctorargs = &ctorargs_sub; - ctorargs = &__$null; - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdoStatement"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdoStatement, &_0); - _1 = fetchMode == 8; - if (!(_1)) { - _1 = fetchMode == 9; - } - if (_1) { - ZVAL_LONG(&_3$$3, fetchMode); - ZEPHIR_CALL_METHOD(&_2$$3, &pdoStatement, "setfetchmode", NULL, 0, &_3$$3, colNoOrClassNameOrObject, ctorargs); - zephir_check_call_status(); - if (!(zephir_is_true(&_2$$3))) { - RETURN_MM_BOOL(0); - } - } else if (fetchMode == 7) { - ZVAL_LONG(&_5$$5, fetchMode); - ZEPHIR_CALL_METHOD(&_4$$5, &pdoStatement, "setfetchmode", NULL, 0, &_5$$5, colNoOrClassNameOrObject); - zephir_check_call_status(); - if (!(zephir_is_true(&_4$$5))) { - RETURN_MM_BOOL(0); - } - } else { - ZVAL_LONG(&_7$$7, fetchMode); - ZEPHIR_CALL_METHOD(&_6$$7, &pdoStatement, "setfetchmode", NULL, 0, &_7$$7); - zephir_check_call_status(); - if (!(zephir_is_true(&_6$$7))) { - RETURN_MM_BOOL(0); - } - } - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, fetchMode); - zephir_update_property_zval(this_ptr, ZEND_STRL("fetchMode"), &_0); - RETURN_MM_BOOL(1); -} - -zend_object *zephir_init_properties_Phalcon_Db_Result_PdoResult(zend_class_entry *class_type) -{ - zval _0, _2, _1$$3, _3$$4; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); - - - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("bindTypes"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("bindTypes"), &_1$$3); - } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("bindParams"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("bindParams"), &_3$$4); - } - ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); - } -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - -ZEPHIR_INIT_CLASS(Phalcon_Db_Profiler_Item) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_UrlInterface) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Db\\Profiler, Item, phalcon, db_profiler_item, phalcon_db_profiler_item_method_entry, 0); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Url, UrlInterface, phalcon, mvc_url_urlinterface, phalcon_mvc_url_urlinterface_method_entry); - zend_declare_property_null(phalcon_db_profiler_item_ce, SL("finalTime"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_profiler_item_ce, SL("initialTime"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_profiler_item_ce, SL("sqlBindTypes"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_profiler_item_ce, SL("sqlStatement"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_profiler_item_ce, SL("sqlVariables"), ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Profiler_Item, getFinalTime) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "finalTime"); -} - -static PHP_METHOD(Phalcon_Db_Profiler_Item, getInitialTime) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "initialTime"); -} +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, get); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, getBasePath); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, getBaseUri); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, setBasePath); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, setBaseUri); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Url_UrlInterface, path); -static PHP_METHOD(Phalcon_Db_Profiler_Item, getSqlBindTypes) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "sqlBindTypes"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Db_Profiler_Item, getSqlStatement) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "sqlStatement"); -} -static PHP_METHOD(Phalcon_Db_Profiler_Item, getSqlVariables) +static void phalcon_get_uri(zval *return_value, zval *path) { - zval *this_ptr = getThis(); + int i, found = 0, mark = 0; + char *cursor, *str, ch; + if (Z_TYPE_P(path) != IS_STRING) { + RETURN_EMPTY_STRING(); + } + if (Z_STRLEN_P(path) > 0) { + cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1; + for (i = Z_STRLEN_P(path); i > 0; i--) { + ch = *cursor; + if (ch == '/' || ch == '\\') { + found++; + if (found == 1) { + mark = i - 1; + } else { + str = emalloc(mark - i + 1); + memcpy(str, Z_STRVAL_P(path) + i, mark - i); + str[mark - i] = '\0'; + ZVAL_STRINGL(return_value, str, mark - i); + return; + } + } + cursor--; + } + } - RETURN_MEMBER(getThis(), "sqlVariables"); + RETURN_EMPTY_STRING(); } -static PHP_METHOD(Phalcon_Db_Profiler_Item, getTotalElapsedNanoseconds) +zval *phalcon_replace_marker(int named, zval *paths, zval *replacements, unsigned long *position, char *cursor, char *marker) { - zval _0, _1; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - - + unsigned int length = 0, variable_length, ch, j; + char *item = NULL, *cursor_var, *variable = NULL; + int not_valid = 0; + zval *zv, *tmp; - zephir_read_property(&_0, this_ptr, ZEND_STRL("finalTime"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, ZEND_STRL("initialTime"), PH_NOISY_CC | PH_READONLY); - zephir_sub_function(return_value, &_0, &_1); - return; -} + if (named) { + length = cursor - marker - 1; + item = estrndup(marker + 1, length); + cursor_var = item; + marker = item; + for (j = 0; j < length; j++) { + ch = *cursor_var; + if (ch == '\0') { + not_valid = 1; + break; + } + if (j == 0 && !((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z'))){ + not_valid = 1; + break; + } + if ((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '_' || ch == ':') { + if (ch == ':') { + variable_length = cursor_var - marker; + variable = estrndup(marker, variable_length); + break; + } + } else { + not_valid = 1; + break; + } + cursor_var++; + } + } -static PHP_METHOD(Phalcon_Db_Profiler_Item, getTotalElapsedMilliseconds) -{ - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + if (!not_valid) { - ZVAL_UNDEF(&_0); + if (zend_hash_index_exists(Z_ARRVAL_P(paths), *position)) { + if (named) { + if (variable) { + efree(item); + item = variable; + length = variable_length; + } + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), item, length)) { + if ((zv = zend_hash_str_find(Z_ARRVAL_P(replacements), item, length)) != NULL) { + efree(item); + (*position)++; + return zv; + } + } + } else { + if ((zv = zend_hash_index_find(Z_ARRVAL_P(paths), *position)) != NULL) { + if (Z_TYPE_P(zv) == IS_STRING) { + if (zend_hash_str_exists(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) { + if ((tmp = zend_hash_str_find(Z_ARRVAL_P(replacements), Z_STRVAL_P(zv), Z_STRLEN_P(zv))) != NULL) { + (*position)++; + return tmp; + } + } + } + } + } + } + (*position)++; + } - ZEPHIR_MM_GROW(); + if (item) { + efree(item); + } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettotalelapsednanoseconds", NULL, 0); - zephir_check_call_status(); - RETURN_MM_DOUBLE(zephir_safe_div_zval_long(&_0, 1000000)); + return NULL; } -static PHP_METHOD(Phalcon_Db_Profiler_Item, getTotalElapsedSeconds) +static void phalcon_replace_paths(zval *return_value, zval *pattern, zval *paths, zval *replacements) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettotalelapsedmilliseconds", NULL, 0); - zephir_check_call_status(); - RETURN_MM_DOUBLE(zephir_safe_div_zval_long(&_0, 1000)); -} + char *cursor, *marker = NULL; + unsigned int bracket_count = 0, parentheses_count = 0, intermediate = 0; + unsigned char ch; + smart_str route_str = {0}; + zend_ulong position = 1; + int i; + zval *replace, replace_copy; + int use_copy, looking_placeholder = 0; -static PHP_METHOD(Phalcon_Db_Profiler_Item, setFinalTime) -{ - zval *finalTime_param = NULL, _0; - double finalTime; - zval *this_ptr = getThis(); + if (Z_TYPE_P(pattern) != IS_STRING || Z_TYPE_P(replacements) != IS_ARRAY || Z_TYPE_P(paths) != IS_ARRAY) { + ZVAL_NULL(return_value); + php_error_docref(NULL, E_WARNING, "Invalid arguments supplied for phalcon_replace_paths()"); + return; + } - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(finalTime) - ZEND_PARSE_PARAMETERS_END(); -#endif + if (Z_STRLEN_P(pattern) <= 0) { + ZVAL_FALSE(return_value); + return; + } + cursor = Z_STRVAL_P(pattern); + if (*cursor == '/') { + ++cursor; + i = 1; + } + else { + i = 0; + } - zephir_fetch_params_without_memory_grow(1, 0, &finalTime_param); - finalTime = zephir_get_doubleval(finalTime_param); + if (!zend_hash_num_elements(Z_ARRVAL_P(paths))) { + ZVAL_STRINGL(return_value, Z_STRVAL_P(pattern) + i, Z_STRLEN_P(pattern) - i); + return; + } + for (; i < Z_STRLEN_P(pattern); ++i) { - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_DOUBLE(&_0, finalTime); - zephir_update_property_zval(this_ptr, ZEND_STRL("finalTime"), &_0); - RETURN_THISW(); -} + ch = *cursor; + if (ch == '\0') { + break; + } -static PHP_METHOD(Phalcon_Db_Profiler_Item, setInitialTime) -{ - zval *initialTime_param = NULL, _0; - double initialTime; - zval *this_ptr = getThis(); + if (parentheses_count == 0 && !looking_placeholder) { + if (ch == '{') { + if (bracket_count == 0) { + marker = cursor; + intermediate = 0; + } + bracket_count++; + } else { + if (ch == '}') { + bracket_count--; + if (intermediate > 0) { + if (bracket_count == 0) { + replace = phalcon_replace_marker(1, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { + use_copy = zend_make_printable_zval(replace, &replace_copy); + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(initialTime) - ZEND_PARSE_PARAMETERS_END(); -#endif + if (bracket_count == 0 && !looking_placeholder) { + if (ch == '(') { + if (parentheses_count == 0) { + marker = cursor; + intermediate = 0; + } + parentheses_count++; + } else { + if (ch == ')') { + parentheses_count--; + if (intermediate > 0) { + if (parentheses_count == 0) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { + use_copy = zend_make_printable_zval(replace, &replace_copy); + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + cursor++; + continue; + } + } + } + } + } + if (bracket_count == 0 && parentheses_count == 0) { + if (looking_placeholder) { + if (intermediate > 0) { + if (ch < 'a' || ch > 'z' || i == (Z_STRLEN_P(pattern) - 1)) { + replace = phalcon_replace_marker(0, paths, replacements, &position, cursor, marker); + if (replace) { + use_copy = 0; + if (Z_TYPE_P(replace) != IS_STRING) { + use_copy = zend_make_printable_zval(replace, &replace_copy); + if (use_copy) { + replace = &replace_copy; + } + } + smart_str_appendl(&route_str, Z_STRVAL_P(replace), Z_STRLEN_P(replace)); + if (use_copy) { + zval_dtor(&replace_copy); + } + } + looking_placeholder = 0; + continue; + } + } + } else { + if (ch == ':') { + looking_placeholder = 1; + marker = cursor; + intermediate = 0; + } + } + } - zephir_fetch_params_without_memory_grow(1, 0, &initialTime_param); - initialTime = zephir_get_doubleval(initialTime_param); + if (bracket_count > 0 || parentheses_count > 0 || looking_placeholder) { + intermediate++; + } else { + smart_str_appendc(&route_str, ch); + } + cursor++; + } + smart_str_0(&route_str); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_DOUBLE(&_0, initialTime); - zephir_update_property_zval(this_ptr, ZEND_STRL("initialTime"), &_0); - RETURN_THISW(); + if (route_str.s) { + RETURN_STR(route_str.s); + } else { + smart_str_free(&route_str); + RETURN_EMPTY_STRING(); + } } -static PHP_METHOD(Phalcon_Db_Profiler_Item, setSqlBindTypes) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlBindTypes_param = NULL; - zval sqlBindTypes; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlBindTypes); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(sqlBindTypes) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlBindTypes_param); - zephir_get_arrval(&sqlBindTypes, sqlBindTypes_param); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlBindTypes"), &sqlBindTypes); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Db_Profiler_Item, setSqlStatement) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlStatement_param = NULL; - zval sqlStatement; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlStatement) - ZEND_PARSE_PARAMETERS_END(); +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlStatement_param); - zephir_get_strval(&sqlStatement, sqlStatement_param); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlStatement"), &sqlStatement); - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Db_Profiler_Item, setSqlVariables) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Application_Exception) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *sqlVariables_param = NULL; - zval sqlVariables; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlVariables); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(sqlVariables) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlVariables_param); - zephir_get_arrval(&sqlVariables, sqlVariables_param); - + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Application, Exception, phalcon, mvc_application_exception, phalcon_application_exception_ce, NULL, 0); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlVariables"), &sqlVariables); - RETURN_THIS(); + return SUCCESS; } @@ -55787,1647 +60517,1819 @@ static PHP_METHOD(Phalcon_Db_Profiler_Item, setSqlVariables) -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_AbstractAdapter) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Annotations) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Db\\Adapter, AbstractAdapter, phalcon, db_adapter_abstractadapter, phalcon_db_adapter_abstractadapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Annotations, phalcon, mvc_router_annotations, phalcon_mvc_router_ce, phalcon_mvc_router_annotations_method_entry, 0); - zend_declare_property_long(phalcon_db_adapter_abstractadapter_ce, SL("connectionConsecutive"), 0, ZEND_ACC_PROTECTED|ZEND_ACC_STATIC); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("connectionId"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("descriptor"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("dialect"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("dialectType"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("realSqlStatement"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("sqlBindTypes"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("sqlStatement"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("sqlVariables"), ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_db_adapter_abstractadapter_ce, SL("transactionLevel"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_bool(phalcon_db_adapter_abstractadapter_ce, SL("transactionsWithSavepoints"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_abstractadapter_ce, SL("type"), ZEND_ACC_PROTECTED); - phalcon_db_adapter_abstractadapter_ce->create_object = zephir_init_properties_Phalcon_Db_Adapter_AbstractAdapter; + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("actionSuffix"), "Action", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("actionPreformatCallback"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("controllerSuffix"), "Controller", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_annotations_ce, SL("handlers"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_router_annotations_ce, SL("routePrefix"), "", ZEND_ACC_PROTECTED); + phalcon_mvc_router_annotations_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Annotations; - zend_class_implements(phalcon_db_adapter_abstractadapter_ce, 1, phalcon_db_adapter_adapterinterface_ce); - zend_class_implements(phalcon_db_adapter_abstractadapter_ce, 1, phalcon_events_eventsawareinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, __construct) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL, dialectClass, connectionId, _0, _1$$3, _2$$4; - zval descriptor; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&dialectClass); - ZVAL_UNDEF(&connectionId); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(descriptor) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); - - - ZEPHIR_OBS_VAR(&connectionId); - zephir_read_static_property_ce(&connectionId, phalcon_db_adapter_abstractadapter_ce, SL("connectionConsecutive"), PH_NOISY_CC); - zephir_update_property_zval(this_ptr, ZEND_STRL("connectionId"), &connectionId); - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, (zephir_get_numberval(&connectionId) + 1)); - zephir_update_static_property_ce(phalcon_db_adapter_abstractadapter_ce, ZEND_STRL("connectionConsecutive"), &_0); - ZEPHIR_OBS_VAR(&dialectClass); - if (!(zephir_array_isset_string_fetch(&dialectClass, &descriptor, SL("dialectClass"), 0))) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("dialectType"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&dialectClass); - ZEPHIR_CONCAT_SV(&dialectClass, "phalcon\\db\\dialect\\", &_1$$3); - } - if (Z_TYPE_P(&dialectClass) == IS_STRING) { - ZEPHIR_INIT_VAR(&_2$$4); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&_2$$4, &dialectClass); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("dialect"), &_2$$4); - } else if (Z_TYPE_P(&dialectClass) == IS_OBJECT) { - zephir_update_property_zval(this_ptr, ZEND_STRL("dialect"), &dialectClass); - } - zephir_update_property_zval(this_ptr, ZEND_STRL("descriptor"), &descriptor); - ZEPHIR_MM_RESTORE(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, addColumn) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, _0, _1; - zval tableName, schemaName; + zval *module_param = NULL, *handler_param = NULL, *prefix_param = NULL; + zval module, handler, prefix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&column_sub); + ZVAL_UNDEF(&module); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&prefix); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(module) + Z_PARAM_STR(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(prefix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 2, 1, &module_param, &handler_param, &prefix_param); + if (UNEXPECTED(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(&module, module_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&module); } - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "addcolumn", NULL, 0, &tableName, &schemaName, column); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, addForeignKey) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *reference, reference_sub, _0, _1; - zval tableName, schemaName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&reference_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(reference, phalcon_db_referenceinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(&handler, handler_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&handler); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!prefix_param) { + ZEPHIR_INIT_VAR(&prefix); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "addforeignkey", NULL, 0, &tableName, &schemaName, reference); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, addIndex) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, _0, _1; - zval tableName, schemaName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&index_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(&prefix, prefix_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&prefix); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "addindex", NULL, 0, &tableName, &schemaName, index); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + zephir_array_fast_append(&_0, &prefix); + zephir_array_fast_append(&_0, &handler); + zephir_array_fast_append(&_0, &module); + zephir_update_property_array_append(this_ptr, SL("handlers"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, addPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, addResource) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *index, index_sub, _0, _1; - zval tableName, schemaName; + zval *handler_param = NULL, *prefix_param = NULL; + zval handler, prefix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&prefix); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(index, phalcon_db_indexinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(handler) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(prefix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 1, &handler_param, &prefix_param); + if (UNEXPECTED(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(&handler, handler_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&handler); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!prefix_param) { + ZEPHIR_INIT_VAR(&prefix); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "addprimarykey", NULL, 0, &tableName, &schemaName, index); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, createSavepoint) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, dialect, _0, _1, _2; - zval name; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&dialect); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(prefix_param) == IS_STRING)) { + zephir_get_strval(&prefix, prefix_param); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_INIT_VAR(&prefix); + } } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&dialect, &_0); - ZEPHIR_CALL_METHOD(&_1, &dialect, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Savepoints are not supported by this database adapter.", "phalcon/Db/Adapter/AbstractAdapter.zep", 231); - return; - } - ZEPHIR_CALL_METHOD(&_2, &dialect, "createsavepoint", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_2); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 2, 0); + zephir_array_fast_append(&_0, &prefix); + zephir_array_fast_append(&_0, &handler); + zephir_update_property_array_append(this_ptr, SL("handlers"), &_0); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, createTable) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getResources) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, columns, _0, _1; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&definition); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ARRAY(definition) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/Db/Adapter/AbstractAdapter.zep", 247); - return; - } - if (UNEXPECTED(!(zephir_fast_count_int(&columns)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/Db/Adapter/AbstractAdapter.zep", 251); - return; - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "createtable", NULL, 0, &tableName, &schemaName, &definition); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "handlers"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, createView) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { + zend_string *_20$$18, *_41$$41; + zend_ulong _19$$18, _40$$41; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_13 = NULL, *_16 = NULL, *_24 = NULL, *_35 = NULL, *_48 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, _0, _1; - zval viewName, schemaName; + zval *uri_param = NULL, __$null, annotationsService, handlers, controllerSuffix, scope, prefix, route, compiledPattern, container, handler, controllerName, lowerControllerName, namespaceName, moduleName, handlerAnnotations, classAnnotations, annotations, annotation, methodAnnotations, method, collection, _0, _1, *_2, _3, _5$$6, _7$$6, _8$$6, _9$$7, _10$$7, _11$$4, _12$$12, *_14$$15, _15$$15, *_17$$18, _18$$18, _21$$19, *_22$$19, _23$$19, _25$$23, *_26$$23, _27$$23, _28$$29, _29$$29, _30$$29, _31$$30, _32$$30, _33$$27, _34$$35, *_36$$38, _37$$38, *_38$$41, _39$$41, _42$$42, *_43$$42, _44$$42, _45$$46, *_46$$46, _47$$46; + zval uri, sufixed; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&uri); + ZVAL_UNDEF(&sufixed); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&annotationsService); + ZVAL_UNDEF(&handlers); + ZVAL_UNDEF(&controllerSuffix); + ZVAL_UNDEF(&scope); + ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&compiledPattern); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&lowerControllerName); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&moduleName); + ZVAL_UNDEF(&handlerAnnotations); + ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&methodAnnotations); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&collection); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_8$$6); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_10$$7); + ZVAL_UNDEF(&_11$$4); + ZVAL_UNDEF(&_12$$12); + ZVAL_UNDEF(&_15$$15); + ZVAL_UNDEF(&_18$$18); + ZVAL_UNDEF(&_21$$19); + ZVAL_UNDEF(&_23$$19); + ZVAL_UNDEF(&_25$$23); + ZVAL_UNDEF(&_27$$23); + ZVAL_UNDEF(&_28$$29); + ZVAL_UNDEF(&_29$$29); + ZVAL_UNDEF(&_30$$29); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$30); + ZVAL_UNDEF(&_33$$27); + ZVAL_UNDEF(&_34$$35); + ZVAL_UNDEF(&_37$$38); + ZVAL_UNDEF(&_39$$41); + ZVAL_UNDEF(&_42$$42); + ZVAL_UNDEF(&_44$$42); + ZVAL_UNDEF(&_45$$46); + ZVAL_UNDEF(&_47$$46); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(viewName) - Z_PARAM_ARRAY(definition) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(uri) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &uri_param); + if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); + if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { + zephir_get_strval(&uri, uri_param); } else { - zephir_get_strval(&schemaName, schemaName_param); + ZEPHIR_INIT_VAR(&uri); } - if (UNEXPECTED(!(zephir_array_isset_string(&definition, SL("sql"))))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/Db/Adapter/AbstractAdapter.zep", 269); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/Mvc/Router/Annotations.zep", 114); return; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "createview", NULL, 0, &viewName, &definition, &schemaName); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("handlers"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&handlers, &_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("controllerSuffix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&controllerSuffix, &_0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "annotations"); + ZEPHIR_CALL_METHOD(&annotationsService, &container, "getshared", NULL, 0, &_1); zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, delete) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval placeholders, dataTypes; - zval whereCondition, _0$$3; - zval *table, table_sub, *whereCondition_param = NULL, *placeholders_param = NULL, *dataTypes_param = NULL, sql, escapedTable; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&table_sub); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&escapedTable); - ZVAL_UNDEF(&whereCondition); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&dataTypes); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_ZVAL(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(whereCondition) - Z_PARAM_ARRAY(placeholders) - Z_PARAM_ARRAY(dataTypes) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &table, &whereCondition_param, &placeholders_param, &dataTypes_param); - if (!whereCondition_param) { - ZEPHIR_INIT_VAR(&whereCondition); - } else { - zephir_get_strval(&whereCondition, whereCondition_param); - } - if (!placeholders_param) { - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); - } else { - zephir_get_arrval(&placeholders, placeholders_param); - } - if (!dataTypes_param) { - ZEPHIR_INIT_VAR(&dataTypes); - array_init(&dataTypes); + zephir_is_iterable(&handlers, 0, "phalcon/Mvc/Router/Annotations.zep", 250); + if (Z_TYPE_P(&handlers) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&handlers), _2) + { + ZEPHIR_INIT_NVAR(&scope); + ZVAL_COPY(&scope, _2); + if (Z_TYPE_P(&scope) != IS_ARRAY) { + continue; + } + ZEPHIR_OBS_NVAR(&prefix); + zephir_array_fetch_long(&prefix, &scope, 0, PH_NOISY, "phalcon/Mvc/Router/Annotations.zep", 129); + if (!(ZEPHIR_IS_EMPTY(&prefix))) { + ZEPHIR_INIT_NVAR(&route); + object_init_ex(&route, phalcon_mvc_router_route_ce); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", &_4, 100, &prefix); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5$$6, &route, "getcompiledpattern", &_6, 487); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_7$$6); + ZVAL_STRING(&_7$$6, "$#"); + ZEPHIR_INIT_NVAR(&_8$$6); + ZVAL_STRING(&_8$$6, "#"); + ZEPHIR_INIT_NVAR(&compiledPattern); + zephir_fast_str_replace(&compiledPattern, &_7$$6, &_8$$6, &_5$$6); + if (zephir_memnstr_str(&compiledPattern, SL("^"), "phalcon/Mvc/Router/Annotations.zep", 146)) { + ZEPHIR_INIT_NVAR(&_9$$7); + ZEPHIR_INIT_NVAR(&_10$$7); + zephir_preg_match(&_10$$7, &compiledPattern, &uri, &_9$$7, 0, 0 , 0 ); + if (!(zephir_is_true(&_10$$7))) { + continue; + } + } else if (!(zephir_start_with(&uri, &prefix, NULL))) { + continue; + } + } + ZEPHIR_OBS_NVAR(&handler); + zephir_array_fetch_long(&handler, &scope, 1, PH_NOISY, "phalcon/Mvc/Router/Annotations.zep", 161); + if (zephir_memnstr_str(&handler, SL("\\"), "phalcon/Mvc/Router/Annotations.zep", 163)) { + ZEPHIR_INIT_NVAR(&controllerName); + zephir_get_class_ns(&controllerName, &handler, 0); + ZEPHIR_INIT_NVAR(&namespaceName); + zephir_get_ns_class(&namespaceName, &handler, 0); + } else { + ZEPHIR_CPY_WRT(&controllerName, &handler); + ZEPHIR_OBS_NVAR(&namespaceName); + zephir_fetch_property(&namespaceName, this_ptr, SL("defaultNamespace"), PH_SILENT_CC); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("routePrefix"), &__$null); + ZEPHIR_OBS_NVAR(&moduleName); + zephir_array_isset_long_fetch(&moduleName, &scope, 2, 0); + ZEPHIR_INIT_NVAR(&_11$$4); + if (Z_TYPE_P(&moduleName) != IS_NULL) { + ZEPHIR_CPY_WRT(&_11$$4, &moduleName); + } else { + ZEPHIR_INIT_NVAR(&_11$$4); + ZVAL_STRING(&_11$$4, ""); + } + ZEPHIR_CPY_WRT(&moduleName, &_11$$4); + ZEPHIR_INIT_NVAR(&_11$$4); + ZEPHIR_CONCAT_VV(&_11$$4, &controllerName, &controllerSuffix); + zephir_get_strval(&sufixed, &_11$$4); + if (Z_TYPE_P(&namespaceName) != IS_NULL) { + ZEPHIR_INIT_NVAR(&_12$$12); + ZEPHIR_CONCAT_VSV(&_12$$12, &namespaceName, "\\", &sufixed); + zephir_get_strval(&sufixed, &_12$$12); + } + ZEPHIR_CALL_METHOD(&handlerAnnotations, &annotationsService, "get", &_13, 0, &sufixed); + zephir_check_call_status(); + if (Z_TYPE_P(&handlerAnnotations) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&classAnnotations, &handlerAnnotations, "getclassannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&classAnnotations) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&annotations, &classAnnotations, "getannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + zephir_is_iterable(&annotations, 0, "phalcon/Mvc/Router/Annotations.zep", 218); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _14$$15) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _14$$15); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_16, 0, &controllerName, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_15$$15, &annotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_15$$15)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_16, 0, &controllerName, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + } + } + ZEPHIR_CALL_METHOD(&methodAnnotations, &handlerAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&lowerControllerName); + zephir_uncamelize(&lowerControllerName, &controllerName, NULL ); + zephir_is_iterable(&methodAnnotations, 0, "phalcon/Mvc/Router/Annotations.zep", 244); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methodAnnotations), _19$$18, _20$$18, _17$$18) + { + ZEPHIR_INIT_NVAR(&method); + if (_20$$18 != NULL) { + ZVAL_STR_COPY(&method, _20$$18); + } else { + ZVAL_LONG(&method, _19$$18); + } + ZEPHIR_INIT_NVAR(&collection); + ZVAL_COPY(&collection, _17$$18); + if (Z_TYPE_P(&collection) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&_21$$19, &collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&_21$$19, 0, "phalcon/Mvc/Router/Annotations.zep", 243); + if (Z_TYPE_P(&_21$$19) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_21$$19), _22$$19) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _22$$19); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_21$$19, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_23$$19, &_21$$19, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_23$$19)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &_21$$19, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_21$$19, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &methodAnnotations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_18$$18, &methodAnnotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_18$$18)) { + break; + } + ZEPHIR_CALL_METHOD(&method, &methodAnnotations, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&collection, &methodAnnotations, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&collection) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&_25$$23, &collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&_25$$23, 0, "phalcon/Mvc/Router/Annotations.zep", 243); + if (Z_TYPE_P(&_25$$23) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_25$$23), _26$$23) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _26$$23); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_25$$23, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_27$$23, &_25$$23, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_27$$23)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &_25$$23, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_25$$23, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + ZEPHIR_CALL_METHOD(NULL, &methodAnnotations, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&collection); + ZEPHIR_INIT_NVAR(&method); + } + } ZEND_HASH_FOREACH_END(); } else { - zephir_get_arrval(&dataTypes, dataTypes_param); - } - - - ZEPHIR_CALL_METHOD(&escapedTable, this_ptr, "escapeidentifier", NULL, 0, table); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&sql); - ZEPHIR_CONCAT_SV(&sql, "DELETE FROM ", &escapedTable); - if (!(ZEPHIR_IS_EMPTY(&whereCondition))) { - ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_CONCAT_SV(&_0$$3, " WHERE ", &whereCondition); - zephir_concat_self(&sql, &_0$$3); + ZEPHIR_CALL_METHOD(NULL, &handlers, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &handlers, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&scope, &handlers, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&scope) != IS_ARRAY) { + continue; + } + ZEPHIR_OBS_NVAR(&prefix); + zephir_array_fetch_long(&prefix, &scope, 0, PH_NOISY, "phalcon/Mvc/Router/Annotations.zep", 129); + if (!(ZEPHIR_IS_EMPTY(&prefix))) { + ZEPHIR_INIT_NVAR(&route); + object_init_ex(&route, phalcon_mvc_router_route_ce); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", &_4, 100, &prefix); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_28$$29, &route, "getcompiledpattern", &_6, 487); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_29$$29); + ZVAL_STRING(&_29$$29, "$#"); + ZEPHIR_INIT_NVAR(&_30$$29); + ZVAL_STRING(&_30$$29, "#"); + ZEPHIR_INIT_NVAR(&compiledPattern); + zephir_fast_str_replace(&compiledPattern, &_29$$29, &_30$$29, &_28$$29); + if (zephir_memnstr_str(&compiledPattern, SL("^"), "phalcon/Mvc/Router/Annotations.zep", 146)) { + ZEPHIR_INIT_NVAR(&_31$$30); + ZEPHIR_INIT_NVAR(&_32$$30); + zephir_preg_match(&_32$$30, &compiledPattern, &uri, &_31$$30, 0, 0 , 0 ); + if (!(zephir_is_true(&_32$$30))) { + continue; + } + } else if (!(zephir_start_with(&uri, &prefix, NULL))) { + continue; + } + } + ZEPHIR_OBS_NVAR(&handler); + zephir_array_fetch_long(&handler, &scope, 1, PH_NOISY, "phalcon/Mvc/Router/Annotations.zep", 161); + if (zephir_memnstr_str(&handler, SL("\\"), "phalcon/Mvc/Router/Annotations.zep", 163)) { + ZEPHIR_INIT_NVAR(&controllerName); + zephir_get_class_ns(&controllerName, &handler, 0); + ZEPHIR_INIT_NVAR(&namespaceName); + zephir_get_ns_class(&namespaceName, &handler, 0); + } else { + ZEPHIR_CPY_WRT(&controllerName, &handler); + ZEPHIR_OBS_NVAR(&namespaceName); + zephir_fetch_property(&namespaceName, this_ptr, SL("defaultNamespace"), PH_SILENT_CC); + } + zephir_update_property_zval(this_ptr, ZEND_STRL("routePrefix"), &__$null); + ZEPHIR_OBS_NVAR(&moduleName); + zephir_array_isset_long_fetch(&moduleName, &scope, 2, 0); + ZEPHIR_INIT_NVAR(&_33$$27); + if (Z_TYPE_P(&moduleName) != IS_NULL) { + ZEPHIR_CPY_WRT(&_33$$27, &moduleName); + } else { + ZEPHIR_INIT_NVAR(&_33$$27); + ZVAL_STRING(&_33$$27, ""); + } + ZEPHIR_CPY_WRT(&moduleName, &_33$$27); + ZEPHIR_INIT_NVAR(&_33$$27); + ZEPHIR_CONCAT_VV(&_33$$27, &controllerName, &controllerSuffix); + zephir_get_strval(&sufixed, &_33$$27); + if (Z_TYPE_P(&namespaceName) != IS_NULL) { + ZEPHIR_INIT_NVAR(&_34$$35); + ZEPHIR_CONCAT_VSV(&_34$$35, &namespaceName, "\\", &sufixed); + zephir_get_strval(&sufixed, &_34$$35); + } + ZEPHIR_CALL_METHOD(&handlerAnnotations, &annotationsService, "get", &_35, 0, &sufixed); + zephir_check_call_status(); + if (Z_TYPE_P(&handlerAnnotations) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&classAnnotations, &handlerAnnotations, "getclassannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&classAnnotations) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(&annotations, &classAnnotations, "getannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + zephir_is_iterable(&annotations, 0, "phalcon/Mvc/Router/Annotations.zep", 218); + if (Z_TYPE_P(&annotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _36$$38) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _36$$38); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_16, 0, &controllerName, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_37$$38, &annotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_37$$38)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processcontrollerannotation", &_16, 0, &controllerName, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + } + } + ZEPHIR_CALL_METHOD(&methodAnnotations, &handlerAnnotations, "getmethodsannotations", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&lowerControllerName); + zephir_uncamelize(&lowerControllerName, &controllerName, NULL ); + zephir_is_iterable(&methodAnnotations, 0, "phalcon/Mvc/Router/Annotations.zep", 244); + if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methodAnnotations), _40$$41, _41$$41, _38$$41) + { + ZEPHIR_INIT_NVAR(&method); + if (_41$$41 != NULL) { + ZVAL_STR_COPY(&method, _41$$41); + } else { + ZVAL_LONG(&method, _40$$41); + } + ZEPHIR_INIT_NVAR(&collection); + ZVAL_COPY(&collection, _38$$41); + if (Z_TYPE_P(&collection) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&_42$$42, &collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&_42$$42, 0, "phalcon/Mvc/Router/Annotations.zep", 243); + if (Z_TYPE_P(&_42$$42) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_42$$42), _43$$42) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _43$$42); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_42$$42, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_44$$42, &_42$$42, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_44$$42)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &_42$$42, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_42$$42, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &methodAnnotations, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_39$$41, &methodAnnotations, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_39$$41)) { + break; + } + ZEPHIR_CALL_METHOD(&method, &methodAnnotations, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&collection, &methodAnnotations, "current", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&collection) != IS_OBJECT) { + continue; + } + ZEPHIR_CALL_METHOD(&_45$$46, &collection, "getannotations", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&_45$$46, 0, "phalcon/Mvc/Router/Annotations.zep", 243); + if (Z_TYPE_P(&_45$$46) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_45$$46), _46$$46) + { + ZEPHIR_INIT_NVAR(&annotation); + ZVAL_COPY(&annotation, _46$$46); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_45$$46, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_47$$46, &_45$$46, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_47$$46)) { + break; + } + ZEPHIR_CALL_METHOD(&annotation, &_45$$46, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "processactionannotation", &_24, 0, &moduleName, &namespaceName, &lowerControllerName, &method, &annotation); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_45$$46, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&annotation); + ZEPHIR_CALL_METHOD(NULL, &methodAnnotations, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&collection); + ZEPHIR_INIT_NVAR(&method); + } + ZEPHIR_CALL_METHOD(NULL, &handlers, "next", NULL, 0); + zephir_check_call_status(); + } } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &sql, &placeholders, &dataTypes); + ZEPHIR_INIT_NVAR(&scope); + ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_router_annotations_ce, getThis(), "handle", &_48, 0, &uri); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { - zend_string *_11; - zend_ulong _10; + zend_string *_12$$18, *_18$$21; + zend_ulong _11$$18, _17$$21; + zend_bool isRoute = 0, _8, _21; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_13 = NULL; + zephir_fcall_cache_entry *_13 = NULL, *_14 = NULL, *_19 = NULL, *_20 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, indexes, index, keyName, indexObjects, name, indexColumns, columns, _0, _1, _2, _3, *_4, _5, *_8, _9, _6$$3, _7$$6, _12$$9, _14$$10; - zval table, schema; + zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, annotation_sub, name, proxyActionName, actionName, routePrefix, paths, value, uri, route, methods, converts, param, convert, converterParam, routeName, beforeMatch, _0, _1, _2, _5, _6, _3$$6, _4$$6, _7$$16, *_9$$18, _10$$18, *_15$$21, _16$$21; + zval module, namespaceName, controller, action; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&indexObjects); + ZVAL_UNDEF(&module); + ZVAL_UNDEF(&namespaceName); + ZVAL_UNDEF(&controller); + ZVAL_UNDEF(&action); + ZVAL_UNDEF(&annotation_sub); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&indexColumns); - ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&proxyActionName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&routePrefix); + ZVAL_UNDEF(&paths); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&uri); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&methods); + ZVAL_UNDEF(&converts); + ZVAL_UNDEF(¶m); + ZVAL_UNDEF(&convert); + ZVAL_UNDEF(&converterParam); + ZVAL_UNDEF(&routeName); + ZVAL_UNDEF(&beforeMatch); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_12$$9); - ZVAL_UNDEF(&_14$$10); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&_4$$6); + ZVAL_UNDEF(&_7$$16); + ZVAL_UNDEF(&_10$$18); + ZVAL_UNDEF(&_16$$21); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(5, 5) + Z_PARAM_STR(module) + Z_PARAM_STR(namespaceName) + Z_PARAM_STR(controller) + Z_PARAM_STR(action) + Z_PARAM_OBJECT_OF_CLASS(annotation, phalcon_annotations_annotation_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); + if (UNEXPECTED(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(module_param) == IS_STRING)) { + zephir_get_strval(&module, module_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&module); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (UNEXPECTED(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(namespaceName_param) == IS_STRING)) { + zephir_get_strval(&namespaceName, namespaceName_param); } else { - zephir_get_strval(&schema, schema_param); + ZEPHIR_INIT_VAR(&namespaceName); + } + if (UNEXPECTED(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(controller_param) == IS_STRING)) { + zephir_get_strval(&controller, controller_param); + } else { + ZEPHIR_INIT_VAR(&controller); + } + if (UNEXPECTED(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(action_param) == IS_STRING)) { + zephir_get_strval(&action, action_param); + } else { + ZEPHIR_INIT_VAR(&action); } - ZEPHIR_INIT_VAR(&indexes); - array_init(&indexes); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describeindexes", NULL, 0, &table, &schema); + isRoute = 0; + ZEPHIR_INIT_VAR(&methods); + ZVAL_NULL(&methods); + ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); + do { + if (ZEPHIR_IS_STRING(&name, "Route")) { + isRoute = 1; + break; + } + if (ZEPHIR_IS_STRING(&name, "Get") || ZEPHIR_IS_STRING(&name, "Post") || ZEPHIR_IS_STRING(&name, "Put") || ZEPHIR_IS_STRING(&name, "Patch") || ZEPHIR_IS_STRING(&name, "Delete") || ZEPHIR_IS_STRING(&name, "Options")) { + isRoute = 1; + ZEPHIR_INIT_NVAR(&methods); + zephir_fast_strtoupper(&methods, &name); + break; + } + } while(0); + + if (!(isRoute)) { + RETURN_MM_NULL(); + } + zephir_read_property(&_0, this_ptr, ZEND_STRL("actionSuffix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, ""); + ZEPHIR_INIT_VAR(&proxyActionName); + zephir_fast_str_replace(&proxyActionName, &_0, &_1, &action); + zephir_read_property(&_2, this_ptr, ZEND_STRL("routePrefix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&routePrefix, &_2); + zephir_read_property(&_2, this_ptr, ZEND_STRL("actionPreformatCallback"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) != IS_NULL) { + zephir_read_property(&_3$$6, this_ptr, ZEND_STRL("actionPreformatCallback"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_FUNCTION(&_4$$6, "call_user_func", NULL, 187, &_3$$6, &proxyActionName); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&proxyActionName, &_4$$6); + } + ZEPHIR_INIT_VAR(&actionName); + zephir_fast_strtolower(&actionName, &proxyActionName); + ZEPHIR_INIT_VAR(&_5); + ZVAL_STRING(&_5, "paths"); + ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, &_5); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 348); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _4); - zephir_array_fetch_long(&keyName, &index, 2, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 336); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); + if (Z_TYPE_P(&paths) != IS_ARRAY) { + ZEPHIR_INIT_NVAR(&paths); + array_init(&paths); + } + if (!(ZEPHIR_IS_EMPTY(&module))) { + zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); + } + if (!(ZEPHIR_IS_EMPTY(&namespaceName))) { + zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); + ZVAL_LONG(&_6, 0); + ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, &_6); + zephir_check_call_status(); + if (Z_TYPE_P(&value) != IS_NULL) { + if (!ZEPHIR_IS_STRING(&value, "/")) { + ZEPHIR_INIT_VAR(&uri); + ZEPHIR_CONCAT_VV(&uri, &routePrefix, &value); + } else { + if (Z_TYPE_P(&routePrefix) != IS_NULL) { + ZEPHIR_CPY_WRT(&uri, &routePrefix); } else { - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch(&columns, &indexes, &keyName, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 341); + ZEPHIR_CPY_WRT(&uri, &value); } - zephir_array_fetch_long(&_6$$3, &index, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 344); - zephir_array_append(&columns, &_6$$3, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 344); - zephir_array_update_zval(&indexes, &keyName, &columns, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + } } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + ZEPHIR_INIT_NVAR(&uri); + ZEPHIR_CONCAT_VV(&uri, &routePrefix, &actionName); + } + ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, &uri, &paths); + zephir_check_call_status(); + if (Z_TYPE_P(&methods) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$16); + ZVAL_STRING(&_7$$16, "methods"); + ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, &_7$$16); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&index, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&keyName); - zephir_array_fetch_long(&keyName, &index, 2, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 336); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); + } + _8 = Z_TYPE_P(&methods) == IS_ARRAY; + if (!(_8)) { + _8 = Z_TYPE_P(&methods) == IS_STRING; + } + if (_8) { + ZEPHIR_CALL_METHOD(NULL, &route, "via", NULL, 0, &methods); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(&_5); + ZVAL_STRING(&_5, "converts"); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, &_5); + zephir_check_call_status(); + if (Z_TYPE_P(&converts) == IS_ARRAY) { + zephir_is_iterable(&converts, 0, "phalcon/Mvc/Router/Annotations.zep", 373); + if (Z_TYPE_P(&converts) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&converts), _11$$18, _12$$18, _9$$18) + { + ZEPHIR_INIT_NVAR(¶m); + if (_12$$18 != NULL) { + ZVAL_STR_COPY(¶m, _12$$18); } else { - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch(&columns, &indexes, &keyName, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 341); + ZVAL_LONG(¶m, _11$$18); } - zephir_array_fetch_long(&_7$$6, &index, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 344); - zephir_array_append(&columns, &_7$$6, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 344); - zephir_array_update_zval(&indexes, &keyName, &columns, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + ZEPHIR_INIT_NVAR(&convert); + ZVAL_COPY(&convert, _9$$18); + ZEPHIR_CALL_METHOD(NULL, &route, "convert", &_13, 0, ¶m, &convert); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &converts, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$18, &converts, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$18)) { + break; + } + ZEPHIR_CALL_METHOD(¶m, &converts, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&convert, &converts, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "convert", &_14, 0, ¶m, &convert); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &converts, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&convert); + ZEPHIR_INIT_NVAR(¶m); } - ZEPHIR_INIT_NVAR(&index); - ZEPHIR_INIT_VAR(&indexObjects); - array_init(&indexObjects); - zephir_is_iterable(&indexes, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 357); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&indexes), _10, _11, _8) - { - ZEPHIR_INIT_NVAR(&name); - if (_11 != NULL) { - ZVAL_STR_COPY(&name, _11); - } else { - ZVAL_LONG(&name, _10); - } - ZEPHIR_INIT_NVAR(&indexColumns); - ZVAL_COPY(&indexColumns, _8); - ZEPHIR_INIT_NVAR(&_12$$9); - object_init_ex(&_12$$9, phalcon_db_index_ce); - ZEPHIR_CALL_METHOD(NULL, &_12$$9, "__construct", &_13, 30, &name, &indexColumns); - zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_12$$9, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9, &indexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &indexes, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexColumns, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_14$$10); - object_init_ex(&_14$$10, phalcon_db_index_ce); - ZEPHIR_CALL_METHOD(NULL, &_14$$10, "__construct", &_13, 30, &name, &indexColumns); + ZEPHIR_INIT_NVAR(&_5); + ZVAL_STRING(&_5, "converters"); + ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, &_5); + zephir_check_call_status(); + if (Z_TYPE_P(&converts) == IS_ARRAY) { + zephir_is_iterable(&converts, 0, "phalcon/Mvc/Router/Annotations.zep", 384); + if (Z_TYPE_P(&converts) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&converts), _17$$21, _18$$21, _15$$21) + { + ZEPHIR_INIT_NVAR(&converterParam); + if (_18$$21 != NULL) { + ZVAL_STR_COPY(&converterParam, _18$$21); + } else { + ZVAL_LONG(&converterParam, _17$$21); + } + ZEPHIR_INIT_NVAR(&convert); + ZVAL_COPY(&convert, _15$$21); + ZEPHIR_CALL_METHOD(NULL, &route, "convert", &_19, 0, &converterParam, &convert); zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_14$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &converts, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_16$$21, &converts, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_16$$21)) { + break; + } + ZEPHIR_CALL_METHOD(&converterParam, &converts, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&convert, &converts, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "convert", &_20, 0, &converterParam, &convert); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &converts, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&convert); + ZEPHIR_INIT_NVAR(&converterParam); } - ZEPHIR_INIT_NVAR(&indexColumns); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&indexObjects); + ZEPHIR_INIT_NVAR(&_5); + ZVAL_STRING(&_5, "beforeMatch"); + ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, &_5); + zephir_check_call_status(); + _21 = Z_TYPE_P(&beforeMatch) == IS_ARRAY; + if (!(_21)) { + _21 = Z_TYPE_P(&beforeMatch) == IS_STRING; + } + if (_21) { + ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + zephir_check_call_status(); + } + ZEPHIR_INIT_NVAR(&_5); + ZVAL_STRING(&_5, "name"); + ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, &_5); + zephir_check_call_status(); + if (Z_TYPE_P(&routeName) == IS_STRING) { + ZEPHIR_CALL_METHOD(NULL, &route, "setname", NULL, 0, &routeName); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, describeReferences) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) { - zval _12$$3, _19$$6, _25$$9, _29$$10; - zend_string *_23; - zend_ulong _22; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_27 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, references, reference, arrayReference, constraintName, referenceObjects, name, referencedSchema, referencedTable, columns, referencedColumns, _0, _1, _2, _3, *_4, _5, *_20, _21, _6$$5, _7$$5, _8$$5, _9$$5, _10$$3, _11$$3, _13$$8, _14$$8, _15$$8, _16$$8, _17$$6, _18$$6, _24$$9, _26$$9, _28$$10, _30$$10; - zval table, schema; + zval *handler_param = NULL, *annotation, annotation_sub, _0, _1$$3, _2$$3; + zval handler; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&arrayReference); - ZVAL_UNDEF(&constraintName); - ZVAL_UNDEF(&referenceObjects); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&referencedSchema); - ZVAL_UNDEF(&referencedTable); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&referencedColumns); + ZVAL_UNDEF(&handler); + ZVAL_UNDEF(&annotation_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_21); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_14$$8); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$6); - ZVAL_UNDEF(&_18$$6); - ZVAL_UNDEF(&_24$$9); - ZVAL_UNDEF(&_26$$9); - ZVAL_UNDEF(&_28$$10); - ZVAL_UNDEF(&_30$$10); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_19$$6); - ZVAL_UNDEF(&_25$$9); - ZVAL_UNDEF(&_29$$10); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(handler) + Z_PARAM_OBJECT_OF_CLASS(annotation, phalcon_annotations_annotation_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 2, 0, &handler_param, &annotation); + if (UNEXPECTED(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(handler_param) == IS_STRING)) { + zephir_get_strval(&handler, handler_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&handler); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); + + + ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(&_0, "RoutePrefix")) { + ZVAL_LONG(&_2$$3, 0); + ZEPHIR_CALL_METHOD(&_1$$3, annotation, "getargument", NULL, 0, &_2$$3); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("routePrefix"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionSuffix) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *actionSuffix_param = NULL; + zval actionSuffix; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&actionSuffix); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(actionSuffix) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &actionSuffix_param); + if (UNEXPECTED(Z_TYPE_P(actionSuffix_param) != IS_STRING && Z_TYPE_P(actionSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'actionSuffix' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); + if (EXPECTED(Z_TYPE_P(actionSuffix_param) == IS_STRING)) { + zephir_get_strval(&actionSuffix, actionSuffix_param); } else { - ZEPHIR_INIT_VAR(&schema); + ZEPHIR_INIT_VAR(&actionSuffix); } + + + zephir_update_property_zval(this_ptr, ZEND_STRL("actionSuffix"), &actionSuffix); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setActionPreformatCallback) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *callback = NULL, callback_sub, __$null, _0$$4; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&callback_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0$$4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(callback) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &callback); + if (!callback) { + callback = &callback_sub; + callback = &__$null; } - ZEPHIR_INIT_VAR(&references); - array_init(&references); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describereferences", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); - zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 403); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _4); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 378); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 381); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 382); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_6$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 386); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_6$$5, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 386); - zephir_array_fetch(&_7$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 387); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_7$$5, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 387); - zephir_array_fetch(&_8$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 388); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_8$$5, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 388); - zephir_array_fetch(&_9$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 389); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_9$$5, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 389); - } - zephir_array_fetch_long(&_10$$3, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 392); - zephir_array_append(&columns, &_10$$3, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 392); - zephir_array_fetch_long(&_11$$3, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 393); - zephir_array_append(&referencedColumns, &_11$$3, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 393); - ZEPHIR_INIT_NVAR(&_12$$3); - zephir_create_array(&_12$$3, 4, 0); - zephir_array_update_string(&_12$$3, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_12$$3, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_12$$3, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_12$$3, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_12$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&constraintName); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 378); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 381); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 382); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_13$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 386); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_13$$8, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 386); - zephir_array_fetch(&_14$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 387); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_14$$8, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 387); - zephir_array_fetch(&_15$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 388); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_15$$8, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 388); - zephir_array_fetch(&_16$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 389); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_16$$8, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 389); - } - zephir_array_fetch_long(&_17$$6, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 392); - zephir_array_append(&columns, &_17$$6, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 392); - zephir_array_fetch_long(&_18$$6, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 393); - zephir_array_append(&referencedColumns, &_18$$6, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 393); - ZEPHIR_INIT_NVAR(&_19$$6); - zephir_create_array(&_19$$6, 4, 0); - zephir_array_update_string(&_19$$6, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_19$$6, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_19$$6, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_19$$6, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_19$$6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reference); - ZEPHIR_INIT_VAR(&referenceObjects); - array_init(&referenceObjects); - zephir_is_iterable(&references, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 417); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&references), _22, _23, _20) - { - ZEPHIR_INIT_NVAR(&name); - if (_23 != NULL) { - ZVAL_STR_COPY(&name, _23); - } else { - ZVAL_LONG(&name, _22); - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZVAL_COPY(&arrayReference, _20); - ZEPHIR_INIT_NVAR(&_24$$9); - object_init_ex(&_24$$9, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_25$$9); - zephir_create_array(&_25$$9, 4, 0); - ZEPHIR_OBS_NVAR(&_26$$9); - zephir_array_fetch_string(&_26$$9, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 409); - zephir_array_update_string(&_25$$9, SL("referencedSchema"), &_26$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_26$$9); - zephir_array_fetch_string(&_26$$9, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 410); - zephir_array_update_string(&_25$$9, SL("referencedTable"), &_26$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_26$$9); - zephir_array_fetch_string(&_26$$9, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 411); - zephir_array_update_string(&_25$$9, SL("columns"), &_26$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_26$$9); - zephir_array_fetch_string(&_26$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 413); - zephir_array_update_string(&_25$$9, SL("referencedColumns"), &_26$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_27, 31, &name, &_25$$9); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_24$$9, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + if (EXPECTED(zephir_is_callable(callback))) { + zephir_update_property_zval(this_ptr, ZEND_STRL("actionPreformatCallback"), callback); + } else if (Z_TYPE_P(callback) == IS_NULL) { + ZEPHIR_INIT_VAR(&_0$$4); + ZEPHIR_INIT_NVAR(&_0$$4); + zephir_create_closure_ex(&_0$$4, NULL, phalcon_10__closure_ce, SL("__invoke")); + zephir_update_property_zval(this_ptr, ZEND_STRL("actionPreformatCallback"), &_0$$4); } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_21, &references, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_21)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &references, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&arrayReference, &references, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_28$$10); - object_init_ex(&_28$$10, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_29$$10); - zephir_create_array(&_29$$10, 4, 0); - ZEPHIR_OBS_NVAR(&_30$$10); - zephir_array_fetch_string(&_30$$10, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 409); - zephir_array_update_string(&_29$$10, SL("referencedSchema"), &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$10); - zephir_array_fetch_string(&_30$$10, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 410); - zephir_array_update_string(&_29$$10, SL("referencedTable"), &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$10); - zephir_array_fetch_string(&_30$$10, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 411); - zephir_array_update_string(&_29$$10, SL("columns"), &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$10); - zephir_array_fetch_string(&_30$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/AbstractAdapter.zep", 413); - zephir_array_update_string(&_29$$10, SL("referencedColumns"), &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$10, "__construct", &_27, 31, &name, &_29$$10); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_28$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The 'callback' parameter must be either a callable or NULL.", "phalcon/Mvc/Router/Annotations.zep", 463); + return; } - ZEPHIR_INIT_NVAR(&arrayReference); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&referenceObjects); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropColumn) +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, getActionPreformatCallback) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "actionPreformatCallback"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Annotations, setControllerSuffix) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL, _0, _1; - zval tableName, schemaName, columnName; + zval *controllerSuffix_param = NULL; + zval controllerSuffix; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&columnName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&controllerSuffix); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(columnName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(controllerSuffix) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &controllerSuffix_param); + if (UNEXPECTED(Z_TYPE_P(controllerSuffix_param) != IS_STRING && Z_TYPE_P(controllerSuffix_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controllerSuffix' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(controllerSuffix_param) == IS_STRING)) { + zephir_get_strval(&controllerSuffix, controllerSuffix_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&controllerSuffix); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("controllerSuffix"), &controllerSuffix); + ZEPHIR_MM_RESTORE(); +} + +zend_object *zephir_init_properties_Phalcon_Mvc_Router_Annotations(zend_class_entry *class_type) +{ + zval _0, _2, _4, _6, _8, _10, _12, _1$$3, _3$$4, _5$$5, _7$$6, _9$$7, _11$$8, _13$$9; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_10); + ZVAL_UNDEF(&_12); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_7$$6); + ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&_11$$8); + ZVAL_UNDEF(&_13$$9); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("routes"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("matches"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("matches"), &_5$$5); + } + zephir_read_property_ex(&_6, this_ptr, ZEND_STRL("keyRouteIds"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_6) == IS_NULL) { + ZEPHIR_INIT_VAR(&_7$$6); + array_init(&_7$$6); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("keyRouteIds"), &_7$$6); + } + zephir_read_property_ex(&_8, this_ptr, ZEND_STRL("keyRouteNames"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_8) == IS_NULL) { + ZEPHIR_INIT_VAR(&_9$$7); + array_init(&_9$$7); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("keyRouteNames"), &_9$$7); + } + zephir_read_property_ex(&_10, this_ptr, ZEND_STRL("defaultParams"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_10) == IS_NULL) { + ZEPHIR_INIT_VAR(&_11$$8); + array_init(&_11$$8); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("defaultParams"), &_11$$8); + } + zephir_read_property_ex(&_12, this_ptr, ZEND_STRL("handlers"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_12) == IS_NULL) { + ZEPHIR_INIT_VAR(&_13$$9); + array_init(&_13$$9); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("handlers"), &_13$$9); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - zephir_get_strval(&columnName, columnName_param); +} - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "dropcolumn", NULL, 0, &tableName, &schemaName, &columnName); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Exception) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Router, Exception, phalcon, mvc_router_exception, zend_ce_exception, NULL, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropForeignKey) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Group) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Group, phalcon, mvc_router_group, phalcon_mvc_router_group_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("beforeMatch"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("hostname"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("paths"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("prefix"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_group_ce, SL("routes"), ZEND_ACC_PROTECTED); + phalcon_mvc_router_group_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Group; + + zend_class_implements(phalcon_mvc_router_group_ce, 1, phalcon_mvc_router_groupinterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Mvc_Router_Group, __construct) { + zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL, _0, _1; - zval tableName, schemaName, referenceName; + zval *paths = NULL, paths_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&referenceName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_STR(referenceName) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + zephir_fetch_params(1, 0, 1, &paths); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + + + _0 = Z_TYPE_P(paths) == IS_ARRAY; + if (!(_0)) { + _0 = Z_TYPE_P(paths) == IS_STRING; } - if (UNEXPECTED(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be of the type string")); - RETURN_MM_NULL(); + if (_0) { + zephir_update_property_zval(this_ptr, ZEND_STRL("paths"), paths); } - if (EXPECTED(Z_TYPE_P(referenceName_param) == IS_STRING)) { - zephir_get_strval(&referenceName, referenceName_param); - } else { - ZEPHIR_INIT_VAR(&referenceName); + if ((zephir_method_exists_ex(this_ptr, ZEND_STRL("initialize")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, paths); + zephir_check_call_status(); } - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "dropforeignkey", NULL, 0, &tableName, &schemaName, &referenceName); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropIndex) +static PHP_METHOD(Phalcon_Mvc_Router_Group, add) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *indexName, indexName_sub, _0, _1; - zval tableName, schemaName; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *httpMethods = NULL, httpMethods_sub, __$null; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&indexName_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_UNDEF(&httpMethods_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ZVAL(indexName) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&pattern); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + if (!httpMethods) { + httpMethods = &httpMethods_sub; + httpMethods = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "dropindex", NULL, 0, &tableName, &schemaName, indexName); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, httpMethods); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropPrimaryKey) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addConnect) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, _0, _1; - zval tableName, schemaName; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&pattern); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "dropprimarykey", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "CONNECT"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropTable) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addDelete) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, _0, _1, _2; - zval tableName, schemaName; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(tableName) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } + ZEPHIR_INIT_VAR(&pattern); } - if (!ifExists_param) { - ifExists = 1; - } else { - ifExists = zephir_get_boolval(ifExists_param); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - if (ifExists) { - ZVAL_BOOL(&_2, 1); - } else { - ZVAL_BOOL(&_2, 0); - } - ZEPHIR_CALL_METHOD(&_1, &_0, "droptable", NULL, 0, &tableName, &schemaName, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "DELETE"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, dropView) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addGet) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool ifExists; - zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, _0, _1, _2; - zval viewName, schemaName; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(viewName) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - Z_PARAM_BOOL(ifExists) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } + ZEPHIR_INIT_VAR(&pattern); } - if (!ifExists_param) { - ifExists = 1; - } else { - ifExists = zephir_get_boolval(ifExists_param); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - if (ifExists) { - ZVAL_BOOL(&_2, 1); - } else { - ZVAL_BOOL(&_2, 0); - } - ZEPHIR_CALL_METHOD(&_1, &_0, "dropview", NULL, 0, &viewName, &schemaName, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "GET"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, escapeIdentifier) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addHead) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *identifier, identifier_sub, _0$$3, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&identifier_sub); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(identifier) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &identifier); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } - if (Z_TYPE_P(identifier) == IS_ARRAY) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_long(&_2$$3, identifier, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 522); - ZEPHIR_CALL_METHOD(&_1$$3, &_0$$3, "escape", NULL, 0, &_2$$3); - zephir_check_call_status(); - zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch_long(&_5$$3, identifier, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 522); - ZEPHIR_CALL_METHOD(&_4$$3, &_3$$3, "escape", NULL, 0, &_5$$3); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, &_1$$3, ".", &_4$$3); - RETURN_MM(); - } - zephir_read_property(&_6, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_6, "escape", NULL, 0, identifier); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "HEAD"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, fetchAll) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addOptions) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval bindParams, bindTypes; - zend_long fetchMode, ZEPHIR_LAST_CALL_STATUS; - zval *sqlQuery_param = NULL, *fetchMode_param = NULL, *bindParams_param = NULL, *bindTypes_param = NULL, result, _1, _0$$4; - zval sqlQuery; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&bindParams); - ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(sqlQuery) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_LONG(fetchMode) - Z_PARAM_ARRAY(bindParams) - Z_PARAM_ARRAY(bindTypes) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &sqlQuery_param, &fetchMode_param, &bindParams_param, &bindTypes_param); - zephir_get_strval(&sqlQuery, sqlQuery_param); - if (!fetchMode_param) { - fetchMode = 2; - } else { - fetchMode = zephir_get_intval(fetchMode_param); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); } - if (!bindParams_param) { - ZEPHIR_INIT_VAR(&bindParams); - array_init(&bindParams); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - zephir_get_arrval(&bindParams, bindParams_param); + ZEPHIR_INIT_VAR(&pattern); } - if (!bindTypes_param) { - ZEPHIR_INIT_VAR(&bindTypes); - array_init(&bindTypes); - } else { - zephir_get_arrval(&bindTypes, bindTypes_param); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - ZEPHIR_CALL_METHOD(&result, this_ptr, "query", NULL, 0, &sqlQuery, &bindParams, &bindTypes); - zephir_check_call_status(); - if (Z_TYPE_P(&result) != IS_OBJECT) { - array_init(return_value); - RETURN_MM(); - } - if (UNEXPECTED(fetchMode == 7)) { - ZVAL_LONG(&_0$$4, 7); - ZEPHIR_RETURN_CALL_METHOD(&result, "fetchall", NULL, 0, &_0$$4); - zephir_check_call_status(); - RETURN_MM(); - } - ZVAL_LONG(&_1, fetchMode); - ZEPHIR_CALL_METHOD(NULL, &result, "setfetchmode", NULL, 0, &_1); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&result, "fetchall", NULL, 0); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "OPTIONS"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, fetchColumn) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPatch) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval placeholders; - zval *sqlQuery_param = NULL, *placeholders_param = NULL, *column = NULL, column_sub, row, columnValue, _0; - zval sqlQuery; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&row); - ZVAL_UNDEF(&columnValue); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&placeholders); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(sqlQuery) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(placeholders) - Z_PARAM_ZVAL(column) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlQuery_param, &placeholders_param, &column); - zephir_get_strval(&sqlQuery, sqlQuery_param); - if (!placeholders_param) { - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - zephir_get_arrval(&placeholders, placeholders_param); + ZEPHIR_INIT_VAR(&pattern); } - if (!column) { - column = &column_sub; - ZEPHIR_INIT_VAR(column); - ZVAL_LONG(column, 0); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - ZVAL_LONG(&_0, 4); - ZEPHIR_CALL_METHOD(&row, this_ptr, "fetchone", NULL, 0, &sqlQuery, &_0, &placeholders); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PATCH"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); - if (!(zephir_array_isset_fetch(&columnValue, &row, column, 1))) { - RETURN_MM_BOOL(0); - } - RETURN_CTOR(&columnValue); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, fetchOne) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPost) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindParams, bindTypes; - zval *sqlQuery_param = NULL, *fetchMode = NULL, fetchMode_sub, *bindParams_param = NULL, *bindTypes_param = NULL, result; - zval sqlQuery; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&fetchMode_sub); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&bindParams); - ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STR(sqlQuery) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(fetchMode) - Z_PARAM_ARRAY(bindParams) - Z_PARAM_ARRAY(bindTypes) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &sqlQuery_param, &fetchMode, &bindParams_param, &bindTypes_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - } - if (!fetchMode) { - fetchMode = &fetchMode_sub; - ZEPHIR_INIT_VAR(fetchMode); - ZVAL_LONG(fetchMode, 2); - } - if (!bindParams_param) { - ZEPHIR_INIT_VAR(&bindParams); - array_init(&bindParams); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - zephir_get_arrval(&bindParams, bindParams_param); + ZEPHIR_INIT_VAR(&pattern); } - if (!bindTypes_param) { - ZEPHIR_INIT_VAR(&bindTypes); - array_init(&bindTypes); - } else { - zephir_get_arrval(&bindTypes, bindTypes_param); + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - ZEPHIR_CALL_METHOD(&result, this_ptr, "query", NULL, 0, &sqlQuery, &bindParams, &bindTypes); - zephir_check_call_status(); - if (Z_TYPE_P(&result) != IS_OBJECT) { - array_init(return_value); - RETURN_MM(); - } - if (Z_TYPE_P(fetchMode) != IS_NULL) { - ZEPHIR_CALL_METHOD(NULL, &result, "setfetchmode", NULL, 0, fetchMode); - zephir_check_call_status(); - } - ZEPHIR_RETURN_CALL_METHOD(&result, "fetch", NULL, 0); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "POST"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, forUpdate) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPurge) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlQuery_param = NULL, _0; - zval sqlQuery; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&sqlQuery); + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "forupdate", NULL, 0, &sqlQuery); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PURGE"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getColumnDefinition) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addPut) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&column_sub); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "getcolumndefinition", NULL, 0, column); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "PUT"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getColumnList) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addTrace) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *columnList, columnList_sub, _0; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&columnList_sub); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(columnList) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &columnList); + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "getcolumnlist", NULL, 0, columnList); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "TRACE"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addroute", NULL, 0, &pattern, paths, &_0); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getConnectionId) +static PHP_METHOD(Phalcon_Mvc_Router_Group, beforeMatch) { + zval *beforeMatch, beforeMatch_sub; zval *this_ptr = getThis(); + ZVAL_UNDEF(&beforeMatch_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(beforeMatch) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &beforeMatch); - RETURN_MEMBER(getThis(), "connectionId"); + zephir_update_property_zval(this_ptr, ZEND_STRL("beforeMatch"), beforeMatch); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDefaultIdValue) +static PHP_METHOD(Phalcon_Mvc_Router_Group, clear) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); @@ -57435,820 +62337,513 @@ static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDefaultIdValue) ZEPHIR_MM_GROW(); - object_init_ex(return_value, phalcon_db_rawvalue_ce); ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "null"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); - zephir_check_call_status(); - RETURN_MM(); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("routes"), &_0); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDefaultValue) +static PHP_METHOD(Phalcon_Mvc_Router_Group, getBeforeMatch) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - object_init_ex(return_value, phalcon_db_rawvalue_ce); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "DEFAULT"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MEMBER(getThis(), "beforeMatch"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDescriptor) +static PHP_METHOD(Phalcon_Mvc_Router_Group, getHostname) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "descriptor"); + RETURN_MEMBER(getThis(), "hostname"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDialect) +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPaths) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "dialect"); + RETURN_MEMBER(getThis(), "paths"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getDialectType) +static PHP_METHOD(Phalcon_Mvc_Router_Group, getPrefix) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "dialectType"); + RETURN_MEMBER(getThis(), "prefix"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getEventsManager) +static PHP_METHOD(Phalcon_Mvc_Router_Group, getRoutes) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "eventsManager"); + RETURN_MEMBER(getThis(), "routes"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getNestedTransactionSavepointName) +static PHP_METHOD(Phalcon_Mvc_Router_Group, setHostname) { - zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *hostname_param = NULL; + zval hostname; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); - - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CONCAT_SV(return_value, "PHALCON_SAVEPOINT_", &_0); - return; -} + ZVAL_UNDEF(&hostname); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(hostname) + ZEND_PARSE_PARAMETERS_END(); +#endif -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getRealSQLStatement) -{ - zval *this_ptr = getThis(); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + zephir_get_strval(&hostname, hostname_param); - RETURN_MEMBER(getThis(), "realSqlStatement"); + zephir_update_property_zval(this_ptr, ZEND_STRL("hostname"), &hostname); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getSQLBindTypes) +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPaths) { + zval *paths, paths_sub; zval *this_ptr = getThis(); + ZVAL_UNDEF(&paths_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(paths) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "sqlBindTypes"); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getSQLStatement) -{ - zval *this_ptr = getThis(); - + zephir_fetch_params_without_memory_grow(1, 0, &paths); - RETURN_MEMBER(getThis(), "sqlStatement"); + zephir_update_property_zval(this_ptr, ZEND_STRL("paths"), paths); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getSQLVariables) +static PHP_METHOD(Phalcon_Mvc_Router_Group, setPrefix) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *prefix_param = NULL; + zval prefix; zval *this_ptr = getThis(); + ZVAL_UNDEF(&prefix); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(prefix) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_MEMBER(getThis(), "sqlVariables"); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, getType) -{ - zval *this_ptr = getThis(); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &prefix_param); + zephir_get_strval(&prefix, prefix_param); - RETURN_MEMBER(getThis(), "type"); + zephir_update_property_zval(this_ptr, ZEND_STRL("prefix"), &prefix); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, insert) +static PHP_METHOD(Phalcon_Mvc_Router_Group, addRoute) { - zend_bool _6$$4, _11$$12; - zend_string *_5; - zend_ulong _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval values; - zval *table_param = NULL, *values_param = NULL, *fields = NULL, fields_sub, *dataTypes = NULL, dataTypes_sub, __$null, bindDataTypes, bindType, escapedTable, escapedFields, field, insertSql, insertValues, joinedValues, placeholders, position, tableName, value, *_2, _3, _16, _17, _0$$3, _9$$8, _10$$9, _14$$16, _15$$17, *_18$$22, _19$$22, _22$$22, _20$$23, _21$$24; - zval table, _1$$3, _7$$5, _8$$7, _12$$13, _13$$15; + zephir_fcall_cache_entry *_0 = NULL; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *httpMethods = NULL, httpMethods_sub, __$null, mergedPaths, route, defaultPaths, processedPaths, _1, _2; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_12$$13); - ZVAL_UNDEF(&_13$$15); - ZVAL_UNDEF(&fields_sub); - ZVAL_UNDEF(&dataTypes_sub); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_UNDEF(&httpMethods_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&bindDataTypes); - ZVAL_UNDEF(&bindType); - ZVAL_UNDEF(&escapedTable); - ZVAL_UNDEF(&escapedFields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&insertSql); - ZVAL_UNDEF(&insertValues); - ZVAL_UNDEF(&joinedValues); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_16); - ZVAL_UNDEF(&_17); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_9$$8); - ZVAL_UNDEF(&_10$$9); - ZVAL_UNDEF(&_14$$16); - ZVAL_UNDEF(&_15$$17); - ZVAL_UNDEF(&_19$$22); - ZVAL_UNDEF(&_22$$22); - ZVAL_UNDEF(&_20$$23); - ZVAL_UNDEF(&_21$$24); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&mergedPaths); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&defaultPaths); + ZVAL_UNDEF(&processedPaths); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR(table) - Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(fields) - Z_PARAM_ZVAL_OR_NULL(dataTypes) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 2, &table_param, &values_param, &fields, &dataTypes); - zephir_get_strval(&table, table_param); - ZEPHIR_OBS_COPY_OR_DUP(&values, values_param); - if (!fields) { - fields = &fields_sub; - fields = &__$null; + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); } - if (!dataTypes) { - dataTypes = &dataTypes_sub; - dataTypes = &__$null; + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; + } + if (!httpMethods) { + httpMethods = &httpMethods_sub; + httpMethods = &__$null; } - if (UNEXPECTED(!(zephir_fast_count_int(&values)))) { - ZEPHIR_INIT_VAR(&_0$$3); - object_init_ex(&_0$$3, phalcon_db_exception_ce); - ZEPHIR_INIT_VAR(&_1$$3); - ZEPHIR_CONCAT_SVS(&_1$$3, "Unable to insert into ", &table, " without data"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); - zephir_check_call_status(); - zephir_throw_exception_debug(&_0$$3, "phalcon/Db/Adapter/AbstractAdapter.zep", 826); - ZEPHIR_MM_RESTORE(); - return; - } - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); - ZEPHIR_INIT_VAR(&insertValues); - array_init(&insertValues); - ZEPHIR_INIT_VAR(&bindDataTypes); - array_init(&bindDataTypes); - zephir_is_iterable(&values, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 864); - if (Z_TYPE_P(&values) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&values), _4, _5, _2) - { - ZEPHIR_INIT_NVAR(&position); - if (_5 != NULL) { - ZVAL_STR_COPY(&position, _5); - } else { - ZVAL_LONG(&position, _4); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _2); - _6$$4 = Z_TYPE_P(&value) == IS_OBJECT; - if (_6$$4) { - _6$$4 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); - } - if (_6$$4) { - zephir_cast_to_string(&_7$$5, &value); - zephir_array_append(&placeholders, &_7$$5, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 839); - } else { - if (Z_TYPE_P(&value) == IS_OBJECT) { - zephir_cast_to_string(&_8$$7, &value); - ZEPHIR_CPY_WRT(&value, &_8$$7); - } - if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_9$$8); - ZVAL_STRING(&_9$$8, "null"); - zephir_array_append(&placeholders, &_9$$8, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 846); - } else { - ZEPHIR_INIT_NVAR(&_10$$9); - ZVAL_STRING(&_10$$9, "?"); - zephir_array_append(&placeholders, &_10$$9, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 848); - zephir_array_append(&insertValues, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 849); - if (Z_TYPE_P(dataTypes) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, dataTypes, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Incomplete number of bind types", "phalcon/Db/Adapter/AbstractAdapter.zep", 855); - return; - } - zephir_array_append(&bindDataTypes, &bindType, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 858); - } - } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3, &values, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &values, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); - zephir_check_call_status(); - _11$$12 = Z_TYPE_P(&value) == IS_OBJECT; - if (_11$$12) { - _11$$12 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); - } - if (_11$$12) { - zephir_cast_to_string(&_12$$13, &value); - zephir_array_append(&placeholders, &_12$$13, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 839); - } else { - if (Z_TYPE_P(&value) == IS_OBJECT) { - zephir_cast_to_string(&_13$$15, &value); - ZEPHIR_CPY_WRT(&value, &_13$$15); - } - if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_14$$16); - ZVAL_STRING(&_14$$16, "null"); - zephir_array_append(&placeholders, &_14$$16, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 846); - } else { - ZEPHIR_INIT_NVAR(&_15$$17); - ZVAL_STRING(&_15$$17, "?"); - zephir_array_append(&placeholders, &_15$$17, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 848); - zephir_array_append(&insertValues, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 849); - if (Z_TYPE_P(dataTypes) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, dataTypes, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Incomplete number of bind types", "phalcon/Db/Adapter/AbstractAdapter.zep", 855); - return; - } - zephir_array_append(&bindDataTypes, &bindType, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 858); - } - } - } - ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); + ZEPHIR_OBS_VAR(&defaultPaths); + zephir_read_property(&defaultPaths, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC); + if (Z_TYPE_P(&defaultPaths) == IS_ARRAY) { + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 0, paths); zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&processedPaths, paths); } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&position); - ZEPHIR_INIT_VAR(&_16); - ZVAL_STRING(&_16, "."); - ZEPHIR_INIT_VAR(&_17); - zephir_fast_strpos(&_17, &table, &_16, 0 ); - if (ZEPHIR_GT_LONG(&_17, 0)) { - ZEPHIR_INIT_VAR(&tableName); - zephir_fast_explode_str(&tableName, SL("."), &table, LONG_MAX); - } else { - ZEPHIR_CPY_WRT(&tableName, &table); - } - ZEPHIR_CALL_METHOD(&escapedTable, this_ptr, "escapeidentifier", NULL, 0, &tableName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&joinedValues); - zephir_fast_join_str(&joinedValues, SL(", "), &placeholders); - ZEPHIR_INIT_VAR(&insertSql); - if (Z_TYPE_P(fields) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&escapedFields); - array_init(&escapedFields); - zephir_is_iterable(fields, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 884); - if (Z_TYPE_P(fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(fields), _18$$22) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _18$$22); - ZEPHIR_CALL_METHOD(&_20$$23, this_ptr, "escapeidentifier", NULL, 0, &field); - zephir_check_call_status(); - zephir_array_append(&escapedFields, &_20$$23, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 881); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&processedPaths) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&mergedPaths); + zephir_fast_array_merge(&mergedPaths, &defaultPaths, &processedPaths); } else { - ZEPHIR_CALL_METHOD(NULL, fields, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_19$$22, fields, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_19$$22)) { - break; - } - ZEPHIR_CALL_METHOD(&field, fields, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_21$$24, this_ptr, "escapeidentifier", NULL, 0, &field); - zephir_check_call_status(); - zephir_array_append(&escapedFields, &_21$$24, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 881); - ZEPHIR_CALL_METHOD(NULL, fields, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_CPY_WRT(&mergedPaths, &defaultPaths); } - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_INIT_VAR(&_22$$22); - zephir_fast_join_str(&_22$$22, SL(", "), &escapedFields); - ZEPHIR_CONCAT_SVSVSVS(&insertSql, "INSERT INTO ", &escapedTable, " (", &_22$$22, ") VALUES (", &joinedValues, ")"); } else { - ZEPHIR_CONCAT_SVSVS(&insertSql, "INSERT INTO ", &escapedTable, " VALUES (", &joinedValues, ")"); - } - if (!(zephir_fast_count_int(&bindDataTypes))) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &insertSql, &insertValues); - zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_CPY_WRT(&mergedPaths, paths); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &insertSql, &insertValues, &bindDataTypes); + ZEPHIR_INIT_VAR(&route); + object_init_ex(&route, phalcon_mvc_router_route_ce); + zephir_read_property(&_1, this_ptr, ZEND_STRL("prefix"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VV(&_2, &_1, &pattern); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 100, &_2, &mergedPaths, httpMethods); zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_array_append(this_ptr, SL("routes"), &route); + ZEPHIR_CALL_METHOD(NULL, &route, "setgroup", NULL, 488, this_ptr); + zephir_check_call_status(); + RETURN_CCTOR(&route); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, insertAsDict) +zend_object *zephir_init_properties_Phalcon_Mvc_Router_Group(zend_class_entry *class_type) { - zend_string *_4; - zend_ulong _3; - zend_bool _0; + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *data, data_sub, *dataTypes = NULL, dataTypes_sub, __$null, values, fields, field, value, *_1, _2; - zval table; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&dataTypes_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STR(table) - Z_PARAM_ZVAL(data) - Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(dataTypes) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &table_param, &data, &dataTypes); - zephir_get_strval(&table, table_param); - if (!dataTypes) { - dataTypes = &dataTypes_sub; - dataTypes = &__$null; - } - + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + - ZEPHIR_INIT_VAR(&values); - array_init(&values); - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - _0 = Z_TYPE_P(data) != IS_ARRAY; - if (!(_0)) { - _0 = ZEPHIR_IS_EMPTY(data); - } - if (_0) { - RETURN_MM_BOOL(0); - } - zephir_is_iterable(data, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 930); - if (Z_TYPE_P(data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(data), _3, _4, _1) - { - ZEPHIR_INIT_NVAR(&field); - if (_4 != NULL) { - ZVAL_STR_COPY(&field, _4); - } else { - ZVAL_LONG(&field, _3); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _1); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 926); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 927); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, data, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, data, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&field, data, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, data, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 926); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 927); - ZEPHIR_CALL_METHOD(NULL, data, "next", NULL, 0); - zephir_check_call_status(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("routes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("routes"), &_1$$3); } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "insert", NULL, 0, &table, &values, &fields, dataTypes); - zephir_check_call_status(); - RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, isNestedTransactionsWithSavepoints) -{ - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "transactionsWithSavepoints"); -} +#ifdef HAVE_CONFIG_H +#endif -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, limit) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long number, ZEPHIR_LAST_CALL_STATUS; - zval *sqlQuery_param = NULL, *number_param = NULL, _0, _1; - zval sqlQuery; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(sqlQuery) - Z_PARAM_LONG(number) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - } - number = zephir_get_intval(number_param); +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_GroupInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, GroupInterface, phalcon, mvc_router_groupinterface, phalcon_mvc_router_groupinterface_method_entry); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_1, number); - ZEPHIR_RETURN_CALL_METHOD(&_0, "limit", NULL, 0, &sqlQuery, &_1); - zephir_check_call_status(); - RETURN_MM(); + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, listTables) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *schemaName_param = NULL, tables, table, allTables, _0, _1, _2, *_3, _4, _5$$3, _6$$4; - zval schemaName; - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, add); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addConnect); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addDelete); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addGet); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addHead); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addOptions); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPatch); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPost); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPurge); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addPut); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, addTrace); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, beforeMatch); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, clear); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getBeforeMatch); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getHostname); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPaths); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getPrefix); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, getRoutes); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setHostname); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPaths); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_GroupInterface, setPrefix); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&allTables); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - } - ZEPHIR_INIT_VAR(&allTables); - array_init(&allTables); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "listtables", NULL, 0, &schemaName); - zephir_check_call_status(); - ZVAL_LONG(&_2, 3); - ZEPHIR_CALL_METHOD(&tables, this_ptr, "fetchall", NULL, 0, &_1, &_2); - zephir_check_call_status(); - zephir_is_iterable(&tables, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 977); - if (Z_TYPE_P(&tables) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&tables), _3) - { - ZEPHIR_INIT_NVAR(&table); - ZVAL_COPY(&table, _3); - zephir_array_fetch_long(&_5$$3, &table, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 974); - zephir_array_append(&allTables, &_5$$3, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 974); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &tables, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &tables, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&table, &tables, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_long(&_6$$4, &table, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 974); - zephir_array_append(&allTables, &_6$$4, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 974); - ZEPHIR_CALL_METHOD(NULL, &tables, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&table); - RETURN_CCTOR(&allTables); + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_Route) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Router, Route, phalcon, mvc_router_route, phalcon_mvc_router_route_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("beforeMatch"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("compiledPattern"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("converters"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("group"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("hostname"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("id"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("methods"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("match"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("name"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("paths"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_router_route_ce, SL("pattern"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_mvc_router_route_ce, SL("uniqueId"), 0, ZEND_ACC_PROTECTED|ZEND_ACC_STATIC); + phalcon_mvc_router_route_ce->create_object = zephir_init_properties_Phalcon_Mvc_Router_Route; + + zend_class_implements(phalcon_mvc_router_route_ce, 1, phalcon_mvc_router_routeinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, listViews) +static PHP_METHOD(Phalcon_Mvc_Router_Route, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *schemaName_param = NULL, tables, table, allTables, _0, _1, _2, *_3, _4, _5$$3, _6$$4; - zval schemaName; + zval *pattern_param = NULL, *paths = NULL, paths_sub, *httpMethods = NULL, httpMethods_sub, __$null, routeId, uniqueId, _0; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&allTables); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); + ZVAL_UNDEF(&httpMethods_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&routeId); + ZVAL_UNDEF(&uniqueId); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_6$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + Z_PARAM_ZVAL_OR_NULL(paths) + Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &schemaName_param); - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; } + if (!httpMethods) { + httpMethods = &httpMethods_sub; + httpMethods = &__$null; } - ZEPHIR_INIT_VAR(&allTables); - array_init(&allTables); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "listviews", NULL, 0, &schemaName); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, &pattern, paths); zephir_check_call_status(); - ZVAL_LONG(&_2, 3); - ZEPHIR_CALL_METHOD(&tables, this_ptr, "fetchall", NULL, 0, &_1, &_2); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "via", NULL, 0, httpMethods); zephir_check_call_status(); - zephir_is_iterable(&tables, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 1004); - if (Z_TYPE_P(&tables) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&tables), _3) - { - ZEPHIR_INIT_NVAR(&table); - ZVAL_COPY(&table, _3); - zephir_array_fetch_long(&_5$$3, &table, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 1001); - zephir_array_append(&allTables, &_5$$3, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1001); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &tables, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &tables, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&table, &tables, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_long(&_6$$4, &table, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 1001); - zephir_array_append(&allTables, &_6$$4, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1001); - ZEPHIR_CALL_METHOD(NULL, &tables, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&table); - RETURN_CCTOR(&allTables); + ZEPHIR_OBS_VAR(&_0); + zephir_read_static_property_ce(&_0, phalcon_mvc_router_route_ce, SL("uniqueId"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(&uniqueId, &_0); + ZEPHIR_CPY_WRT(&routeId, &uniqueId); + zephir_update_property_zval(this_ptr, ZEND_STRL("id"), &routeId); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, (zephir_get_numberval(&uniqueId) + 1)); + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, ZEND_STRL("uniqueId"), &_0); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, modifyColumn) +static PHP_METHOD(Phalcon_Mvc_Router_Route, beforeMatch) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, *currentColumn = NULL, currentColumn_sub, __$null, _0, _1; - zval tableName, schemaName; + zval *callback, callback_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(¤tColumn_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&callback_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) - Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(currentColumn, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(callback) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!currentColumn) { - currentColumn = ¤tColumn_sub; - currentColumn = &__$null; - } + zephir_fetch_params_without_memory_grow(1, 0, &callback); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "modifycolumn", NULL, 0, &tableName, &schemaName, column, currentColumn); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_1); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("beforeMatch"), callback); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, releaseSavepoint) +static PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { + zend_bool _14; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, dialect, _0, _1, _2, _3; - zval name; + zval *pattern_param = NULL, _0$$4, _1$$4, _2$$5, _3$$5, _4$$6, _5$$6, _6$$7, _7$$7, _8$$8, _9$$8, _10$$8, _11$$9, _12$$9, _13$$9; + zval pattern, idPattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&dialect); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&idPattern); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$6); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_9$$8); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_11$$9); + ZVAL_UNDEF(&_12$$9); + ZVAL_UNDEF(&_13$$9); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + zephir_fetch_params(1, 1, 0, &pattern_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_INIT_VAR(&pattern); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&dialect, &_0); - ZEPHIR_CALL_METHOD(&_1, &dialect, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Savepoints are not supported by this database adapter", "phalcon/Db/Adapter/AbstractAdapter.zep", 1034); - return; + if (zephir_memnstr_str(&pattern, SL(":"), "phalcon/Mvc/Router/Route.zep", 141)) { + ZEPHIR_INIT_VAR(&idPattern); + ZVAL_STRING(&idPattern, "/([\\w0-9\\_\\-]+)"); + if (zephir_memnstr_str(&pattern, SL("/:module"), "phalcon/Mvc/Router/Route.zep", 146)) { + ZEPHIR_INIT_VAR(&_0$$4); + ZEPHIR_INIT_VAR(&_1$$4); + ZVAL_STRING(&_1$$4, "/:module"); + zephir_fast_str_replace(&_0$$4, &_1$$4, &idPattern, &pattern); + zephir_get_strval(&pattern, &_0$$4); + } + if (zephir_memnstr_str(&pattern, SL("/:controller"), "phalcon/Mvc/Router/Route.zep", 151)) { + ZEPHIR_INIT_VAR(&_2$$5); + ZEPHIR_INIT_VAR(&_3$$5); + ZVAL_STRING(&_3$$5, "/:controller"); + zephir_fast_str_replace(&_2$$5, &_3$$5, &idPattern, &pattern); + zephir_get_strval(&pattern, &_2$$5); + } + if (zephir_memnstr_str(&pattern, SL("/:namespace"), "phalcon/Mvc/Router/Route.zep", 156)) { + ZEPHIR_INIT_VAR(&_4$$6); + ZEPHIR_INIT_VAR(&_5$$6); + ZVAL_STRING(&_5$$6, "/:namespace"); + zephir_fast_str_replace(&_4$$6, &_5$$6, &idPattern, &pattern); + zephir_get_strval(&pattern, &_4$$6); + } + if (zephir_memnstr_str(&pattern, SL("/:action"), "phalcon/Mvc/Router/Route.zep", 161)) { + ZEPHIR_INIT_VAR(&_6$$7); + ZEPHIR_INIT_VAR(&_7$$7); + ZVAL_STRING(&_7$$7, "/:action"); + zephir_fast_str_replace(&_6$$7, &_7$$7, &idPattern, &pattern); + zephir_get_strval(&pattern, &_6$$7); + } + if (zephir_memnstr_str(&pattern, SL("/:params"), "phalcon/Mvc/Router/Route.zep", 166)) { + ZEPHIR_INIT_VAR(&_8$$8); + ZEPHIR_INIT_VAR(&_9$$8); + ZVAL_STRING(&_9$$8, "/:params"); + ZEPHIR_INIT_VAR(&_10$$8); + ZVAL_STRING(&_10$$8, "(/.*)*"); + zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, &pattern); + zephir_get_strval(&pattern, &_8$$8); + } + if (zephir_memnstr_str(&pattern, SL("/:int"), "phalcon/Mvc/Router/Route.zep", 171)) { + ZEPHIR_INIT_VAR(&_11$$9); + ZEPHIR_INIT_VAR(&_12$$9); + ZVAL_STRING(&_12$$9, "/:int"); + ZEPHIR_INIT_VAR(&_13$$9); + ZVAL_STRING(&_13$$9, "/([0-9]+)"); + zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, &pattern); + zephir_get_strval(&pattern, &_11$$9); + } } - ZEPHIR_CALL_METHOD(&_2, &dialect, "supportsreleasesavepoints", NULL, 0); - zephir_check_call_status(); - if (!(zephir_is_true(&_2))) { - RETURN_MM_BOOL(0); + _14 = zephir_memnstr_str(&pattern, SL("("), "phalcon/Mvc/Router/Route.zep", 182); + if (!(_14)) { + _14 = zephir_memnstr_str(&pattern, SL("["), "phalcon/Mvc/Router/Route.zep", 182); } - ZEPHIR_CALL_METHOD(&_3, &dialect, "releasesavepoint", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_3); - zephir_check_call_status(); - RETURN_MM(); + if (_14) { + ZEPHIR_CONCAT_SVS(return_value, "#^", &pattern, "$#u"); + RETURN_MM(); + } + RETURN_CTOR(&pattern); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, rollbackSavepoint) +static PHP_METHOD(Phalcon_Mvc_Router_Route, convert) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, dialect, _0, _1, _2; + zval *name_param = NULL, *converter, converter_sub; zval name; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&dialect); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&converter_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(name) + Z_PARAM_ZVAL(converter) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); + zephir_fetch_params(1, 2, 0, &name_param, &converter); if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); @@ -58260,689 +62855,729 @@ static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, rollbackSavepoint) } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&dialect, &_0); - ZEPHIR_CALL_METHOD(&_1, &dialect, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_1))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Savepoints are not supported by this database adapter", "phalcon/Db/Adapter/AbstractAdapter.zep", 1058); - return; - } - ZEPHIR_CALL_METHOD(&_2, &dialect, "rollbacksavepoint", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_2); - zephir_check_call_status(); - RETURN_MM(); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, setEventsManager) -{ - zval *eventsManager, eventsManager_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&eventsManager_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(eventsManager, phalcon_events_managerinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &eventsManager); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("eventsManager"), eventsManager); -} - -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, setDialect) -{ - zval *dialect, dialect_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&dialect_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_OBJECT_OF_CLASS(dialect, phalcon_db_dialectinterface_ce) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(1, 0, &dialect); - - - zephir_update_property_zval(this_ptr, ZEND_STRL("dialect"), dialect); + zephir_update_property_array(this_ptr, SL("converters"), &name, converter); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, setNestedTransactionsWithSavepoints) +static PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) { + long _0, _5$$10, _26$$18; + zend_long cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches; + zend_bool notValid = 0, _6$$11, _7$$11, _8$$11, _9$$11, _10$$11, _11$$11, _12$$11, _13$$11, _14$$11, _15$$11, _16$$11, _17$$11, _25$$17, _29$$34, _30$$35, _31$$35, _32$$35; + char ch = 0, prevCh; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *nestedTransactionsWithSavepoints_param = NULL, __$true, __$false, _0, _1, _2; - zend_bool nestedTransactionsWithSavepoints; + zval *pattern_param = NULL, tmp, matches, _1$$10, _2$$10, _3$$10, _18$$15, _19$$15, _20$$15, _22$$15, _23$$15; + zval pattern, route, item, variable, regexp, _4$$10, _21$$15, _24$$15, _27$$25, _28$$28; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&route); + ZVAL_UNDEF(&item); + ZVAL_UNDEF(&variable); + ZVAL_UNDEF(®exp); + ZVAL_UNDEF(&_4$$10); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_24$$15); + ZVAL_UNDEF(&_27$$25); + ZVAL_UNDEF(&_28$$28); + ZVAL_UNDEF(&tmp); + ZVAL_UNDEF(&matches); + ZVAL_UNDEF(&_1$$10); + ZVAL_UNDEF(&_2$$10); + ZVAL_UNDEF(&_3$$10); + ZVAL_UNDEF(&_18$$15); + ZVAL_UNDEF(&_19$$15); + ZVAL_UNDEF(&_20$$15); + ZVAL_UNDEF(&_22$$15); + ZVAL_UNDEF(&_23$$15); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_BOOL(nestedTransactionsWithSavepoints) + Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &nestedTransactionsWithSavepoints_param); - nestedTransactionsWithSavepoints = zephir_get_boolval(nestedTransactionsWithSavepoints_param); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (UNEXPECTED(ZEPHIR_GT_LONG(&_0, 0))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Nested transaction with savepoints behavior cannot be changed while a transaction is open", "phalcon/Db/Adapter/AbstractAdapter.zep", 1090); - return; - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_2))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Savepoints are not supported by this database adapter", "phalcon/Db/Adapter/AbstractAdapter.zep", 1096); - return; + zephir_fetch_params(1, 1, 0, &pattern_param); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); } - if (nestedTransactionsWithSavepoints) { - zephir_update_property_zval(this_ptr, ZEND_STRL("transactionsWithSavepoints"), &__$true); + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); } else { - zephir_update_property_zval(this_ptr, ZEND_STRL("transactionsWithSavepoints"), &__$false); + ZEPHIR_INIT_VAR(&pattern); } - RETURN_THIS(); -} -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, sharedLock) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlQuery_param = NULL, _0; - zval sqlQuery; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlQuery) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string")); - RETURN_MM_NULL(); + prevCh = '\0'; + bracketCount = 0; + parenthesesCount = 0; + foundPattern = 0; + intermediate = 0; + numberMatches = 0; + if (zephir_fast_strlen_ev(&pattern) == 0) { + RETURN_MM_BOOL(0); } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); + ZEPHIR_INIT_VAR(&matches); + array_init(&matches); + ZEPHIR_INIT_VAR(&route); + for (_0 = 0; _0 < Z_STRLEN_P(&pattern); _0++) { + cursor = _0; + ch = ZEPHIR_STRING_OFFSET(&pattern, _0); + if (parenthesesCount == 0) { + if (ch == '{') { + if (bracketCount == 0) { + marker = (cursor + 1); + intermediate = 0; + notValid = 0; + } + bracketCount++; + } else if (ch == '}') { + bracketCount--; + if (intermediate > 0) { + if (bracketCount == 0) { + numberMatches++; + ZEPHIR_INIT_NVAR(&variable); + ZEPHIR_INIT_NVAR(®exp); + ZVAL_LONG(&_1$$10, marker); + ZVAL_LONG(&_2$$10, (cursor - marker)); + ZEPHIR_INIT_NVAR(&_3$$10); + zephir_substr(&_3$$10, &pattern, zephir_get_intval(&_1$$10), zephir_get_intval(&_2$$10), 0); + zephir_cast_to_string(&_4$$10, &_3$$10); + ZEPHIR_CPY_WRT(&item, &_4$$10); + for (_5$$10 = 0; _5$$10 < Z_STRLEN_P(&item); _5$$10++) { + cursorVar = _5$$10; + ch = ZEPHIR_STRING_OFFSET(&item, _5$$10); + if (ch == '\0') { + break; + } + _6$$11 = cursorVar == 0; + if (_6$$11) { + _7$$11 = ch >= 'a'; + if (_7$$11) { + _7$$11 = ch <= 'z'; + } + _8$$11 = _7$$11; + if (!(_8$$11)) { + _9$$11 = ch >= 'A'; + if (_9$$11) { + _9$$11 = ch <= 'Z'; + } + _8$$11 = _9$$11; + } + _6$$11 = !(_8$$11); + } + if (_6$$11) { + notValid = 1; + break; + } + _10$$11 = ch >= 'a'; + if (_10$$11) { + _10$$11 = ch <= 'z'; + } + _11$$11 = _10$$11; + if (!(_11$$11)) { + _12$$11 = ch >= 'A'; + if (_12$$11) { + _12$$11 = ch <= 'Z'; + } + _11$$11 = _12$$11; + } + _13$$11 = _11$$11; + if (!(_13$$11)) { + _14$$11 = ch >= '0'; + if (_14$$11) { + _14$$11 = ch <= '9'; + } + _13$$11 = _14$$11; + } + _15$$11 = _13$$11; + if (!(_15$$11)) { + _15$$11 = ch == '-'; + } + _16$$11 = _15$$11; + if (!(_16$$11)) { + _16$$11 = ch == '_'; + } + _17$$11 = _16$$11; + if (!(_17$$11)) { + _17$$11 = ch == ':'; + } + if (_17$$11) { + if (ch == ':') { + ZVAL_LONG(&_18$$15, 0); + ZVAL_LONG(&_19$$15, cursorVar); + ZEPHIR_INIT_NVAR(&_20$$15); + zephir_substr(&_20$$15, &item, 0 , zephir_get_intval(&_19$$15), 0); + zephir_cast_to_string(&_21$$15, &_20$$15); + ZEPHIR_CPY_WRT(&variable, &_21$$15); + ZVAL_LONG(&_22$$15, (cursorVar + 1)); + ZEPHIR_INIT_NVAR(&_23$$15); + zephir_substr(&_23$$15, &item, zephir_get_intval(&_22$$15), 0, ZEPHIR_SUBSTR_NO_LENGTH); + zephir_cast_to_string(&_24$$15, &_23$$15); + ZEPHIR_CPY_WRT(®exp, &_24$$15); + break; + } + } else { + notValid = 1; + break; + } + } + if (!(notValid)) { + ZEPHIR_INIT_NVAR(&tmp); + ZVAL_LONG(&tmp, numberMatches); + _25$$17 = zephir_is_true(&variable); + if (_25$$17) { + _25$$17 = zephir_is_true(®exp); + } + if (_25$$17) { + foundPattern = 0; + for (_26$$18 = 0; _26$$18 < Z_STRLEN_P(®exp); _26$$18++) { + ch = ZEPHIR_STRING_OFFSET(®exp, _26$$18); + if (ch == '\0') { + break; + } + if (!(foundPattern)) { + if (ch == '(') { + foundPattern = 1; + } + } else { + if (ch == ')') { + foundPattern = 2; + break; + } + } + } + if (foundPattern != 2) { + ZEPHIR_INIT_NVAR(&_27$$25); + ZEPHIR_CONCAT_SVS(&_27$$25, "(", ®exp, ")"); + zephir_concat_self(&route, &_27$$25); + } else { + zephir_concat_self(&route, ®exp); + } + zephir_array_update_zval(&matches, &variable, &tmp, PH_COPY | PH_SEPARATE); + } else { + zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)") - 1); + zephir_array_update_zval(&matches, &item, &tmp, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_INIT_NVAR(&_28$$28); + ZEPHIR_CONCAT_SVS(&_28$$28, "{", &item, "}"); + zephir_concat_self(&route, &_28$$28); + } + continue; + } + } + } + } + if (bracketCount == 0) { + if (ch == '(') { + parenthesesCount++; + } else if (ch == ')') { + parenthesesCount--; + if (parenthesesCount == 0) { + numberMatches++; + } + } + } + if (bracketCount > 0) { + intermediate++; + } else { + _29$$34 = parenthesesCount == 0; + if (_29$$34) { + _29$$34 = prevCh != '\\'; + } + if (_29$$34) { + _30$$35 = ch == '.'; + if (!(_30$$35)) { + _30$$35 = ch == '+'; + } + _31$$35 = _30$$35; + if (!(_31$$35)) { + _31$$35 = ch == '|'; + } + _32$$35 = _31$$35; + if (!(_32$$35)) { + _32$$35 = ch == '#'; + } + if (_32$$35) { + zephir_concat_self_str(&route, "\\", sizeof("\\") - 1); + } + } + zephir_concat_self_char(&route, ch); + prevCh = ch; + } } + zephir_create_array(return_value, 2, 0); + zephir_array_fast_append(return_value, &route); + zephir_array_fast_append(return_value, &matches); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getBeforeMatch) +{ + zval *this_ptr = getThis(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "sharedlock", NULL, 0, &sqlQuery); - zephir_check_call_status(); - RETURN_MM(); + + RETURN_MEMBER(getThis(), "beforeMatch"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, supportSequences) +static PHP_METHOD(Phalcon_Mvc_Router_Route, getCompiledPattern) { zval *this_ptr = getThis(); - RETURN_BOOL(0); + RETURN_MEMBER(getThis(), "compiledPattern"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, tableExists) +static PHP_METHOD(Phalcon_Mvc_Router_Route, getConverters) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, _0, _1, _2, _3, _4; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); - } else { - ZEPHIR_INIT_VAR(&schemaName); - } - } + RETURN_MEMBER(getThis(), "converters"); +} +static PHP_METHOD(Phalcon_Mvc_Router_Route, getGroup) +{ + zval *this_ptr = getThis(); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "tableexists", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchone", NULL, 0, &_2, &_3); - zephir_check_call_status(); - zephir_array_fetch_long(&_4, &_0, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 1132); - RETURN_MM_BOOL(ZEPHIR_GT_LONG(&_4, 0)); + + + RETURN_MEMBER(getThis(), "group"); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, tableOptions) +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHttpMethods) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "methods"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getHostname) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "hostname"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getId) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "id"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getMatch) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "match"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "name"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPaths) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "paths"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getPattern) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "pattern"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getReversedPaths) { + zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, sql, _0, _1, _2, _3; - zval tableName, schemaName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(tableName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - zephir_get_strval(&schemaName, schemaName_param); - } - - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&sql, &_0, "tableoptions", NULL, 0, &tableName, &schemaName); - zephir_check_call_status(); - if (!(zephir_is_true(&sql))) { - array_init(return_value); - RETURN_MM(); - } - ZVAL_LONG(&_2, 2); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "fetchall", NULL, 0, &sql, &_2); + zephir_read_property(&_0, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_RETURN_CALL_FUNCTION("array_flip", NULL, 99, &_0); zephir_check_call_status(); - zephir_array_fetch_long(&_3, &_1, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 1154); - RETURN_CTOR(&_3); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, update) +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRouteId) { - zend_bool _5$$3, _11$$12; - zend_string *_3; - zend_ulong _2; + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "id"); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, getRoutePaths) +{ + zend_long _0$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *fields, fields_sub, *values, values_sub, *whereCondition = NULL, whereCondition_sub, *dataTypes = NULL, dataTypes_sub, __$null, bindDataTypes, bindType, conditions, escapedField, escapedTable, field, placeholders, position, setClause, tableName, updateSql, updateValues, value, whereBind, whereTypes, *_0, _1, _17, _18, _7$$5, _9$$8, _10$$9, _13$$14, _15$$17, _16$$18; - zval table, _6$$5, _8$$7, _12$$14, _14$$16; + zval *paths = NULL, paths_sub, __$null, moduleName, controllerName, actionName, parts, routePaths, realClassName, namespaceName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_8$$7); - ZVAL_UNDEF(&_12$$14); - ZVAL_UNDEF(&_14$$16); - ZVAL_UNDEF(&fields_sub); - ZVAL_UNDEF(&values_sub); - ZVAL_UNDEF(&whereCondition_sub); - ZVAL_UNDEF(&dataTypes_sub); + ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&bindDataTypes); - ZVAL_UNDEF(&bindType); - ZVAL_UNDEF(&conditions); - ZVAL_UNDEF(&escapedField); - ZVAL_UNDEF(&escapedTable); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&setClause); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&updateSql); - ZVAL_UNDEF(&updateValues); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&whereBind); - ZVAL_UNDEF(&whereTypes); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_17); - ZVAL_UNDEF(&_18); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_9$$8); - ZVAL_UNDEF(&_10$$9); - ZVAL_UNDEF(&_13$$14); - ZVAL_UNDEF(&_15$$17); - ZVAL_UNDEF(&_16$$18); + ZVAL_UNDEF(&moduleName); + ZVAL_UNDEF(&controllerName); + ZVAL_UNDEF(&actionName); + ZVAL_UNDEF(&parts); + ZVAL_UNDEF(&routePaths); + ZVAL_UNDEF(&realClassName); + ZVAL_UNDEF(&namespaceName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 5) - Z_PARAM_STR(table) - Z_PARAM_ZVAL(fields) - Z_PARAM_ZVAL(values) + ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(whereCondition) - Z_PARAM_ZVAL_OR_NULL(dataTypes) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 2, &table_param, &fields, &values, &whereCondition, &dataTypes); - zephir_get_strval(&table, table_param); - if (!whereCondition) { - whereCondition = &whereCondition_sub; - whereCondition = &__$null; - } - if (!dataTypes) { - dataTypes = &dataTypes_sub; - dataTypes = &__$null; + zephir_fetch_params(1, 0, 1, &paths); + if (!paths) { + paths = &paths_sub; + ZEPHIR_CPY_WRT(paths, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(paths); } - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); - ZEPHIR_INIT_VAR(&updateValues); - array_init(&updateValues); - ZEPHIR_INIT_VAR(&bindDataTypes); - array_init(&bindDataTypes); - zephir_is_iterable(values, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 1244); - if (Z_TYPE_P(values) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(values), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&position); - if (_3 != NULL) { - ZVAL_STR_COPY(&position, _3); - } else { - ZVAL_LONG(&position, _2); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - ZEPHIR_OBS_NVAR(&field); - if (UNEXPECTED(!(zephir_array_isset_fetch(&field, fields, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The number of values in the update is not the same as fields", "phalcon/Db/Adapter/AbstractAdapter.zep", 1209); - return; - } - ZEPHIR_CALL_METHOD(&escapedField, this_ptr, "escapeidentifier", &_4, 0, &field); - zephir_check_call_status(); - _5$$3 = Z_TYPE_P(&value) == IS_OBJECT; - if (_5$$3) { - _5$$3 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); + if (Z_TYPE_P(paths) == IS_NULL) { + ZEPHIR_INIT_NVAR(paths); + array_init(paths); + } + if (Z_TYPE_P(paths) == IS_STRING) { + ZEPHIR_INIT_VAR(&moduleName); + ZVAL_NULL(&moduleName); + ZEPHIR_INIT_VAR(&controllerName); + ZVAL_NULL(&controllerName); + ZEPHIR_INIT_VAR(&actionName); + ZVAL_NULL(&actionName); + ZEPHIR_INIT_VAR(&parts); + zephir_fast_explode_str(&parts, SL("::"), paths, LONG_MAX); + do { + _0$$4 = zephir_fast_count_int(&parts); + if (_0$$4 == 3) { + ZEPHIR_OBS_NVAR(&moduleName); + zephir_array_fetch_long(&moduleName, &parts, 0, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 467); + ZEPHIR_OBS_NVAR(&controllerName); + zephir_array_fetch_long(&controllerName, &parts, 1, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 468); + ZEPHIR_OBS_NVAR(&actionName); + zephir_array_fetch_long(&actionName, &parts, 2, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 469); + break; } - if (_5$$3) { - zephir_cast_to_string(&_6$$5, &value); - ZEPHIR_INIT_NVAR(&_7$$5); - ZEPHIR_CONCAT_VSV(&_7$$5, &escapedField, " = ", &_6$$5); - zephir_array_append(&placeholders, &_7$$5, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1215); - } else { - if (Z_TYPE_P(&value) == IS_OBJECT) { - zephir_cast_to_string(&_8$$7, &value); - ZEPHIR_CPY_WRT(&value, &_8$$7); - } - if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_9$$8); - ZEPHIR_CONCAT_VS(&_9$$8, &escapedField, " = null"); - zephir_array_append(&placeholders, &_9$$8, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1222); - } else { - zephir_array_append(&updateValues, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1224); - if (Z_TYPE_P(dataTypes) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, dataTypes, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Incomplete number of bind types", "phalcon/Db/Adapter/AbstractAdapter.zep", 1230); - return; - } - zephir_array_append(&bindDataTypes, &bindType, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1233); - } - ZEPHIR_INIT_NVAR(&_10$$9); - ZEPHIR_CONCAT_VS(&_10$$9, &escapedField, " = ?"); - zephir_array_append(&placeholders, &_10$$9, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1236); - } + if (_0$$4 == 2) { + ZEPHIR_OBS_NVAR(&controllerName); + zephir_array_fetch_long(&controllerName, &parts, 0, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 473); + ZEPHIR_OBS_NVAR(&actionName); + zephir_array_fetch_long(&actionName, &parts, 1, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 474); + break; } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, values, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, values, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (_0$$4 == 1) { + ZEPHIR_OBS_NVAR(&controllerName); + zephir_array_fetch_long(&controllerName, &parts, 0, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 478); break; } - ZEPHIR_CALL_METHOD(&position, values, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, values, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&field); - if (UNEXPECTED(!(zephir_array_isset_fetch(&field, fields, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The number of values in the update is not the same as fields", "phalcon/Db/Adapter/AbstractAdapter.zep", 1209); - return; - } - ZEPHIR_CALL_METHOD(&escapedField, this_ptr, "escapeidentifier", &_4, 0, &field); - zephir_check_call_status(); - _11$$12 = Z_TYPE_P(&value) == IS_OBJECT; - if (_11$$12) { - _11$$12 = zephir_instance_of_ev(&value, phalcon_db_rawvalue_ce); - } - if (_11$$12) { - zephir_cast_to_string(&_12$$14, &value); - ZEPHIR_INIT_NVAR(&_13$$14); - ZEPHIR_CONCAT_VSV(&_13$$14, &escapedField, " = ", &_12$$14); - zephir_array_append(&placeholders, &_13$$14, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1215); - } else { - if (Z_TYPE_P(&value) == IS_OBJECT) { - zephir_cast_to_string(&_14$$16, &value); - ZEPHIR_CPY_WRT(&value, &_14$$16); - } - if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_15$$17); - ZEPHIR_CONCAT_VS(&_15$$17, &escapedField, " = null"); - zephir_array_append(&placeholders, &_15$$17, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1222); - } else { - zephir_array_append(&updateValues, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1224); - if (Z_TYPE_P(dataTypes) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&bindType); - if (UNEXPECTED(!(zephir_array_isset_fetch(&bindType, dataTypes, &position, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Incomplete number of bind types", "phalcon/Db/Adapter/AbstractAdapter.zep", 1230); - return; - } - zephir_array_append(&bindDataTypes, &bindType, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1233); - } - ZEPHIR_INIT_NVAR(&_16$$18); - ZEPHIR_CONCAT_VS(&_16$$18, &escapedField, " = ?"); - zephir_array_append(&placeholders, &_16$$18, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1236); - } - } - ZEPHIR_CALL_METHOD(NULL, values, "next", NULL, 0); - zephir_check_call_status(); + } while(0); + + ZEPHIR_INIT_VAR(&routePaths); + array_init(&routePaths); + if (Z_TYPE_P(&moduleName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&position); - ZEPHIR_INIT_VAR(&_17); - ZVAL_STRING(&_17, "."); - ZEPHIR_INIT_VAR(&_18); - zephir_fast_strpos(&_18, &table, &_17, 0 ); - if (ZEPHIR_GT_LONG(&_18, 0)) { - ZEPHIR_INIT_VAR(&tableName); - zephir_fast_explode_str(&tableName, SL("."), &table, LONG_MAX); - } else { - ZEPHIR_CPY_WRT(&tableName, &table); - } - ZEPHIR_CALL_METHOD(&escapedTable, this_ptr, "escapeidentifier", &_4, 0, &tableName); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&setClause); - zephir_fast_join_str(&setClause, SL(", "), &placeholders); - ZEPHIR_INIT_VAR(&updateSql); - if (Z_TYPE_P(whereCondition) != IS_NULL) { - ZEPHIR_CONCAT_SVSVS(&updateSql, "UPDATE ", &escapedTable, " SET ", &setClause, " WHERE "); - if (Z_TYPE_P(whereCondition) == IS_STRING) { - zephir_concat_self(&updateSql, whereCondition); - } else { - if (UNEXPECTED(Z_TYPE_P(whereCondition) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid WHERE clause conditions", "phalcon/Db/Adapter/AbstractAdapter.zep", 1267); - return; - } - ZEPHIR_OBS_VAR(&conditions); - if (zephir_array_isset_string_fetch(&conditions, whereCondition, SL("conditions"), 0)) { - zephir_concat_self(&updateSql, &conditions); - } - ZEPHIR_OBS_VAR(&whereBind); - if (zephir_array_isset_string_fetch(&whereBind, whereCondition, SL("bind"), 0)) { - zephir_merge_append(&updateValues, &whereBind); - } - ZEPHIR_OBS_VAR(&whereTypes); - if (zephir_array_isset_string_fetch(&whereTypes, whereCondition, SL("bindTypes"), 0)) { - zephir_merge_append(&bindDataTypes, &whereTypes); + if (Z_TYPE_P(&controllerName) != IS_NULL) { + if (zephir_memnstr_str(&controllerName, SL("\\"), "phalcon/Mvc/Router/Route.zep", 492)) { + ZEPHIR_INIT_VAR(&realClassName); + zephir_get_class_ns(&realClassName, &controllerName, 0); + ZEPHIR_INIT_VAR(&namespaceName); + zephir_get_ns_class(&namespaceName, &controllerName, 0); + if (zephir_is_true(&namespaceName)) { + zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); + } + } else { + ZEPHIR_CPY_WRT(&realClassName, &controllerName); } + zephir_array_update_string(&routePaths, SL("controller"), &realClassName, PH_COPY | PH_SEPARATE); + } + if (Z_TYPE_P(&actionName) != IS_NULL) { + zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); } } else { - ZEPHIR_CONCAT_SVSV(&updateSql, "UPDATE ", &escapedTable, " SET ", &setClause); + ZEPHIR_CPY_WRT(&routePaths, paths); } - if (!(zephir_fast_count_int(&bindDataTypes))) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &updateSql, &updateValues); - zephir_check_call_status(); - RETURN_MM(); + if (UNEXPECTED(Z_TYPE_P(&routePaths) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "The route contains invalid paths", "phalcon/Mvc/Router/Route.zep", 519); + return; } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &updateSql, &updateValues, &bindDataTypes); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CCTOR(&routePaths); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, updateAsDict) +static PHP_METHOD(Phalcon_Mvc_Router_Route, match) +{ + zval *callback, callback_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&callback_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(callback) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &callback); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("match"), callback); + RETURN_THISW(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) { - zend_string *_4; - zend_ulong _3; - zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *data, data_sub, *whereCondition = NULL, whereCondition_sub, *dataTypes = NULL, dataTypes_sub, __$null, values, fields, field, value, *_1, _2; - zval table; + zval *pattern_param = NULL, *paths = NULL, paths_sub, __$null, routePaths, pcrePattern, compiledPattern, extracted, _0$$4, _1$$4; + zval pattern; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&whereCondition_sub); - ZVAL_UNDEF(&dataTypes_sub); + ZVAL_UNDEF(&pattern); + ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&routePaths); + ZVAL_UNDEF(&pcrePattern); + ZVAL_UNDEF(&compiledPattern); + ZVAL_UNDEF(&extracted); + ZVAL_UNDEF(&_0$$4); + ZVAL_UNDEF(&_1$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 4) - Z_PARAM_STR(table) - Z_PARAM_ZVAL(data) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_STR(pattern) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(whereCondition) - Z_PARAM_ZVAL_OR_NULL(dataTypes) + Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 2, &table_param, &data, &whereCondition, &dataTypes); - zephir_get_strval(&table, table_param); - if (!whereCondition) { - whereCondition = &whereCondition_sub; - whereCondition = &__$null; + zephir_fetch_params(1, 1, 1, &pattern_param, &paths); + if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be of the type string")); + RETURN_MM_NULL(); } - if (!dataTypes) { - dataTypes = &dataTypes_sub; - dataTypes = &__$null; + if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { + zephir_get_strval(&pattern, pattern_param); + } else { + ZEPHIR_INIT_VAR(&pattern); + } + if (!paths) { + paths = &paths_sub; + paths = &__$null; } - ZEPHIR_INIT_VAR(&values); - array_init(&values); - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - _0 = Z_TYPE_P(data) != IS_ARRAY; - if (!(_0)) { - _0 = ZEPHIR_IS_EMPTY(data); - } - if (_0) { - RETURN_MM_BOOL(0); - } - zephir_is_iterable(data, 0, "phalcon/Db/Adapter/AbstractAdapter.zep", 1340); - if (Z_TYPE_P(data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(data), _3, _4, _1) - { - ZEPHIR_INIT_NVAR(&field); - if (_4 != NULL) { - ZVAL_STR_COPY(&field, _4); - } else { - ZVAL_LONG(&field, _3); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _1); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1336); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1337); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, data, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, data, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&field, data, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, data, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_append(&fields, &field, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1336); - zephir_array_append(&values, &value, PH_SEPARATE, "phalcon/Db/Adapter/AbstractAdapter.zep", 1337); - ZEPHIR_CALL_METHOD(NULL, data, "next", NULL, 0); + ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths); + zephir_check_call_status(); + if (!(zephir_start_with_str(&pattern, SL("#")))) { + if (zephir_memnstr_str(&pattern, SL("{"), "phalcon/Mvc/Router/Route.zep", 559)) { + ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, &pattern); zephir_check_call_status(); + ZEPHIR_OBS_VAR(&pcrePattern); + zephir_array_fetch_long(&pcrePattern, &extracted, 0, PH_NOISY, "phalcon/Mvc/Router/Route.zep", 564); + ZEPHIR_INIT_VAR(&_0$$4); + zephir_array_fetch_long(&_1$$4, &extracted, 1, PH_NOISY | PH_READONLY, "phalcon/Mvc/Router/Route.zep", 565); + zephir_fast_array_merge(&_0$$4, &routePaths, &_1$$4); + ZEPHIR_CPY_WRT(&routePaths, &_0$$4); + } else { + ZEPHIR_CPY_WRT(&pcrePattern, &pattern); } + ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, &pcrePattern); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&compiledPattern, &pattern); } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "update", NULL, 0, &table, &fields, &values, whereCondition, dataTypes); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("pattern"), &pattern); + zephir_update_property_zval(this_ptr, ZEND_STRL("compiledPattern"), &compiledPattern); + zephir_update_property_zval(this_ptr, ZEND_STRL("paths"), &routePaths); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, useExplicitIdValue) +static PHP_METHOD(Phalcon_Mvc_Router_Route, reset) { + zval _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + - RETURN_BOOL(0); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_static_property_ce(phalcon_mvc_router_route_ce, ZEND_STRL("uniqueId"), &_0); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, supportsDefaultValue) +static PHP_METHOD(Phalcon_Mvc_Router_Route, setGroup) { + zval *group, group_sub; zval *this_ptr = getThis(); + ZVAL_UNDEF(&group_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(group, phalcon_mvc_router_groupinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + zephir_fetch_params_without_memory_grow(1, 0, &group); - RETURN_BOOL(1); + + zephir_update_property_zval(this_ptr, ZEND_STRL("group"), group); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Adapter_AbstractAdapter, viewExists) +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHttpMethods) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *viewName_param = NULL, *schemaName_param = NULL, _0, _1, _2, _3, _4; - zval viewName, schemaName; + zval *httpMethods, httpMethods_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&viewName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&httpMethods_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(viewName) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schemaName) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(httpMethods) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param); - if (UNEXPECTED(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(viewName_param) == IS_STRING)) { - zephir_get_strval(&viewName, viewName_param); - } else { - ZEPHIR_INIT_VAR(&viewName); - } - if (!schemaName_param) { - ZEPHIR_INIT_VAR(&schemaName); - } else { - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &httpMethods); + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "via", NULL, 0, httpMethods); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, setHostname) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *hostname_param = NULL; + zval hostname; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&hostname); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(hostname) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &hostname_param); + if (UNEXPECTED(Z_TYPE_P(hostname_param) != IS_STRING && Z_TYPE_P(hostname_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'hostname' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(hostname_param) == IS_STRING)) { + zephir_get_strval(&hostname, hostname_param); } else { - ZEPHIR_INIT_VAR(&schemaName); - } + ZEPHIR_INIT_VAR(&hostname); } - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "viewexists", NULL, 0, &viewName, &schemaName); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchone", NULL, 0, &_2, &_3); - zephir_check_call_status(); - zephir_array_fetch_long(&_4, &_0, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/AbstractAdapter.zep", 1373); - RETURN_MM_BOOL(ZEPHIR_GT_LONG(&_4, 0)); + zephir_update_property_zval(this_ptr, ZEND_STRL("hostname"), &hostname); + RETURN_THIS(); } -zend_object *zephir_init_properties_Phalcon_Db_Adapter_AbstractAdapter(zend_class_entry *class_type) +static PHP_METHOD(Phalcon_Mvc_Router_Route, setName) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *name_param = NULL; + zval name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&name); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); + zephir_get_strval(&name, name_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("name"), &name); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Router_Route, via) +{ + zval *httpMethods, httpMethods_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&httpMethods_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(httpMethods) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &httpMethods); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("methods"), httpMethods); + RETURN_THISW(); +} + +zend_object *zephir_init_properties_Phalcon_Mvc_Router_Route(zend_class_entry *class_type) { zval _0, _2, _4, _1$$3, _3$$4, _5$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; @@ -58959,23 +63594,23 @@ zend_object *zephir_init_properties_Phalcon_Db_Adapter_AbstractAdapter(zend_clas { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("sqlVariables"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("paths"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("sqlVariables"), &_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("paths"), &_1$$3); } - zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("sqlBindTypes"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("methods"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_2) == IS_NULL) { ZEPHIR_INIT_VAR(&_3$$4); array_init(&_3$$4); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("sqlBindTypes"), &_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("methods"), &_3$$4); } - zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("descriptor"), PH_NOISY_CC | PH_READONLY); + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("converters"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_4) == IS_NULL) { ZEPHIR_INIT_VAR(&_5$$5); array_init(&_5$$5); - zephir_update_property_zval_ex(this_ptr, ZEND_STRL("descriptor"), &_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("converters"), &_5$$5); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -58992,80 +63627,29 @@ zend_object *zephir_init_properties_Phalcon_Db_Adapter_AbstractAdapter(zend_clas -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_AdapterInterface) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Router_RouteInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db\\Adapter, AdapterInterface, phalcon, db_adapter_adapterinterface, phalcon_db_adapter_adapterinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Router, RouteInterface, phalcon, mvc_router_routeinterface, phalcon_mvc_router_routeinterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, addColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, addIndex); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, addForeignKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, addPrimaryKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, affectedRows); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, begin); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, close); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, commit); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, connect); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, createSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, createTable); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, createView); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, delete); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, describeColumns); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, describeIndexes); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, describeReferences); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropForeignKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropIndex); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropPrimaryKey); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropTable); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, dropView); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, escapeIdentifier); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, escapeString); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, execute); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, fetchAll); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, fetchColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, fetchOne); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, forUpdate); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getColumnDefinition); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getColumnList); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getConnectionId); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getDescriptor); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getDialect); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getDialectType); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getDefaultIdValue); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getDefaultValue); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getInternalHandler); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getNestedTransactionSavepointName); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getRealSQLStatement); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getSQLStatement); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getSQLBindTypes); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getSQLVariables); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, getType); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, insert); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, insertAsDict); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, isNestedTransactionsWithSavepoints); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, isUnderTransaction); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, lastInsertId); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, limit); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, listTables); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, listViews); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, modifyColumn); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, query); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, releaseSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, rollback); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, rollbackSavepoint); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, sharedLock); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, setNestedTransactionsWithSavepoints); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, supportSequences); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, tableExists); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, tableOptions); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, update); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, updateAsDict); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, useExplicitIdValue); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, supportsDefaultValue); -ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, viewExists); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, compilePattern); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, convert); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getCompiledPattern); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHostname); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getHttpMethods); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPaths); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getPattern); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getReversedPaths); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, getRouteId); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHostname); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setHttpMethods); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, setName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reConfigure); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, reset); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Router_RouteInterface, via); @@ -59076,174 +63660,188 @@ ZEPHIR_DOC_METHOD(Phalcon_Db_Adapter_AdapterInterface, viewExists); -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_PdoFactory) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Behavior) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter, PdoFactory, phalcon, db_adapter_pdofactory, phalcon_factory_abstractfactory_ce, phalcon_db_adapter_pdofactory_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model, Behavior, phalcon, mvc_model_behavior, phalcon_mvc_model_behavior_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + zend_declare_property_null(phalcon_mvc_model_behavior_ce, SL("options"), ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_mvc_model_behavior_ce, 1, phalcon_mvc_model_behaviorinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, __construct) +static PHP_METHOD(Phalcon_Mvc_Model_Behavior, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *services_param = NULL; - zval services; + zval *options_param = NULL; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(services) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &services_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); + zephir_fetch_params(1, 0, 1, &options_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); + zephir_get_arrval(&options, options_param); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); - zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("options"), &options); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, load) +static PHP_METHOD(Phalcon_Mvc_Model_Behavior, getOptions) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *config = NULL, config_sub, name, options, _0, _1, _2, _3; + zval *eventName_param = NULL, options, eventOptions, _0; + zval eventName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config_sub); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&eventName); ZVAL_UNDEF(&options); + ZVAL_UNDEF(&eventOptions); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(config) + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(eventName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &config); - ZEPHIR_SEPARATE_PARAM(config); + zephir_fetch_params(1, 0, 1, &eventName_param); + if (!eventName_param) { + ZEPHIR_INIT_VAR(&eventName); + } else { + if (UNEXPECTED(Z_TYPE_P(eventName_param) != IS_STRING && Z_TYPE_P(eventName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'eventName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(eventName_param) == IS_STRING)) { + zephir_get_strval(&eventName, eventName_param); + } else { + ZEPHIR_INIT_VAR(&eventName); + } + } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfig", NULL, 0, config); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_0); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "adapter"); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfigelement", NULL, 0, config, &_1); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_0); - ZEPHIR_OBS_VAR(&name); - zephir_array_fetch_string(&name, config, SL("adapter"), PH_NOISY, "phalcon/Db/Adapter/PdoFactory.zep", 50); - zephir_array_unset_string(config, SL("adapter"), PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - object_init_ex(&_1, phalcon_support_helper_arr_get_ce); - if (zephir_has_constructor(&_1)) { - ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 0); - zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&options, &_0); + if (!ZEPHIR_IS_NULL(&eventName)) { + if (!(zephir_array_isset_fetch(&eventOptions, &options, &eventName, 1))) { + RETURN_MM_NULL(); + } + RETURN_CTOR(&eventOptions); } - - ZEPHIR_INIT_VAR(&_2); - array_init(&_2); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "options"); - ZEPHIR_CALL_METHOD(&options, &_1, "__invoke", NULL, 155, config, &_3, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CCTOR(&options); } -static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, newInstance) +static PHP_METHOD(Phalcon_Mvc_Model_Behavior, missingMethod) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options, _0; - zval *name_param = NULL, *options_param = NULL, definition; - zval name; + zval arguments; + zval method; + zval *model, model_sub, *method_param = NULL, *arguments_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&arguments); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(name) + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_STR(method) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(options) + Z_PARAM_ARRAY(arguments) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &options_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + zephir_fetch_params(1, 2, 1, &model, &method_param, &arguments_param); + zephir_get_strval(&method, method_param); + if (!arguments_param) { + ZEPHIR_INIT_VAR(&arguments); + array_init(&arguments); } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + zephir_get_arrval(&arguments, arguments_param); } - ZEPHIR_CALL_METHOD(&definition, this_ptr, "getservice", NULL, 0, &name); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 1, 0); - zephir_array_fast_append(&_0, &options); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_0); - zephir_check_call_status(); - RETURN_MM(); + RETURN_MM_NULL(); } -static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, getExceptionClass) +static PHP_METHOD(Phalcon_Mvc_Model_Behavior, mustTakeAction) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *eventName_param = NULL, _0; + zval eventName; zval *this_ptr = getThis(); + ZVAL_UNDEF(&eventName); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(eventName) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &eventName_param); + if (UNEXPECTED(Z_TYPE_P(eventName_param) != IS_STRING && Z_TYPE_P(eventName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'eventName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(eventName_param) == IS_STRING)) { + zephir_get_strval(&eventName, eventName_param); + } else { + ZEPHIR_INIT_VAR(&eventName); + } - RETURN_STRING("Phalcon\\Db\\Exception"); + zephir_read_property(&_0, this_ptr, ZEND_STRL("options"), PH_NOISY_CC | PH_READONLY); + RETURN_MM_BOOL(zephir_array_isset(&_0, &eventName)); } -static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, getServices) +static PHP_METHOD(Phalcon_Mvc_Model_Behavior, notify) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *type_param = NULL, *model, model_sub; + zval type; zval *this_ptr = getThis(); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&model_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(type) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &type_param, &model); + zephir_get_strval(&type, type_param); - zephir_create_array(return_value, 3, 0); - add_assoc_stringl_ex(return_value, SL("mysql"), SL("Phalcon\\Db\\Adapter\\Pdo\\Mysql")); - add_assoc_stringl_ex(return_value, SL("postgresql"), SL("Phalcon\\Db\\Adapter\\Pdo\\Postgresql")); - add_assoc_stringl_ex(return_value, SL("sqlite"), SL("Phalcon\\Db\\Adapter\\Pdo\\Sqlite")); - return; + + RETURN_MM_NULL(); } @@ -59256,8535 +63854,6623 @@ static PHP_METHOD(Phalcon_Db_Adapter_PdoFactory, getServices) -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo_AbstractPdo) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_BehaviorInterface) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter\\Pdo, AbstractPdo, phalcon, db_adapter_pdo_abstractpdo, phalcon_db_adapter_abstractadapter_ce, phalcon_db_adapter_pdo_abstractpdo_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model, BehaviorInterface, phalcon, mvc_model_behaviorinterface, phalcon_mvc_model_behaviorinterface_method_entry); - zend_declare_property_long(phalcon_db_adapter_pdo_abstractpdo_ce, SL("affectedRows"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_db_adapter_pdo_abstractpdo_ce, SL("pdo"), ZEND_ACC_PROTECTED); return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, __construct) -{ - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_0 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL; - zval descriptor; - zval *this_ptr = getThis(); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BehaviorInterface, missingMethod); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BehaviorInterface, notify); - ZVAL_UNDEF(&descriptor); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(descriptor) - ZEND_PARSE_PARAMETERS_END(); + + +#ifdef HAVE_CONFIG_H #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0, &descriptor); - zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_abstractpdo_ce, getThis(), "__construct", &_0, 0, &descriptor); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); -} -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, affectedRows) +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Binder) { - zval *this_ptr = getThis(); - + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model, Binder, phalcon, mvc_model_binder, phalcon_mvc_model_binder_method_entry, 0); + zend_declare_property_null(phalcon_mvc_model_binder_ce, SL("boundModels"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_binder_ce, SL("cache"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_binder_ce, SL("internalCache"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_binder_ce, SL("originalValues"), ZEND_ACC_PROTECTED); + phalcon_mvc_model_binder_ce->create_object = zephir_init_properties_Phalcon_Mvc_Model_Binder; - RETURN_MEMBER(getThis(), "affectedRows"); + zend_class_implements(phalcon_mvc_model_binder_ce, 1, phalcon_mvc_model_binderinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, begin) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, __construct) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *nesting_param = NULL, eventsManager, savepointName, _0, _3, _6, _7, _1$$3, _2$$4, _8$$6; - zend_bool nesting, _4, _5; + zval *cache = NULL, cache_sub, __$null; zval *this_ptr = getThis(); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_8$$6); + ZVAL_UNDEF(&cache_sub); + ZVAL_NULL(&__$null); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_BOOL(nesting) + Z_PARAM_OBJECT_OF_CLASS_OR_NULL(cache, phalcon_cache_adapter_adapterinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - if (!nesting_param) { - nesting = 1; - } else { - nesting = zephir_get_boolval(nesting_param); + zephir_fetch_params_without_memory_grow(0, 1, &cache); + if (!cache) { + cache = &cache_sub; + cache = &__$null; } - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("transactionLevel"))); - zephir_read_property(&_0, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_LONG_IDENTICAL(&_0, 1)) { - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_1$$3); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_2$$4); - ZVAL_STRING(&_2$$4, "db:beginTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_2$$4, this_ptr); - zephir_check_call_status(); - } - zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_1$$3, "begintransaction", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - zephir_read_property(&_3, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - _4 = ZEPHIR_IS_LONG_IDENTICAL(&_3, 0); - if (!(_4)) { - _4 = !nesting; - } - _5 = _4; - if (!(_5)) { - ZEPHIR_CALL_METHOD(&_6, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _5 = !zephir_is_true(&_6); - } - if (_5) { - RETURN_MM_BOOL(0); - } - zephir_read_property(&_7, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_7); - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_8$$6); - ZVAL_STRING(&_8$$6, "db:createSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_8$$6, this_ptr, &savepointName); - zephir_check_call_status(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "createsavepoint", NULL, 0, &savepointName); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("cache"), cache); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, commit) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, bindToHandler) { + zend_string *_6$$4; + zend_ulong _5$$4; + zend_bool _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *nesting_param = NULL, eventsManager, savepointName, _0, _1, _4, _7, _9, _2$$4, _3$$5, _8$$6, _10$$8; - zend_bool nesting, _5, _6; + zval cacheKey, methodName; + zval params; + zval *handler, handler_sub, *params_param = NULL, *cacheKey_param = NULL, *methodName_param = NULL, paramKey, className, boundModel, paramsCache, paramValue, _0, _2, *_3$$4, _4$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(¶mKey); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&boundModel); + ZVAL_UNDEF(¶msCache); + ZVAL_UNDEF(¶mValue); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&cacheKey); + ZVAL_UNDEF(&methodName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_OBJECT(handler) + Z_PARAM_ARRAY(params) + Z_PARAM_STR(cacheKey) Z_PARAM_OPTIONAL - Z_PARAM_BOOL(nesting) + Z_PARAM_STR_OR_NULL(methodName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - if (!nesting_param) { - nesting = 1; + zephir_fetch_params(1, 3, 1, &handler, ¶ms_param, &cacheKey_param, &methodName_param); + zephir_get_arrval(¶ms, params_param); + zephir_get_strval(&cacheKey, cacheKey_param); + if (!methodName_param) { + ZEPHIR_INIT_VAR(&methodName); } else { - nesting = zephir_get_boolval(nesting_param); + if (UNEXPECTED(Z_TYPE_P(methodName_param) != IS_STRING && Z_TYPE_P(methodName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'methodName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(methodName_param) == IS_STRING)) { + zephir_get_strval(&methodName, methodName_param); + } else { + ZEPHIR_INIT_VAR(&methodName); + } } - zephir_read_property(&_0, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_LONG_IDENTICAL(&_0, 0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "There is no active transaction", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 151); + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("originalValues"), &_0); + _1 = !((zephir_is_instance_of(handler, SL("Closure")))); + if (_1) { + _1 = ZEPHIR_IS_NULL(&methodName); + } + if (UNEXPECTED(_1)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "You must specify methodName for handler or pass Closure as handler", "phalcon/Mvc/Model/Binder.zep", 75); return; } - zephir_read_property(&_1, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_LONG_IDENTICAL(&_1, 1)) { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_2$$4); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$5); - ZVAL_STRING(&_3$$5, "db:commitTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$5, this_ptr); + ZEPHIR_INIT_VAR(&_2); + array_init(&_2); + zephir_update_property_zval(this_ptr, ZEND_STRL("boundModels"), &_2); + ZEPHIR_CALL_METHOD(¶msCache, this_ptr, "getparamsfromcache", NULL, 0, &cacheKey); + zephir_check_call_status(); + if (Z_TYPE_P(¶msCache) == IS_ARRAY) { + zephir_is_iterable(¶msCache, 0, "phalcon/Mvc/Model/Binder.zep", 90); + if (Z_TYPE_P(¶msCache) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶msCache), _5$$4, _6$$4, _3$$4) + { + ZEPHIR_INIT_NVAR(¶mKey); + if (_6$$4 != NULL) { + ZVAL_STR_COPY(¶mKey, _6$$4); + } else { + ZVAL_LONG(¶mKey, _5$$4); + } + ZEPHIR_INIT_NVAR(&className); + ZVAL_COPY(&className, _3$$4); + ZEPHIR_OBS_NVAR(¶mValue); + zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 83); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_7, 0, ¶mValue, &className); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("originalValues"), ¶mKey, ¶mValue); + zephir_array_update_zval(¶ms, ¶mKey, &boundModel, PH_COPY | PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("boundModels"), ¶mKey, &boundModel); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, ¶msCache, "rewind", NULL, 0); zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_4$$4, ¶msCache, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_4$$4)) { + break; + } + ZEPHIR_CALL_METHOD(¶mKey, ¶msCache, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&className, ¶msCache, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(¶mValue); + zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 83); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_7, 0, ¶mValue, &className); + zephir_check_call_status(); + zephir_update_property_array(this_ptr, SL("originalValues"), ¶mKey, ¶mValue); + zephir_array_update_zval(¶ms, ¶mKey, &boundModel, PH_COPY | PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("boundModels"), ¶mKey, &boundModel); + ZEPHIR_CALL_METHOD(NULL, ¶msCache, "next", NULL, 0); + zephir_check_call_status(); + } } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_2$$4, "commit", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - zephir_read_property(&_4, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - _5 = ZEPHIR_IS_LONG_IDENTICAL(&_4, 0); - if (!(_5)) { - _5 = !nesting; - } - _6 = _5; - if (!(_6)) { - ZEPHIR_CALL_METHOD(&_7, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _6 = !zephir_is_true(&_7); - } - if (_6) { - zephir_read_property(&_8$$6, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_GT_LONG(&_8$$6, 0)) { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - } - RETURN_MM_BOOL(0); - } - zephir_read_property(&_9, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_9); - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_10$$8); - ZVAL_STRING(&_10$$8, "db:releaseSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_10$$8, this_ptr, &savepointName); - zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&className); + ZEPHIR_INIT_NVAR(¶mKey); + RETURN_CTOR(¶ms); } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "releasesavepoint", NULL, 0, &savepointName); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getparamsfromreflection", NULL, 0, handler, ¶ms, &cacheKey, &methodName); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, close) -{ - zval __$null; - zval *this_ptr = getThis(); - - ZVAL_NULL(&__$null); - - - - zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &__$null); -} - -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, connect) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, findBoundModel) { - zend_string *_9; - zend_ulong _8; - zend_bool _1; + zend_class_entry *_0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL, username, password, dsnAttributes, dsnAttributesCustomRaw, dsnAttributesMap, key, options, persistent, value, _2, _4, _5, *_6, _7, _12, _13, _14, _0$$3, _3$$9, _10$$11, _11$$12; - zval descriptor, dsnParts; + zval className; + zval *paramValue, paramValue_sub, *className_param = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&dsnParts); - ZVAL_UNDEF(&username); - ZVAL_UNDEF(&password); - ZVAL_UNDEF(&dsnAttributes); - ZVAL_UNDEF(&dsnAttributesCustomRaw); - ZVAL_UNDEF(&dsnAttributesMap); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&persistent); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_13); - ZVAL_UNDEF(&_14); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_3$$9); - ZVAL_UNDEF(&_10$$11); - ZVAL_UNDEF(&_11$$12); + ZVAL_UNDEF(¶mValue_sub); + ZVAL_UNDEF(&className); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(descriptor) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(paramValue) + Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &descriptor_param); - if (!descriptor_param) { - ZEPHIR_INIT_VAR(&descriptor); - array_init(&descriptor); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); - } + zephir_fetch_params(1, 2, 0, ¶mValue, &className_param); + zephir_get_strval(&className, className_param); - ZEPHIR_INIT_VAR(&dsnParts); - array_init(&dsnParts); - if (ZEPHIR_IS_EMPTY(&descriptor)) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("descriptor"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&descriptor, &_0$$3); - } - ZEPHIR_OBS_VAR(&username); - if (zephir_array_isset_string_fetch(&username, &descriptor, SL("username"), 0)) { - zephir_array_unset_string(&descriptor, SL("username"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&password); - if (zephir_array_isset_string_fetch(&password, &descriptor, SL("password"), 0)) { - zephir_array_unset_string(&descriptor, SL("password"), PH_SEPARATE); - } - if (zephir_array_isset_string(&descriptor, SL("dialectClass"))) { - zephir_array_unset_string(&descriptor, SL("dialectClass"), PH_SEPARATE); - } - _1 = zephir_array_isset_string(&descriptor, SL("options")); - if (_1) { - zephir_array_fetch_string(&_2, &descriptor, SL("options"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 265); - _1 = Z_TYPE_P(&_2) == IS_ARRAY; - } - if (_1) { - ZEPHIR_OBS_VAR(&options); - zephir_array_fetch_string(&options, &descriptor, SL("options"), PH_NOISY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 266); - zephir_array_unset_string(&descriptor, SL("options"), PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&options); - array_init(&options); - } - ZEPHIR_OBS_VAR(&persistent); - if (zephir_array_isset_string_fetch(&persistent, &descriptor, SL("persistent"), 0)) { - ZEPHIR_INIT_VAR(&_3$$9); - ZVAL_BOOL(&_3$$9, zephir_get_boolval(&persistent)); - zephir_array_update_long(&options, 12, &_3$$9, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - } - ZEPHIR_INIT_VAR(&_4); - ZVAL_LONG(&_4, 2); - zephir_array_update_long(&options, 3, &_4, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - ZEPHIR_OBS_VAR(&dsnAttributesCustomRaw); - if (zephir_array_isset_string_fetch(&dsnAttributesCustomRaw, &descriptor, SL("dsn"), 0)) { - zephir_array_append(&dsnParts, &dsnAttributesCustomRaw, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 282); - zephir_array_unset_string(&descriptor, SL("dsn"), PH_SEPARATE); - } - ZEPHIR_CALL_METHOD(&_5, this_ptr, "getdsndefaults", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&dsnAttributesMap); - zephir_fast_array_merge(&dsnAttributesMap, &_5, &descriptor); - zephir_is_iterable(&dsnAttributesMap, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 302); - if (Z_TYPE_P(&dsnAttributesMap) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&dsnAttributesMap), _8, _9, _6) - { - ZEPHIR_INIT_NVAR(&key); - if (_9 != NULL) { - ZVAL_STR_COPY(&key, _9); - } else { - ZVAL_LONG(&key, _8); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _6); - ZEPHIR_INIT_NVAR(&_10$$11); - ZEPHIR_CONCAT_VSV(&_10$$11, &key, "=", &value); - zephir_array_append(&dsnParts, &_10$$11, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 298); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &dsnAttributesMap, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_7, &dsnAttributesMap, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_7)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &dsnAttributesMap, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &dsnAttributesMap, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_11$$12); - ZEPHIR_CONCAT_VSV(&_11$$12, &key, "=", &value); - zephir_array_append(&dsnParts, &_11$$12, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 298); - ZEPHIR_CALL_METHOD(NULL, &dsnAttributesMap, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_INIT_VAR(&dsnAttributes); - zephir_fast_join_str(&dsnAttributes, SL(";"), &dsnParts); - ZEPHIR_INIT_VAR(&_12); - object_init_ex(&_12, php_pdo_get_dbh_ce()); - zephir_read_property(&_13, this_ptr, ZEND_STRL("type"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_14); - ZEPHIR_CONCAT_VSV(&_14, &_13, ":", &dsnAttributes); - ZEPHIR_CALL_METHOD(NULL, &_12, "__construct", NULL, 0, &_14, &username, &password, &options); + _0 = zephir_fetch_class(&className); + ZEPHIR_RETURN_CALL_CE_STATIC(_0, "findfirst", NULL, 0, paramValue); zephir_check_call_status(); - zephir_update_property_zval(this_ptr, ZEND_STRL("pdo"), &_12); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, convertBoundParams) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, getBoundModels) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS, setOrder = 0; - zval params; - zval *sql_param = NULL, *params_param = NULL, boundSql, placeHolders, bindPattern, matches, placeMatch, value, _0, _1, _2, *_3$$3, _4$$3, _9$$3, _5$$4, _6$$5, _7$$8, _8$$9; - zval sql; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&boundSql); - ZVAL_UNDEF(&placeHolders); - ZVAL_UNDEF(&bindPattern); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&placeMatch); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$8); - ZVAL_UNDEF(&_8$$9); - ZVAL_UNDEF(¶ms); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(sql) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(params) - ZEND_PARSE_PARAMETERS_END(); -#endif - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &sql_param, ¶ms_param); - if (UNEXPECTED(Z_TYPE_P(sql_param) != IS_STRING && Z_TYPE_P(sql_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sql' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sql_param) == IS_STRING)) { - zephir_get_strval(&sql, sql_param); - } else { - ZEPHIR_INIT_VAR(&sql); - } - if (!params_param) { - ZEPHIR_INIT_VAR(¶ms); - array_init(¶ms); - } else { - zephir_get_arrval(¶ms, params_param); - } + RETURN_MEMBER(getThis(), "boundModels"); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Binder, getOriginalValues) +{ + zval *this_ptr = getThis(); - ZEPHIR_INIT_VAR(&placeHolders); - array_init(&placeHolders); - ZEPHIR_INIT_VAR(&bindPattern); - ZVAL_STRING(&bindPattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/"); - ZEPHIR_INIT_VAR(&matches); - ZVAL_NULL(&matches); - setOrder = 2; - ZVAL_LONG(&_0, setOrder); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_2, setOrder); - zephir_preg_match(&_1, &bindPattern, &sql, &matches, 1, zephir_get_intval(&_0) , 0 ); - if (zephir_is_true(&_1)) { - zephir_is_iterable(&matches, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 356); - if (Z_TYPE_P(&matches) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&matches), _3$$3) - { - ZEPHIR_INIT_NVAR(&placeMatch); - ZVAL_COPY(&placeMatch, _3$$3); - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_5$$4, &placeMatch, 1, PH_READONLY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 339); - if (!(zephir_array_isset_fetch(&value, ¶ms, &_5$$4, 0))) { - if (UNEXPECTED(!(zephir_array_isset_long(&placeMatch, 2)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter was not found in parameters list", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 343); - return; - } - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_6$$5, &placeMatch, 2, PH_READONLY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 346); - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, ¶ms, &_6$$5, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter was not found in parameters list", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 349); - return; - } - } - zephir_array_append(&placeHolders, &value, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 353); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &matches, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4$$3, &matches, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&placeMatch, &matches, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_7$$8, &placeMatch, 1, PH_READONLY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 339); - if (!(zephir_array_isset_fetch(&value, ¶ms, &_7$$8, 0))) { - if (UNEXPECTED(!(zephir_array_isset_long(&placeMatch, 2)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter was not found in parameters list", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 343); - return; - } - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_8$$9, &placeMatch, 2, PH_READONLY, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 346); - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, ¶ms, &_8$$9, 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter was not found in parameters list", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 349); - return; - } - } - zephir_array_append(&placeHolders, &value, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 353); - ZEPHIR_CALL_METHOD(NULL, &matches, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&placeMatch); - ZEPHIR_INIT_VAR(&_9$$3); - ZVAL_STRING(&_9$$3, "?"); - ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 37, &bindPattern, &_9$$3, &sql); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&boundSql, &sql); - } - zephir_create_array(return_value, 2, 0); - zephir_array_update_string(return_value, SL("sql"), &boundSql, PH_COPY | PH_SEPARATE); - zephir_array_update_string(return_value, SL("params"), &placeHolders, PH_COPY | PH_SEPARATE); - RETURN_MM(); + + RETURN_MEMBER(getThis(), "originalValues"); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, escapeString) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, getCache) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "cache"); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromCache) { + zend_bool _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *str_param = NULL, _0; - zval str; + zval *cacheKey_param = NULL, cache, internalParams, _0, _1, _3; + zval cacheKey; zval *this_ptr = getThis(); - ZVAL_UNDEF(&str); + ZVAL_UNDEF(&cacheKey); + ZVAL_UNDEF(&cache); + ZVAL_UNDEF(&internalParams); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(str) + Z_PARAM_STR(cacheKey) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &str_param); - zephir_get_strval(&str, str_param); + zephir_fetch_params(1, 1, 0, &cacheKey_param); + zephir_get_strval(&cacheKey, cacheKey_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "quote", NULL, 0, &str); + ZEPHIR_OBS_VAR(&internalParams); + zephir_read_property(&_0, this_ptr, ZEND_STRL("internalCache"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&internalParams, &_0, &cacheKey, 0)) { + RETURN_CCTOR(&internalParams); + } + zephir_read_property(&_1, this_ptr, ZEND_STRL("cache"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&cache, &_1); + _2 = Z_TYPE_P(&cache) == IS_NULL; + if (!(_2)) { + ZEPHIR_CALL_METHOD(&_3, &cache, "has", NULL, 0, &cacheKey); + zephir_check_call_status(); + _2 = !zephir_is_true(&_3); + } + if (_2) { + RETURN_MM_NULL(); + } + ZEPHIR_CALL_METHOD(&internalParams, &cache, "get", NULL, 0, &cacheKey); zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_array(this_ptr, SL("internalCache"), &cacheKey, &internalParams); + RETURN_CCTOR(&internalParams); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, execute) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) { + zend_class_entry *_9$$10, *_17$$24; + zend_string *_4; + zend_ulong _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_8 = NULL, *_12 = NULL, *_13 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindParams, bindTypes; - zval *sqlStatement_param = NULL, *bindParams_param = NULL, *bindTypes_param = NULL, eventsManager, affectedRows, newStatement, statement, _0, _1$$3, _2$$3, _3$$5, _4$$7, _5$$9; - zval sqlStatement; + zval cacheKey, methodName; + zval params, paramsCache; + zval *handler, handler_sub, *params_param = NULL, *cacheKey_param = NULL, *methodName_param = NULL, methodParams, reflection, paramKey, methodParam, className, realClasses, boundModel, cache, handlerClass, reflectionClass, paramsKeys, paramValue, _0, *_1, _2, _5$$7, _6$$5, _7$$5, _10$$14, _11$$14, _14$$21, _15$$19, _16$$19, _18$$28, _19$$28; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&affectedRows); - ZVAL_UNDEF(&newStatement); - ZVAL_UNDEF(&statement); + ZVAL_UNDEF(&handler_sub); + ZVAL_UNDEF(&methodParams); + ZVAL_UNDEF(&reflection); + ZVAL_UNDEF(¶mKey); + ZVAL_UNDEF(&methodParam); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&realClasses); + ZVAL_UNDEF(&boundModel); + ZVAL_UNDEF(&cache); + ZVAL_UNDEF(&handlerClass); + ZVAL_UNDEF(&reflectionClass); + ZVAL_UNDEF(¶msKeys); + ZVAL_UNDEF(¶mValue); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_5$$9); - ZVAL_UNDEF(&bindParams); - ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_10$$14); + ZVAL_UNDEF(&_11$$14); + ZVAL_UNDEF(&_14$$21); + ZVAL_UNDEF(&_15$$19); + ZVAL_UNDEF(&_16$$19); + ZVAL_UNDEF(&_18$$28); + ZVAL_UNDEF(&_19$$28); + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(¶msCache); + ZVAL_UNDEF(&cacheKey); + ZVAL_UNDEF(&methodName); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(sqlStatement) - Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(bindParams) - Z_PARAM_ARRAY(bindTypes) + ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_OBJECT(handler) + Z_PARAM_ARRAY(params) + Z_PARAM_STR(cacheKey) + Z_PARAM_STR(methodName) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams_param, &bindTypes_param); - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string")); + zephir_fetch_params(1, 4, 0, &handler, ¶ms_param, &cacheKey_param, &methodName_param); + zephir_get_arrval(¶ms, params_param); + zephir_get_strval(&cacheKey, cacheKey_param); + if (UNEXPECTED(Z_TYPE_P(methodName_param) != IS_STRING && Z_TYPE_P(methodName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'methodName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); - } else { - ZEPHIR_INIT_VAR(&sqlStatement); - } - if (!bindParams_param) { - ZEPHIR_INIT_VAR(&bindParams); - array_init(&bindParams); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindParams, bindParams_param); - } - if (!bindTypes_param) { - ZEPHIR_INIT_VAR(&bindTypes); - array_init(&bindTypes); + if (EXPECTED(Z_TYPE_P(methodName_param) == IS_STRING)) { + zephir_get_strval(&methodName, methodName_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindTypes, bindTypes_param); + ZEPHIR_INIT_VAR(&methodName); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlStatement"), &sqlStatement); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlVariables"), &bindParams); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlBindTypes"), &bindTypes); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "db:beforeQuery"); - ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { - RETURN_MM_BOOL(0); - } - } - ZEPHIR_INIT_VAR(&affectedRows); - ZVAL_LONG(&affectedRows, 0); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "preparerealsql", NULL, 0, &sqlStatement, &bindParams); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&bindParams))) { - zephir_read_property(&_3$$5, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&statement, &_3$$5, "prepare", NULL, 0, &sqlStatement); + ZEPHIR_INIT_VAR(&realClasses); + ZVAL_NULL(&realClasses); + ZEPHIR_INIT_VAR(¶msCache); + array_init(¶msCache); + ZEPHIR_INIT_VAR(&reflection); + if (!ZEPHIR_IS_NULL(&methodName)) { + object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionmethod"))); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 438, handler, &methodName); zephir_check_call_status(); - if (Z_TYPE_P(&statement) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&newStatement, this_ptr, "executeprepared", NULL, 0, &statement, &bindParams, &bindTypes); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&affectedRows, &newStatement, "rowcount", NULL, 0); - zephir_check_call_status(); - } } else { - zephir_read_property(&_4$$7, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&affectedRows, &_4$$7, "exec", NULL, 0, &sqlStatement); + object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionfunction"))); + ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 150, handler); zephir_check_call_status(); } - if (Z_TYPE_P(&affectedRows) == IS_LONG) { - zephir_update_property_zval(this_ptr, ZEND_STRL("affectedRows"), &affectedRows); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_5$$9); - ZVAL_STRING(&_5$$9, "db:afterQuery"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_5$$9, this_ptr); - zephir_check_call_status(); - } - } - RETURN_MM_BOOL(1); -} - -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, executePrepared) -{ - zval _5$$8, _8$$13, _25$$39, _27$$44; - zend_bool _4$$3, _24$$34; - zend_string *_3, *_13$$22, *_21$$31, *_31$$53, *_39$$62; - zend_ulong _2, _12$$22, _20$$31, _30$$53, _38$$62; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval placeholders; - zval *statement, statement_sub, *placeholders_param = NULL, *dataTypes, dataTypes_sub, wildcard, value, type, castValue, parameter, position, itemValue, *_0, _1, _6$$12, *_10$$22, _11$$22, _14$$24, _15$$25, _16$$27, _17$$28, *_18$$31, _19$$31, _22$$32, _23$$33, _26$$43, *_28$$53, _29$$53, _32$$55, _33$$56, _34$$58, _35$$59, *_36$$62, _37$$62, _40$$63, _41$$64; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement_sub); - ZVAL_UNDEF(&dataTypes_sub); - ZVAL_UNDEF(&wildcard); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&castValue); - ZVAL_UNDEF(¶meter); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&itemValue); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6$$12); - ZVAL_UNDEF(&_11$$22); - ZVAL_UNDEF(&_14$$24); - ZVAL_UNDEF(&_15$$25); - ZVAL_UNDEF(&_16$$27); - ZVAL_UNDEF(&_17$$28); - ZVAL_UNDEF(&_19$$31); - ZVAL_UNDEF(&_22$$32); - ZVAL_UNDEF(&_23$$33); - ZVAL_UNDEF(&_26$$43); - ZVAL_UNDEF(&_29$$53); - ZVAL_UNDEF(&_32$$55); - ZVAL_UNDEF(&_33$$56); - ZVAL_UNDEF(&_34$$58); - ZVAL_UNDEF(&_35$$59); - ZVAL_UNDEF(&_37$$62); - ZVAL_UNDEF(&_40$$63); - ZVAL_UNDEF(&_41$$64); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&_5$$8); - ZVAL_UNDEF(&_8$$13); - ZVAL_UNDEF(&_25$$39); - ZVAL_UNDEF(&_27$$44); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_OBJECT_OF_CLASS(statement, zephir_get_internal_ce(SL("pdostatement"))) - Z_PARAM_ARRAY(placeholders) - Z_PARAM_ZVAL(dataTypes) - ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &statement, &placeholders_param, &dataTypes); - ZEPHIR_OBS_COPY_OR_DUP(&placeholders, placeholders_param); - - - zephir_is_iterable(&placeholders, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 567); - if (Z_TYPE_P(&placeholders) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&placeholders), _2, _3, _0) + zephir_read_property(&_0, this_ptr, ZEND_STRL("cache"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&cache, &_0); + ZEPHIR_CALL_METHOD(&methodParams, &reflection, "getparameters", NULL, 151); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(¶msKeys); + zephir_array_keys(¶msKeys, ¶ms); + zephir_is_iterable(&methodParams, 0, "phalcon/Mvc/Model/Binder.zep", 243); + if (Z_TYPE_P(&methodParams) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methodParams), _3, _4, _1) { - ZEPHIR_INIT_NVAR(&wildcard); - if (_3 != NULL) { - ZVAL_STR_COPY(&wildcard, _3); + ZEPHIR_INIT_NVAR(¶mKey); + if (_4 != NULL) { + ZVAL_STR_COPY(¶mKey, _4); } else { - ZVAL_LONG(&wildcard, _2); + ZVAL_LONG(¶mKey, _3); } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - if (Z_TYPE_P(&wildcard) == IS_LONG) { - ZEPHIR_INIT_NVAR(¶meter); - ZVAL_LONG(¶meter, (zephir_get_numberval(&wildcard) + 1)); - } else if (Z_TYPE_P(&wildcard) == IS_STRING) { - ZEPHIR_CPY_WRT(¶meter, &wildcard); - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind parameter (1)", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 487); - return; + ZEPHIR_INIT_NVAR(&methodParam); + ZVAL_COPY(&methodParam, _1); + ZEPHIR_CALL_METHOD(&reflectionClass, &methodParam, "getclass", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&reflectionClass))) { + continue; } - _4$$3 = Z_TYPE_P(dataTypes) == IS_ARRAY; - if (_4$$3) { - ZEPHIR_OBS_NVAR(&type); - _4$$3 = zephir_array_isset_fetch(&type, dataTypes, &wildcard, 0); + ZEPHIR_CALL_METHOD(&className, &reflectionClass, "getname", NULL, 0); + zephir_check_call_status(); + if (!(zephir_array_isset(¶ms, ¶mKey))) { + zephir_array_fetch(&_5$$7, ¶msKeys, ¶mKey, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Binder.zep", 195); + ZEPHIR_CPY_WRT(¶mKey, &_5$$7); } - if (_4$$3) { - if (ZEPHIR_IS_LONG(&type, 32)) { - zephir_cast_to_string(&_5$$8, &value); - ZEPHIR_CPY_WRT(&castValue, &_5$$8); - ZEPHIR_INIT_NVAR(&type); - ZVAL_LONG(&type, 1024); - } else { - if (ZEPHIR_GLOBAL(db).force_casting) { - if (Z_TYPE_P(&value) != IS_ARRAY) { - do { - if (ZEPHIR_IS_LONG(&type, 1)) { - ZVAL_LONG(&_6$$12, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 38, &value, &_6$$12); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(&type, 2)) { - zephir_cast_to_string(&_8$$13, &value); - ZEPHIR_CPY_WRT(&castValue, &_8$$13); - break; - } - if (ZEPHIR_IS_LONG(&type, 0)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_NULL(&castValue); - break; - } - if (ZEPHIR_IS_LONG(&type, 5)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); - break; - } - ZEPHIR_CPY_WRT(&castValue, &value); - break; - } while(0); - - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } - if (Z_TYPE_P(&castValue) != IS_ARRAY) { - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue); + ZEPHIR_INIT_NVAR(&boundModel); + ZVAL_NULL(&boundModel); + ZEPHIR_OBS_NVAR(¶mValue); + zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 199); + ZEPHIR_INIT_NVAR(&_6$$5); + ZVAL_STRING(&_6$$5, "Phalcon\\Mvc\\Model"); + ZEPHIR_CALL_FUNCTION(&_7$$5, "is_subclass_of", &_8, 439, &className, &_6$$5); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(&className, "Phalcon\\Mvc\\Model")) { + if (Z_TYPE_P(&realClasses) == IS_NULL) { + if (zephir_instance_of_ev(handler, phalcon_mvc_controller_bindmodelinterface_ce)) { + ZEPHIR_INIT_NVAR(&handlerClass); + zephir_get_class(&handlerClass, handler, 0); + _9$$10 = zephir_fetch_class(&handlerClass); + ZEPHIR_CALL_CE_STATIC(&realClasses, _9$$10, "getmodelname", NULL, 0); zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue, &type); + } else if (zephir_instance_of_ev(handler, phalcon_mvc_model_binder_bindableinterface_ce)) { + ZEPHIR_CALL_METHOD(&realClasses, handler, "getmodelname", NULL, 0); zephir_check_call_status(); - } - } else { - zephir_is_iterable(&castValue, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 555); - if (Z_TYPE_P(&castValue) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&castValue), _12$$22, _13$$22, _10$$22) - { - ZEPHIR_INIT_NVAR(&position); - if (_13$$22 != NULL) { - ZVAL_STR_COPY(&position, _13$$22); - } else { - ZVAL_LONG(&position, _12$$22); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _10$$22); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_NVAR(&_14$$24); - ZEPHIR_CONCAT_VV(&_14$$24, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_14$$24, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_15$$25); - ZEPHIR_CONCAT_VV(&_15$$25, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_15$$25, &itemValue, &type); - zephir_check_call_status(); - } - } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &castValue, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_11$$22, &castValue, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_11$$22)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &castValue, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &castValue, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_NVAR(&_16$$27); - ZEPHIR_CONCAT_VV(&_16$$27, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_16$$27, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_17$$28); - ZEPHIR_CONCAT_VV(&_17$$28, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_17$$28, &itemValue, &type); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &castValue, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Handler must implement Phalcon\\Mvc\\Model\\Binder\\BindableInterface in order to use Phalcon\\Mvc\\Model as parameter", "phalcon/Mvc/Model/Binder.zep", 211); + return; } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); } - } else { - if (Z_TYPE_P(&value) != IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &value); - zephir_check_call_status(); - } else { - zephir_is_iterable(&value, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 563); - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&value), _20$$31, _21$$31, _18$$31) - { - ZEPHIR_INIT_NVAR(&position); - if (_21$$31 != NULL) { - ZVAL_STR_COPY(&position, _21$$31); - } else { - ZVAL_LONG(&position, _20$$31); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _18$$31); - ZEPHIR_INIT_NVAR(&_22$$32); - ZEPHIR_CONCAT_VV(&_22$$32, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_22$$32, &itemValue); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + if (Z_TYPE_P(&realClasses) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&className); + if (UNEXPECTED(!(zephir_array_isset_fetch(&className, &realClasses, ¶mKey, 0)))) { + ZEPHIR_INIT_NVAR(&_10$$14); + object_init_ex(&_10$$14, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$14); + ZEPHIR_CONCAT_SVS(&_11$$14, "You should provide model class name for ", ¶mKey, " parameter"); + ZEPHIR_CALL_METHOD(NULL, &_10$$14, "__construct", &_12, 32, &_11$$14); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_19$$31, &value, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_19$$31)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &value, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &value, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_23$$33); - ZEPHIR_CONCAT_VV(&_23$$33, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_23$$33, &itemValue); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); - zephir_check_call_status(); - } + zephir_throw_exception_debug(&_10$$14, "phalcon/Mvc/Model/Binder.zep", 219); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); + } else if (Z_TYPE_P(&realClasses) == IS_STRING) { + ZEPHIR_CPY_WRT(&className, &realClasses); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); + } else { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "getModelName should return array or string", "phalcon/Mvc/Model/Binder.zep", 229); + return; } + } else if (zephir_is_true(&_7$$5)) { + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); + } + if (Z_TYPE_P(&boundModel) != IS_NULL) { + zephir_update_property_array(this_ptr, SL("originalValues"), ¶mKey, ¶mValue); + zephir_array_update_zval(¶ms, ¶mKey, &boundModel, PH_COPY | PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("boundModels"), ¶mKey, &boundModel); + zephir_array_update_zval(¶msCache, ¶mKey, &className, PH_COPY | PH_SEPARATE); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &placeholders, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &methodParams, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &placeholders, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &methodParams, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&wildcard, &placeholders, "key", NULL, 0); + ZEPHIR_CALL_METHOD(¶mKey, &methodParams, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &placeholders, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&methodParam, &methodParams, "current", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&wildcard) == IS_LONG) { - ZEPHIR_INIT_NVAR(¶meter); - ZVAL_LONG(¶meter, (zephir_get_numberval(&wildcard) + 1)); - } else if (Z_TYPE_P(&wildcard) == IS_STRING) { - ZEPHIR_CPY_WRT(¶meter, &wildcard); - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind parameter (1)", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 487); - return; + ZEPHIR_CALL_METHOD(&reflectionClass, &methodParam, "getclass", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&reflectionClass))) { + continue; } - _24$$34 = Z_TYPE_P(dataTypes) == IS_ARRAY; - if (_24$$34) { - ZEPHIR_OBS_NVAR(&type); - _24$$34 = zephir_array_isset_fetch(&type, dataTypes, &wildcard, 0); + ZEPHIR_CALL_METHOD(&className, &reflectionClass, "getname", NULL, 0); + zephir_check_call_status(); + if (!(zephir_array_isset(¶ms, ¶mKey))) { + zephir_array_fetch(&_14$$21, ¶msKeys, ¶mKey, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Binder.zep", 195); + ZEPHIR_CPY_WRT(¶mKey, &_14$$21); } - if (_24$$34) { - if (ZEPHIR_IS_LONG(&type, 32)) { - zephir_cast_to_string(&_25$$39, &value); - ZEPHIR_CPY_WRT(&castValue, &_25$$39); - ZEPHIR_INIT_NVAR(&type); - ZVAL_LONG(&type, 1024); - } else { - if (ZEPHIR_GLOBAL(db).force_casting) { - if (Z_TYPE_P(&value) != IS_ARRAY) { - do { - if (ZEPHIR_IS_LONG(&type, 1)) { - ZVAL_LONG(&_26$$43, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 38, &value, &_26$$43); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(&type, 2)) { - zephir_cast_to_string(&_27$$44, &value); - ZEPHIR_CPY_WRT(&castValue, &_27$$44); - break; - } - if (ZEPHIR_IS_LONG(&type, 0)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_NULL(&castValue); - break; - } - if (ZEPHIR_IS_LONG(&type, 5)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); - break; - } - ZEPHIR_CPY_WRT(&castValue, &value); - break; - } while(0); - - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } - if (Z_TYPE_P(&castValue) != IS_ARRAY) { - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue); + ZEPHIR_INIT_NVAR(&boundModel); + ZVAL_NULL(&boundModel); + ZEPHIR_OBS_NVAR(¶mValue); + zephir_array_fetch(¶mValue, ¶ms, ¶mKey, PH_NOISY, "phalcon/Mvc/Model/Binder.zep", 199); + ZEPHIR_INIT_NVAR(&_15$$19); + ZVAL_STRING(&_15$$19, "Phalcon\\Mvc\\Model"); + ZEPHIR_CALL_FUNCTION(&_16$$19, "is_subclass_of", &_8, 439, &className, &_15$$19); + zephir_check_call_status(); + if (ZEPHIR_IS_STRING(&className, "Phalcon\\Mvc\\Model")) { + if (Z_TYPE_P(&realClasses) == IS_NULL) { + if (zephir_instance_of_ev(handler, phalcon_mvc_controller_bindmodelinterface_ce)) { + ZEPHIR_INIT_NVAR(&handlerClass); + zephir_get_class(&handlerClass, handler, 0); + _17$$24 = zephir_fetch_class(&handlerClass); + ZEPHIR_CALL_CE_STATIC(&realClasses, _17$$24, "getmodelname", NULL, 0); zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue, &type); + } else if (zephir_instance_of_ev(handler, phalcon_mvc_model_binder_bindableinterface_ce)) { + ZEPHIR_CALL_METHOD(&realClasses, handler, "getmodelname", NULL, 0); zephir_check_call_status(); - } - } else { - zephir_is_iterable(&castValue, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 555); - if (Z_TYPE_P(&castValue) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&castValue), _30$$53, _31$$53, _28$$53) - { - ZEPHIR_INIT_NVAR(&position); - if (_31$$53 != NULL) { - ZVAL_STR_COPY(&position, _31$$53); - } else { - ZVAL_LONG(&position, _30$$53); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _28$$53); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_NVAR(&_32$$55); - ZEPHIR_CONCAT_VV(&_32$$55, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_32$$55, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_33$$56); - ZEPHIR_CONCAT_VV(&_33$$56, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_33$$56, &itemValue, &type); - zephir_check_call_status(); - } - } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &castValue, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_29$$53, &castValue, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_29$$53)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &castValue, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &castValue, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_NVAR(&_34$$58); - ZEPHIR_CONCAT_VV(&_34$$58, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_34$$58, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&_35$$59); - ZEPHIR_CONCAT_VV(&_35$$59, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_35$$59, &itemValue, &type); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &castValue, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Handler must implement Phalcon\\Mvc\\Model\\Binder\\BindableInterface in order to use Phalcon\\Mvc\\Model as parameter", "phalcon/Mvc/Model/Binder.zep", 211); + return; } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); } - } else { - if (Z_TYPE_P(&value) != IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &value); - zephir_check_call_status(); - } else { - zephir_is_iterable(&value, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 563); - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&value), _38$$62, _39$$62, _36$$62) - { - ZEPHIR_INIT_NVAR(&position); - if (_39$$62 != NULL) { - ZVAL_STR_COPY(&position, _39$$62); - } else { - ZVAL_LONG(&position, _38$$62); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _36$$62); - ZEPHIR_INIT_NVAR(&_40$$63); - ZEPHIR_CONCAT_VV(&_40$$63, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_40$$63, &itemValue); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); + if (Z_TYPE_P(&realClasses) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&className); + if (UNEXPECTED(!(zephir_array_isset_fetch(&className, &realClasses, ¶mKey, 0)))) { + ZEPHIR_INIT_NVAR(&_18$$28); + object_init_ex(&_18$$28, phalcon_mvc_model_exception_ce); + ZEPHIR_INIT_NVAR(&_19$$28); + ZEPHIR_CONCAT_SVS(&_19$$28, "You should provide model class name for ", ¶mKey, " parameter"); + ZEPHIR_CALL_METHOD(NULL, &_18$$28, "__construct", &_12, 32, &_19$$28); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_37$$62, &value, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_37$$62)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &value, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &value, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_41$$64); - ZEPHIR_CONCAT_VV(&_41$$64, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_41$$64, &itemValue); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); - zephir_check_call_status(); - } + zephir_throw_exception_debug(&_18$$28, "phalcon/Mvc/Model/Binder.zep", 219); + ZEPHIR_MM_RESTORE(); + return; } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); + } else if (Z_TYPE_P(&realClasses) == IS_STRING) { + ZEPHIR_CPY_WRT(&className, &realClasses); + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); + } else { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "getModelName should return array or string", "phalcon/Mvc/Model/Binder.zep", 229); + return; } + } else if (zephir_is_true(&_16$$19)) { + ZEPHIR_CALL_METHOD(&boundModel, this_ptr, "findboundmodel", &_13, 0, ¶mValue, &className); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &placeholders, "next", NULL, 0); + if (Z_TYPE_P(&boundModel) != IS_NULL) { + zephir_update_property_array(this_ptr, SL("originalValues"), ¶mKey, ¶mValue); + zephir_array_update_zval(¶ms, ¶mKey, &boundModel, PH_COPY | PH_SEPARATE); + zephir_update_property_array(this_ptr, SL("boundModels"), ¶mKey, &boundModel); + zephir_array_update_zval(¶msCache, ¶mKey, &className, PH_COPY | PH_SEPARATE); + } + ZEPHIR_CALL_METHOD(NULL, &methodParams, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&wildcard); - ZEPHIR_CALL_METHOD(NULL, statement, "execute", NULL, 0); - zephir_check_call_status(); - RETVAL_ZVAL(statement, 1, 0); - RETURN_MM(); + ZEPHIR_INIT_NVAR(&methodParam); + ZEPHIR_INIT_NVAR(¶mKey); + if (Z_TYPE_P(&cache) != IS_NULL) { + ZEPHIR_CALL_METHOD(NULL, &cache, "set", NULL, 0, &cacheKey, ¶msCache); + zephir_check_call_status(); + } + zephir_update_property_array(this_ptr, SL("internalCache"), &cacheKey, ¶msCache); + RETURN_CTOR(¶ms); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, getErrorInfo) +static PHP_METHOD(Phalcon_Mvc_Model_Binder, setCache) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *cache, cache_sub; zval *this_ptr = getThis(); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&cache_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(cache, phalcon_cache_adapter_adapterinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif - ZEPHIR_MM_GROW(); + zephir_fetch_params_without_memory_grow(1, 0, &cache); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "errorinfo", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + + zephir_update_property_zval(this_ptr, ZEND_STRL("cache"), cache); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, getInternalHandler) +zend_object *zephir_init_properties_Phalcon_Mvc_Model_Binder(zend_class_entry *class_type) { - zval *this_ptr = getThis(); + zval _0, _2, _4, _1$$3, _3$$4, _5$$5; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$5); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("originalValues"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("originalValues"), &_1$$3); + } + zephir_read_property_ex(&_2, this_ptr, ZEND_STRL("internalCache"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_2) == IS_NULL) { + ZEPHIR_INIT_VAR(&_3$$4); + array_init(&_3$$4); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("internalCache"), &_3$$4); + } + zephir_read_property_ex(&_4, this_ptr, ZEND_STRL("boundModels"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_4) == IS_NULL) { + ZEPHIR_INIT_VAR(&_5$$5); + array_init(&_5$$5); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("boundModels"), &_5$$5); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} - RETURN_MEMBER(getThis(), "pdo"); -} -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, getTransactionLevel) -{ - zval *this_ptr = getThis(); +#ifdef HAVE_CONFIG_H +#endif - RETURN_MEMBER(getThis(), "transactionLevel"); -} -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, isUnderTransaction) + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_BinderInterface) { - zval _0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model, BinderInterface, phalcon, mvc_model_binderinterface, phalcon_mvc_model_binderinterface_method_entry); - ZVAL_UNDEF(&_0); + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BinderInterface, bindToHandler); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BinderInterface, getBoundModels); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BinderInterface, getCache); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_BinderInterface, setCache); - ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "intransaction", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Criteria) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model, Criteria, phalcon, mvc_model_criteria, phalcon_mvc_model_criteria_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_criteria_ce, SL("bindParams"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_criteria_ce, SL("bindTypes"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_mvc_model_criteria_ce, SL("hiddenParamNumber"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_criteria_ce, SL("model"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_criteria_ce, SL("params"), ZEND_ACC_PROTECTED); + phalcon_mvc_model_criteria_ce->create_object = zephir_init_properties_Phalcon_Mvc_Model_Criteria; + + zend_class_implements(phalcon_mvc_model_criteria_ce, 1, phalcon_mvc_model_criteriainterface_ce); + zend_class_implements(phalcon_mvc_model_criteria_ce, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, lastInsertId) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, andWhere) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, _0; - zval name; + zval *conditions_param = NULL, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null, currentConditions, _0, _1$$3; + zval conditions; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&bindParams_sub); + ZVAL_UNDEF(&bindTypes_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¤tConditions); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(conditions) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(name) + Z_PARAM_ZVAL_OR_NULL(bindParams) + Z_PARAM_ZVAL_OR_NULL(bindTypes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &name_param); - if (!name_param) { - ZEPHIR_INIT_VAR(&name); - } else { - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + zephir_fetch_params(1, 1, 2, &conditions_param, &bindParams, &bindTypes); + if (UNEXPECTED(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(conditions_param) == IS_STRING)) { + zephir_get_strval(&conditions, conditions_param); } else { - ZEPHIR_INIT_VAR(&name); + ZEPHIR_INIT_VAR(&conditions); } + if (!bindParams) { + bindParams = &bindParams_sub; + bindParams = &__$null; + } + if (!bindTypes) { + bindTypes = &bindTypes_sub; + bindTypes = &__$null; } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "lastinsertid", NULL, 0, &name); + ZEPHIR_OBS_VAR(¤tConditions); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(¤tConditions, &_0, SL("conditions"), 0)) { + ZEPHIR_INIT_VAR(&_1$$3); + ZEPHIR_CONCAT_SVSVS(&_1$$3, "(", ¤tConditions, ") AND (", &conditions, ")"); + zephir_get_strval(&conditions, &_1$$3); + } + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "where", NULL, 0, &conditions, bindParams, bindTypes); zephir_check_call_status(); RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, prepare) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, betweenWhere) { + zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlStatement_param = NULL, _0; - zval sqlStatement; + zval *expr_param = NULL, *minimum, minimum_sub, *maximum, maximum_sub, hiddenParam, minimumKey, nextHiddenParam, maximumKey, _0; + zval expr; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); + ZVAL_UNDEF(&expr); + ZVAL_UNDEF(&minimum_sub); + ZVAL_UNDEF(&maximum_sub); + ZVAL_UNDEF(&hiddenParam); + ZVAL_UNDEF(&minimumKey); + ZVAL_UNDEF(&nextHiddenParam); + ZVAL_UNDEF(&maximumKey); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(sqlStatement) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_STR(expr) + Z_PARAM_ZVAL(minimum) + Z_PARAM_ZVAL(maximum) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlStatement_param); - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string")); + zephir_fetch_params(1, 3, 0, &expr_param, &minimum, &maximum); + if (UNEXPECTED(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); + if (EXPECTED(Z_TYPE_P(expr_param) == IS_STRING)) { + zephir_get_strval(&expr, expr_param); } else { - ZEPHIR_INIT_VAR(&sqlStatement); + ZEPHIR_INIT_VAR(&expr); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "prepare", NULL, 0, &sqlStatement); + ZEPHIR_OBS_VAR(&hiddenParam); + zephir_read_property(&hiddenParam, this_ptr, ZEND_STRL("hiddenParamNumber"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(&nextHiddenParam); + ZVAL_LONG(&nextHiddenParam, (zephir_get_numberval(&hiddenParam) + 1)); + ZEPHIR_INIT_VAR(&minimumKey); + ZEPHIR_CONCAT_SV(&minimumKey, "ACP", &hiddenParam); + ZEPHIR_INIT_VAR(&maximumKey); + ZEPHIR_CONCAT_SV(&maximumKey, "ACP", &nextHiddenParam); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSVSVS(&_0, &expr, " BETWEEN :", &minimumKey, ": AND :", &maximumKey, ":"); + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 2, 0); + zephir_array_update_zval(&_1, &minimumKey, minimum, PH_COPY); + zephir_array_update_zval(&_1, &maximumKey, maximum, PH_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, &_0, &_1); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_SEPARATE(&nextHiddenParam); + zephir_increment(&nextHiddenParam); + zephir_update_property_zval(this_ptr, ZEND_STRL("hiddenParamNumber"), &nextHiddenParam); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, query) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, bind) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval bindParams, bindTypes; - zval *sqlStatement_param = NULL, *bindParams_param = NULL, *bindTypes_param = NULL, eventsManager, statement, params, types, _0, _3, _1$$3, _2$$3, _4$$9; - zval sqlStatement; + zend_bool merge, _5; + zval *bindParams_param = NULL, *merge_param = NULL, _0, _3, _4, _1$$3, _2$$3, _6$$4, _7$$4, _8$$4, _9$$4, _10$$5; + zval bindParams; zval *this_ptr = getThis(); - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&types); + ZVAL_UNDEF(&bindParams); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$9); - ZVAL_UNDEF(&bindParams); - ZVAL_UNDEF(&bindTypes); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STR(sqlStatement) - Z_PARAM_OPTIONAL + ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ARRAY(bindParams) - Z_PARAM_ARRAY(bindTypes) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(merge) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams_param, &bindTypes_param); - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); - } else { - ZEPHIR_INIT_VAR(&sqlStatement); - } - if (!bindParams_param) { - ZEPHIR_INIT_VAR(&bindParams); - array_init(&bindParams); - } else { + zephir_fetch_params(1, 1, 1, &bindParams_param, &merge_param); ZEPHIR_OBS_COPY_OR_DUP(&bindParams, bindParams_param); - } - if (!bindTypes_param) { - ZEPHIR_INIT_VAR(&bindTypes); - array_init(&bindTypes); + if (!merge_param) { + merge = 0; } else { - ZEPHIR_OBS_COPY_OR_DUP(&bindTypes, bindTypes_param); + merge = zephir_get_boolval(merge_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlStatement"), &sqlStatement); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlVariables"), &bindParams); - zephir_update_property_zval(this_ptr, ZEND_STRL("sqlBindTypes"), &bindTypes); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string(&_0, SL("bind")))) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "db:beforeQuery"); - ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { - RETURN_MM_BOOL(0); - } - } - if (!(ZEPHIR_IS_EMPTY(&bindParams))) { - ZEPHIR_CPY_WRT(¶ms, &bindParams); - ZEPHIR_CPY_WRT(&types, &bindTypes); - } else { - ZEPHIR_INIT_NVAR(¶ms); - array_init(¶ms); - ZEPHIR_INIT_NVAR(&types); - array_init(&types); + ZVAL_STRING(&_2$$3, "bind"); + zephir_update_property_array(this_ptr, SL("params"), &_2$$3, &_1$$3); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&statement, &_0, "prepare", NULL, 0, &sqlStatement); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&statement) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Cannot prepare statement", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 717); - return; + zephir_read_property(&_3, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_4); + zephir_array_fetch_string(&_4, &_3, SL("bind"), PH_NOISY, "phalcon/Mvc/Model/Criteria.zep", 129); + _5 = Z_TYPE_P(&_4) == IS_ARRAY; + if (_5) { + _5 = merge; } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "preparerealsql", NULL, 0, &sqlStatement, &bindParams); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "executeprepared", NULL, 0, &statement, ¶ms, &types); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&statement, &_3); - if (Z_TYPE_P(&statement) == IS_OBJECT) { - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_4$$9); - ZVAL_STRING(&_4$$9, "db:afterQuery"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_4$$9, this_ptr); - zephir_check_call_status(); - } - object_init_ex(return_value, phalcon_db_result_pdoresult_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 39, this_ptr, &statement, &sqlStatement, &bindParams, &bindTypes); - zephir_check_call_status(); - RETURN_MM(); + if (_5) { + zephir_read_property(&_6$$4, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_7$$4, &_6$$4, SL("bind"), PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Criteria.zep", 130); + ZEPHIR_INIT_VAR(&_8$$4); + zephir_add_function(&_8$$4, &_7$$4, &bindParams); + ZEPHIR_INIT_VAR(&_9$$4); + ZVAL_STRING(&_9$$4, "bind"); + zephir_update_property_array(this_ptr, SL("params"), &_9$$4, &_8$$4); + } else { + ZEPHIR_INIT_VAR(&_10$$5); + ZVAL_STRING(&_10$$5, "bind"); + zephir_update_property_array(this_ptr, SL("params"), &_10$$5, &bindParams); } - RETURN_CCTOR(&statement); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, rollback) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, bindTypes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *nesting_param = NULL, eventsManager, savepointName, _0, _1, _4, _7, _9, _2$$4, _3$$5, _8$$6, _10$$8; - zend_bool nesting, _5, _6; + zval *bindTypes_param = NULL, _0; + zval bindTypes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); + ZVAL_UNDEF(&bindTypes); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_10$$8); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(nesting) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(bindTypes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - if (!nesting_param) { - nesting = 1; - } else { - nesting = zephir_get_boolval(nesting_param); - } - + zephir_fetch_params(1, 1, 0, &bindTypes_param); + ZEPHIR_OBS_COPY_OR_DUP(&bindTypes, bindTypes_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_LONG_IDENTICAL(&_0, 0)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "There is no active transaction", "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 755); - return; - } - zephir_read_property(&_1, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_IS_LONG_IDENTICAL(&_1, 1)) { - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_2$$4); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$5); - ZVAL_STRING(&_3$$5, "db:rollbackTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$5, this_ptr); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_2$$4, "rollback", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - zephir_read_property(&_4, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - _5 = ZEPHIR_IS_LONG_IDENTICAL(&_4, 0); - if (!(_5)) { - _5 = !nesting; - } - _6 = _5; - if (!(_6)) { - ZEPHIR_CALL_METHOD(&_7, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _6 = !zephir_is_true(&_7); - } - if (_6) { - zephir_read_property(&_8$$6, this_ptr, ZEND_STRL("transactionLevel"), PH_NOISY_CC | PH_READONLY); - if (ZEPHIR_GT_LONG(&_8$$6, 0)) { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_9, this_ptr, ZEND_STRL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_9); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_10$$8); - ZVAL_STRING(&_10$$8, "db:rollbackSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_10$$8, this_ptr, &savepointName); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel"))); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rollbacksavepoint", NULL, 0, &savepointName); - zephir_check_call_status(); - RETURN_MM(); -} -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, getDsnDefaults) -{ + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "bindTypes"); + zephir_update_property_array(this_ptr, SL("params"), &_0, &bindTypes); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_AbstractPdo, prepareRealSql) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, cache) { - zend_string *_3$$3; - zend_ulong _2$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval parameters, keys, values; - zval *statement_param = NULL, *parameters_param = NULL, key, result, value, *_0$$3, _1$$3, _16$$3, _4$$5, _5$$6, _6$$7, _7$$8, _8$$8, _9$$9, _10$$11, _11$$12, _12$$13, _13$$14, _14$$14, _15$$15; - zval statement; + zval *cache_param = NULL, _0; + zval cache; zval *this_ptr = getThis(); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_16$$3); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$8); - ZVAL_UNDEF(&_8$$8); - ZVAL_UNDEF(&_9$$9); - ZVAL_UNDEF(&_10$$11); - ZVAL_UNDEF(&_11$$12); - ZVAL_UNDEF(&_12$$13); - ZVAL_UNDEF(&_13$$14); - ZVAL_UNDEF(&_14$$14); - ZVAL_UNDEF(&_15$$15); - ZVAL_UNDEF(¶meters); - ZVAL_UNDEF(&keys); - ZVAL_UNDEF(&values); + ZVAL_UNDEF(&cache); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STR(statement) - Z_PARAM_ARRAY(parameters) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(cache) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &statement_param, ¶meters_param); - zephir_get_strval(&statement, statement_param); - zephir_get_arrval(¶meters, parameters_param); + zephir_fetch_params(1, 1, 0, &cache_param); + ZEPHIR_OBS_COPY_OR_DUP(&cache, cache_param); - ZEPHIR_CPY_WRT(&result, &statement); - ZEPHIR_CPY_WRT(&values, ¶meters); - if (!(ZEPHIR_IS_EMPTY(¶meters))) { - ZEPHIR_INIT_VAR(&keys); - array_init(&keys); - zephir_is_iterable(¶meters, 0, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 844); - if (Z_TYPE_P(¶meters) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶meters), _2$$3, _3$$3, _0$$3) + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "cache"); + zephir_update_property_array(this_ptr, SL("params"), &_0, &cache); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, columns) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *columns, columns_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&columns_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(columns) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &columns); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "columns"); + zephir_update_property_array(this_ptr, SL("params"), &_0, columns); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, conditions) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *conditions_param = NULL, _0; + zval conditions; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(conditions) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &conditions_param); + if (UNEXPECTED(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(conditions_param) == IS_STRING)) { + zephir_get_strval(&conditions, conditions_param); + } else { + ZEPHIR_INIT_VAR(&conditions); + } + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "conditions"); + zephir_update_property_array(this_ptr, SL("params"), &_0, &conditions); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, createBuilder) +{ + zval container, manager, builder, _1, _2, _3, _4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_0 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&manager); + ZVAL_UNDEF(&builder); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&container) != IS_OBJECT) { + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_di_ce, "getdefault", &_0, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "setdi", NULL, 0, &container); + zephir_check_call_status(); + } + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "modelsManager"); + ZEPHIR_CALL_METHOD(&_1, &container, "getshared", NULL, 0, &_2); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&manager, &_1); + zephir_read_property(&_3, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(&builder, &manager, "createbuilder", NULL, 0, &_3); + zephir_check_call_status(); + zephir_read_property(&_4, this_ptr, ZEND_STRL("model"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &builder, "from", NULL, 0, &_4); + zephir_check_call_status(); + RETURN_CCTOR(&builder); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, distinct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *distinct, distinct_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&distinct_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(distinct) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &distinct); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "distinct"); + zephir_update_property_array(this_ptr, SL("params"), &_0, distinct); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, execute) +{ + zend_class_entry *_1; + zval model, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_METHOD(&model, this_ptr, "getmodelname", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&model) != IS_STRING)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Model name must be string", "phalcon/Mvc/Model/Criteria.zep", 245); + return; + } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getparams", NULL, 0); + zephir_check_call_status(); + _1 = zephir_fetch_class(&model); + ZEPHIR_RETURN_CALL_CE_STATIC(_1, "find", NULL, 0, &_0); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, forUpdate) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *forUpdate_param = NULL, _0, _1; + zend_bool forUpdate; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(forUpdate) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &forUpdate_param); + if (!forUpdate_param) { + forUpdate = 1; + } else { + forUpdate = zephir_get_boolval(forUpdate_param); + } + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "for_update"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_BOOL(&_1, forUpdate); + zephir_update_property_array(this_ptr, SL("params"), &_0, &_1); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) +{ + zend_bool _6$$4, _7$$7, _11$$10, _12$$13; + zend_string *_5$$3; + zend_ulong _4$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval data, conditions, bind, _1$$3; + zval modelName, operator, _17$$16; + zval *container, container_sub, *modelName_param = NULL, *data_param = NULL, *operator_param = NULL, __$null, attribute, field, value, type, metaData, model, dataTypes, criteria, columnMap, _0$$3, *_2$$3, _3$$3, _8$$9, _9$$9, _10$$8, _13$$15, _14$$15, _15$$14, _16$$16; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&container_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&metaData); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&dataTypes); + ZVAL_UNDEF(&criteria); + ZVAL_UNDEF(&columnMap); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_8$$9); + ZVAL_UNDEF(&_9$$9); + ZVAL_UNDEF(&_10$$8); + ZVAL_UNDEF(&_13$$15); + ZVAL_UNDEF(&_14$$15); + ZVAL_UNDEF(&_15$$14); + ZVAL_UNDEF(&_16$$16); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&operator); + ZVAL_UNDEF(&_17$$16); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&bind); + ZVAL_UNDEF(&_1$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) + Z_PARAM_STR(modelName) + Z_PARAM_ARRAY(data) + Z_PARAM_OPTIONAL + Z_PARAM_STR(operator) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 1, &container, &modelName_param, &data_param, &operator_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); + } else { + ZEPHIR_INIT_VAR(&modelName); + } + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + if (!operator_param) { + ZEPHIR_INIT_VAR(&operator); + ZVAL_STRING(&operator, "AND"); + } else { + if (UNEXPECTED(Z_TYPE_P(operator_param) != IS_STRING && Z_TYPE_P(operator_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'operator' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(operator_param) == IS_STRING)) { + zephir_get_strval(&operator, operator_param); + } else { + ZEPHIR_INIT_VAR(&operator); + } + } + + + ZEPHIR_INIT_VAR(&conditions); + array_init(&conditions); + if (zephir_fast_count_int(&data)) { + ZEPHIR_INIT_VAR(&_0$$3); + ZVAL_STRING(&_0$$3, "modelsMetadata"); + ZEPHIR_CALL_METHOD(&metaData, container, "getshared", NULL, 0, &_0$$3); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 2, 0); + zephir_array_fast_append(&_1$$3, &__$null); + zephir_array_fast_append(&_1$$3, container); + ZEPHIR_INIT_VAR(&model); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&model, &modelName, &_1$$3); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&dataTypes, &metaData, "getdatatypes", NULL, 0, &model); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&columnMap, &metaData, "getreversecolumnmap", NULL, 0, &model); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&bind); + array_init(&bind); + zephir_is_iterable(&data, 0, "phalcon/Mvc/Model/Criteria.zep", 322); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _4$$3, _5$$3, _2$$3) { - ZEPHIR_INIT_NVAR(&key); - if (_3$$3 != NULL) { - ZVAL_STR_COPY(&key, _3$$3); + ZEPHIR_INIT_NVAR(&field); + if (_5$$3 != NULL) { + ZVAL_STR_COPY(&field, _5$$3); } else { - ZVAL_LONG(&key, _2$$3); + ZVAL_LONG(&field, _4$$3); } ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0$$3); - if (Z_TYPE_P(&key) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_4$$5); - ZEPHIR_CONCAT_SVS(&_4$$5, "/:", &key, "/"); - zephir_array_append(&keys, &_4$$5, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 830); + ZVAL_COPY(&value, _2$$3); + _6$$4 = Z_TYPE_P(&columnMap) == IS_ARRAY; + if (_6$$4) { + _6$$4 = ((zephir_fast_count_int(&columnMap)) ? 1 : 0); + } + if (_6$$4) { + ZEPHIR_OBS_NVAR(&attribute); + zephir_array_fetch(&attribute, &columnMap, &field, PH_NOISY, "phalcon/Mvc/Model/Criteria.zep", 297); } else { - ZEPHIR_INIT_NVAR(&_5$$6); - ZVAL_STRING(&_5$$6, "/[?]/"); - zephir_array_append(&keys, &_5$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 832); + ZEPHIR_CPY_WRT(&attribute, &field); } - if (Z_TYPE_P(&value) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_6$$7); - ZEPHIR_CONCAT_SVS(&_6$$7, "'", &value, "'"); - zephir_array_update_zval(&values, &key, &_6$$7, PH_COPY | PH_SEPARATE); - } else if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_7$$8); - zephir_fast_join_str(&_7$$8, SL("','"), &value); - ZEPHIR_INIT_NVAR(&_8$$8); - ZEPHIR_CONCAT_SVS(&_8$$8, "'", &_7$$8, "'"); - zephir_array_update_zval(&values, &key, &_8$$8, PH_COPY | PH_SEPARATE); - } else if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_9$$9); - ZVAL_STRING(&_9$$9, "NULL"); - zephir_array_update_zval(&values, &key, &_9$$9, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&type); + if (zephir_array_isset_fetch(&type, &dataTypes, &attribute, 0)) { + _7$$7 = Z_TYPE_P(&value) != IS_NULL; + if (_7$$7) { + _7$$7 = !ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + } + if (_7$$7) { + if (ZEPHIR_IS_LONG(&type, 2)) { + ZEPHIR_INIT_NVAR(&_8$$9); + ZEPHIR_CONCAT_SVSVS(&_8$$9, "[", &field, "] LIKE :", &field, ":"); + zephir_array_append(&conditions, &_8$$9, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 308); + ZEPHIR_INIT_NVAR(&_9$$9); + ZEPHIR_CONCAT_SVS(&_9$$9, "%", &value, "%"); + zephir_array_update_zval(&bind, &field, &_9$$9, PH_COPY | PH_SEPARATE); + continue; + } + ZEPHIR_INIT_NVAR(&_10$$8); + ZEPHIR_CONCAT_SVSVS(&_10$$8, "[", &field, "] = :", &field, ":"); + zephir_array_append(&conditions, &_10$$8, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 317); + zephir_array_update_zval(&bind, &field, &value, PH_COPY | PH_SEPARATE); + } } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, ¶meters, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, ¶meters, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_3$$3, &data, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { + if (!zend_is_true(&_3$$3)) { break; } - ZEPHIR_CALL_METHOD(&key, ¶meters, "key", NULL, 0); + ZEPHIR_CALL_METHOD(&field, &data, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, ¶meters, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&key) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_10$$11); - ZEPHIR_CONCAT_SVS(&_10$$11, "/:", &key, "/"); - zephir_array_append(&keys, &_10$$11, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 830); + _11$$10 = Z_TYPE_P(&columnMap) == IS_ARRAY; + if (_11$$10) { + _11$$10 = ((zephir_fast_count_int(&columnMap)) ? 1 : 0); + } + if (_11$$10) { + ZEPHIR_OBS_NVAR(&attribute); + zephir_array_fetch(&attribute, &columnMap, &field, PH_NOISY, "phalcon/Mvc/Model/Criteria.zep", 297); } else { - ZEPHIR_INIT_NVAR(&_11$$12); - ZVAL_STRING(&_11$$12, "/[?]/"); - zephir_array_append(&keys, &_11$$12, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/AbstractPdo.zep", 832); + ZEPHIR_CPY_WRT(&attribute, &field); } - if (Z_TYPE_P(&value) == IS_STRING) { - ZEPHIR_INIT_NVAR(&_12$$13); - ZEPHIR_CONCAT_SVS(&_12$$13, "'", &value, "'"); - zephir_array_update_zval(&values, &key, &_12$$13, PH_COPY | PH_SEPARATE); - } else if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_13$$14); - zephir_fast_join_str(&_13$$14, SL("','"), &value); - ZEPHIR_INIT_NVAR(&_14$$14); - ZEPHIR_CONCAT_SVS(&_14$$14, "'", &_13$$14, "'"); - zephir_array_update_zval(&values, &key, &_14$$14, PH_COPY | PH_SEPARATE); - } else if (Z_TYPE_P(&value) == IS_NULL) { - ZEPHIR_INIT_NVAR(&_15$$15); - ZVAL_STRING(&_15$$15, "NULL"); - zephir_array_update_zval(&values, &key, &_15$$15, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&type); + if (zephir_array_isset_fetch(&type, &dataTypes, &attribute, 0)) { + _12$$13 = Z_TYPE_P(&value) != IS_NULL; + if (_12$$13) { + _12$$13 = !ZEPHIR_IS_STRING_IDENTICAL(&value, ""); + } + if (_12$$13) { + if (ZEPHIR_IS_LONG(&type, 2)) { + ZEPHIR_INIT_NVAR(&_13$$15); + ZEPHIR_CONCAT_SVSVS(&_13$$15, "[", &field, "] LIKE :", &field, ":"); + zephir_array_append(&conditions, &_13$$15, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 308); + ZEPHIR_INIT_NVAR(&_14$$15); + ZEPHIR_CONCAT_SVS(&_14$$15, "%", &value, "%"); + zephir_array_update_zval(&bind, &field, &_14$$15, PH_COPY | PH_SEPARATE); + continue; + } + ZEPHIR_INIT_NVAR(&_15$$14); + ZEPHIR_CONCAT_SVSVS(&_15$$14, "[", &field, "] = :", &field, ":"); + zephir_array_append(&conditions, &_15$$14, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 317); + zephir_array_update_zval(&bind, &field, &value, PH_COPY | PH_SEPARATE); + } } - ZEPHIR_CALL_METHOD(NULL, ¶meters, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - ZVAL_LONG(&_16$$3, 1); - ZEPHIR_CALL_FUNCTION(&result, "preg_replace", NULL, 37, &keys, &values, &statement, &_16$$3); + ZEPHIR_INIT_NVAR(&field); + } + ZEPHIR_INIT_VAR(&criteria); + object_init_ex(&criteria, phalcon_mvc_model_criteria_ce); + if (zephir_has_constructor(&criteria)) { + ZEPHIR_CALL_METHOD(NULL, &criteria, "__construct", NULL, 0); zephir_check_call_status(); } - zephir_update_property_zval(this_ptr, ZEND_STRL("realSqlStatement"), &result); - ZEPHIR_MM_RESTORE(); + + ZEPHIR_CALL_METHOD(NULL, &criteria, "setdi", NULL, 431, container); + zephir_check_call_status(); + if (zephir_fast_count_int(&conditions)) { + ZEPHIR_INIT_VAR(&_16$$16); + ZEPHIR_INIT_VAR(&_17$$16); + ZEPHIR_CONCAT_SVS(&_17$$16, " ", &operator, " "); + zephir_fast_join(&_16$$16, &_17$$16, &conditions); + ZEPHIR_CALL_METHOD(NULL, &criteria, "where", NULL, 440, &_16$$16); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &criteria, "bind", NULL, 441, &bind); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &criteria, "setmodelname", NULL, 432, &modelName); + zephir_check_call_status(); + RETURN_CCTOR(&criteria); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getColumns) +{ + zval columns, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&columns, &_0, SL("columns"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&columns); } +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getConditions) +{ + zval conditions, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&_0); -#ifdef HAVE_CONFIG_H -#endif + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&conditions, &_0, SL("conditions"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&conditions); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getDI) +{ + zval _0, _1; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch_string(&_1, &_0, SL("di"), PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Criteria.zep", 379); + RETURN_CTORW(&_1); +} -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo_Mysql) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getGroupBy) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter\\Pdo, Mysql, phalcon, db_adapter_pdo_mysql, phalcon_db_adapter_pdo_abstractpdo_ce, phalcon_db_adapter_pdo_mysql_method_entry, 0); + zval group, _0; + zval *this_ptr = getThis(); - zend_declare_property_string(phalcon_db_adapter_pdo_mysql_ce, SL("dialectType"), "mysql", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_db_adapter_pdo_mysql_ce, SL("type"), "mysql", ZEND_ACC_PROTECTED); - return SUCCESS; + ZVAL_UNDEF(&group); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&group, &_0, SL("group"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&group); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, __construct) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getHaving) +{ + zval having, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&having); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&having, &_0, SL("having"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&having); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getLimit) +{ + zval limit, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&limit); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&limit, &_0, SL("limit"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&limit); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getModelName) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "model"); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getOrderBy) +{ + zval order, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&order); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&order, &_0, SL("order"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&order); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getParams) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "params"); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, getWhere) +{ + zval conditions, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&_0); + + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_string_fetch(&conditions, &_0, SL("conditions"), 1))) { + RETURN_NULL(); + } + RETURN_CTORW(&conditions); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, groupBy) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_2 = NULL; - zval *descriptor_param = NULL, __$false, _0, _1; - zval descriptor; + zval *group, group_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&group_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(descriptor) + Z_PARAM_ZVAL(group) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); + zephir_fetch_params(1, 1, 0, &group); - zephir_array_fetch_string(&_0, &descriptor, SL("options"), PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 74); - if (!(zephir_array_isset_long(&_0, 20))) { - zephir_array_update_multi(&descriptor, &__$false, SL("sl"), 3, SL("options"), 20); - } - zephir_array_fetch_string(&_1, &descriptor, SL("options"), PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 77); - if (!(zephir_array_isset_long(&_1, 17))) { - zephir_array_update_multi(&descriptor, &__$false, SL("sl"), 3, SL("options"), 17); - } - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_mysql_ce, getThis(), "__construct", &_2, 0, &descriptor); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "group"); + zephir_update_property_array(this_ptr, SL("params"), &_0, group); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, addForeignKey) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, having) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *having, having_sub, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&having_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(having) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &having); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "having"); + zephir_update_property_array(this_ptr, SL("params"), &_0, having); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, innerJoin) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *reference, reference_sub, foreignKeyCheck, _0, _1, _2, _3, _4; - zval tableName, schemaName; + zval *model_param = NULL, *conditions = NULL, conditions_sub, *alias = NULL, alias_sub, __$null, _0; + zval model; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&reference_sub); - ZVAL_UNDEF(&foreignKeyCheck); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&conditions_sub); + ZVAL_UNDEF(&alias_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(reference, phalcon_db_referenceinterface_ce) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(model) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(conditions) + Z_PARAM_ZVAL_OR_NULL(alias) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 1, 2, &model_param, &conditions, &alias); + if (UNEXPECTED(Z_TYPE_P(model_param) != IS_STRING && Z_TYPE_P(model_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'model' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(model_param) == IS_STRING)) { + zephir_get_strval(&model, model_param); } else { - ZEPHIR_INIT_VAR(&tableName); + ZEPHIR_INIT_VAR(&model); } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + if (!conditions) { + conditions = &conditions_sub; + conditions = &__$null; + } + if (!alias) { + alias = &alias_sub; + alias = &__$null; + } + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "INNER"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "join", NULL, 0, &model, conditions, alias, &_0); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, inWhere) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval values, bindParams, bindKeys; + zval *expr_param = NULL, *values_param = NULL, hiddenParam, value, *_1, _2, _5, _6, _3$$4, _4$$5; + zval expr, key, queryKey, _0$$3; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&expr); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&queryKey); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&hiddenParam); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&bindParams); + ZVAL_UNDEF(&bindKeys); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(expr) + Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &expr_param, &values_param); + if (UNEXPECTED(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(expr_param) == IS_STRING)) { + zephir_get_strval(&expr, expr_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&expr); } + ZEPHIR_OBS_COPY_OR_DUP(&values, values_param); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "getforeignkeychecks", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&foreignKeyCheck, this_ptr, "prepare", NULL, 0, &_1); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_2, &foreignKeyCheck, "execute", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(!zephir_is_true(&_2))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "DATABASE PARAMETER 'FOREIGN_KEY_CHECKS' HAS TO BE 1", "phalcon/Db/Adapter/Pdo/Mysql.zep", 98); - return; + if (!(zephir_fast_count_int(&values))) { + ZEPHIR_INIT_VAR(&_0$$3); + ZEPHIR_CONCAT_VSV(&_0$$3, &expr, " != ", &expr); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, &_0$$3); + zephir_check_call_status(); + RETURN_THIS(); } - zephir_read_property(&_3, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_4, &_3, "addforeignkey", NULL, 0, &tableName, &schemaName, reference); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_4); + ZEPHIR_OBS_VAR(&hiddenParam); + zephir_read_property(&hiddenParam, this_ptr, ZEND_STRL("hiddenParamNumber"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(&bindParams); + array_init(&bindParams); + ZEPHIR_INIT_VAR(&bindKeys); + array_init(&bindKeys); + zephir_is_iterable(&values, 0, "phalcon/Mvc/Model/Criteria.zep", 559); + if (Z_TYPE_P(&values) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&values), _1) + { + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1); + ZEPHIR_INIT_NVAR(&_3$$4); + ZEPHIR_CONCAT_SV(&_3$$4, "ACP", &hiddenParam); + zephir_get_strval(&key, &_3$$4); + ZEPHIR_INIT_NVAR(&queryKey); + ZEPHIR_CONCAT_SVS(&queryKey, ":", &key, ":"); + zephir_array_append(&bindKeys, &queryKey, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 549); + zephir_array_update_zval(&bindParams, &key, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_SEPARATE(&hiddenParam); + zephir_increment(&hiddenParam); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &values, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_4$$5); + ZEPHIR_CONCAT_SV(&_4$$5, "ACP", &hiddenParam); + zephir_get_strval(&key, &_4$$5); + ZEPHIR_INIT_NVAR(&queryKey); + ZEPHIR_CONCAT_SVS(&queryKey, ":", &key, ":"); + zephir_array_append(&bindKeys, &queryKey, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 549); + zephir_array_update_zval(&bindParams, &key, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_SEPARATE(&hiddenParam); + zephir_increment(&hiddenParam); + ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_VAR(&_5); + zephir_fast_join_str(&_5, SL(", "), &bindKeys); + ZEPHIR_INIT_VAR(&_6); + ZEPHIR_CONCAT_VSVS(&_6, &expr, " IN (", &_5, ")"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, &_6, &bindParams); zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, ZEND_STRL("hiddenParamNumber"), &hiddenParam); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, join) { - zend_bool _5$$3, _66$$49; - zval definition; + zval join, _1$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_64 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, __$true, __$false, columns, columnType, fields, field, oldColumn, sizePattern, matches, matchOne, matchTwo, columnName, _0, _1, _2, *_3, _4, _49$$3, _50$$3, _51$$3, _52$$3, _61$$3, _63$$3, _6$$4, _7$$4, _8$$5, _9$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$11, _20$$12, _21$$13, _22$$14, _23$$14, _24$$15, _25$$15, _26$$16, _27$$17, _28$$18, _29$$19, _30$$20, _31$$21, _32$$22, _33$$23, _34$$24, _35$$25, _36$$26, _37$$27, _38$$28, _39$$29, _40$$30, _41$$31, _42$$32, _43$$32, _44$$33, _45$$33, _46$$33, _47$$35, _48$$36, _53$$43, _54$$44, _55$$44, _56$$44, _57$$45, _58$$46, _59$$47, _60$$47, _62$$48, _65$$49, _110$$49, _111$$49, _112$$49, _113$$49, _122$$49, _124$$49, _67$$50, _68$$50, _69$$51, _70$$51, _71$$52, _72$$52, _73$$53, _74$$53, _75$$54, _76$$54, _77$$55, _78$$55, _79$$56, _80$$57, _81$$58, _82$$59, _83$$60, _84$$60, _85$$61, _86$$61, _87$$62, _88$$63, _89$$64, _90$$65, _91$$66, _92$$67, _93$$68, _94$$69, _95$$70, _96$$71, _97$$72, _98$$73, _99$$74, _100$$75, _101$$76, _102$$77, _103$$78, _104$$78, _105$$79, _106$$79, _107$$79, _108$$81, _109$$82, _114$$89, _115$$90, _116$$90, _117$$90, _118$$91, _119$$92, _120$$93, _121$$93, _123$$94; - zval table, schema; + zval *model_param = NULL, *conditions = NULL, conditions_sub, *alias = NULL, alias_sub, *type = NULL, type_sub, __$null, mergedJoins, currentJoins, _0, _4, _2$$5, _3$$6; + zval model; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&oldColumn); - ZVAL_UNDEF(&sizePattern); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&matchOne); - ZVAL_UNDEF(&matchTwo); - ZVAL_UNDEF(&columnName); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&conditions_sub); + ZVAL_UNDEF(&alias_sub); + ZVAL_UNDEF(&type_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&mergedJoins); + ZVAL_UNDEF(¤tJoins); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_49$$3); - ZVAL_UNDEF(&_50$$3); - ZVAL_UNDEF(&_51$$3); - ZVAL_UNDEF(&_52$$3); - ZVAL_UNDEF(&_61$$3); - ZVAL_UNDEF(&_63$$3); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$6); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_13$$7); - ZVAL_UNDEF(&_14$$8); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$9); - ZVAL_UNDEF(&_17$$9); - ZVAL_UNDEF(&_18$$10); - ZVAL_UNDEF(&_19$$11); - ZVAL_UNDEF(&_20$$12); - ZVAL_UNDEF(&_21$$13); - ZVAL_UNDEF(&_22$$14); - ZVAL_UNDEF(&_23$$14); - ZVAL_UNDEF(&_24$$15); - ZVAL_UNDEF(&_25$$15); - ZVAL_UNDEF(&_26$$16); - ZVAL_UNDEF(&_27$$17); - ZVAL_UNDEF(&_28$$18); - ZVAL_UNDEF(&_29$$19); - ZVAL_UNDEF(&_30$$20); - ZVAL_UNDEF(&_31$$21); - ZVAL_UNDEF(&_32$$22); - ZVAL_UNDEF(&_33$$23); - ZVAL_UNDEF(&_34$$24); - ZVAL_UNDEF(&_35$$25); - ZVAL_UNDEF(&_36$$26); - ZVAL_UNDEF(&_37$$27); - ZVAL_UNDEF(&_38$$28); - ZVAL_UNDEF(&_39$$29); - ZVAL_UNDEF(&_40$$30); - ZVAL_UNDEF(&_41$$31); - ZVAL_UNDEF(&_42$$32); - ZVAL_UNDEF(&_43$$32); - ZVAL_UNDEF(&_44$$33); - ZVAL_UNDEF(&_45$$33); - ZVAL_UNDEF(&_46$$33); - ZVAL_UNDEF(&_47$$35); - ZVAL_UNDEF(&_48$$36); - ZVAL_UNDEF(&_53$$43); - ZVAL_UNDEF(&_54$$44); - ZVAL_UNDEF(&_55$$44); - ZVAL_UNDEF(&_56$$44); - ZVAL_UNDEF(&_57$$45); - ZVAL_UNDEF(&_58$$46); - ZVAL_UNDEF(&_59$$47); - ZVAL_UNDEF(&_60$$47); - ZVAL_UNDEF(&_62$$48); - ZVAL_UNDEF(&_65$$49); - ZVAL_UNDEF(&_110$$49); - ZVAL_UNDEF(&_111$$49); - ZVAL_UNDEF(&_112$$49); - ZVAL_UNDEF(&_113$$49); - ZVAL_UNDEF(&_122$$49); - ZVAL_UNDEF(&_124$$49); - ZVAL_UNDEF(&_67$$50); - ZVAL_UNDEF(&_68$$50); - ZVAL_UNDEF(&_69$$51); - ZVAL_UNDEF(&_70$$51); - ZVAL_UNDEF(&_71$$52); - ZVAL_UNDEF(&_72$$52); - ZVAL_UNDEF(&_73$$53); - ZVAL_UNDEF(&_74$$53); - ZVAL_UNDEF(&_75$$54); - ZVAL_UNDEF(&_76$$54); - ZVAL_UNDEF(&_77$$55); - ZVAL_UNDEF(&_78$$55); - ZVAL_UNDEF(&_79$$56); - ZVAL_UNDEF(&_80$$57); - ZVAL_UNDEF(&_81$$58); - ZVAL_UNDEF(&_82$$59); - ZVAL_UNDEF(&_83$$60); - ZVAL_UNDEF(&_84$$60); - ZVAL_UNDEF(&_85$$61); - ZVAL_UNDEF(&_86$$61); - ZVAL_UNDEF(&_87$$62); - ZVAL_UNDEF(&_88$$63); - ZVAL_UNDEF(&_89$$64); - ZVAL_UNDEF(&_90$$65); - ZVAL_UNDEF(&_91$$66); - ZVAL_UNDEF(&_92$$67); - ZVAL_UNDEF(&_93$$68); - ZVAL_UNDEF(&_94$$69); - ZVAL_UNDEF(&_95$$70); - ZVAL_UNDEF(&_96$$71); - ZVAL_UNDEF(&_97$$72); - ZVAL_UNDEF(&_98$$73); - ZVAL_UNDEF(&_99$$74); - ZVAL_UNDEF(&_100$$75); - ZVAL_UNDEF(&_101$$76); - ZVAL_UNDEF(&_102$$77); - ZVAL_UNDEF(&_103$$78); - ZVAL_UNDEF(&_104$$78); - ZVAL_UNDEF(&_105$$79); - ZVAL_UNDEF(&_106$$79); - ZVAL_UNDEF(&_107$$79); - ZVAL_UNDEF(&_108$$81); - ZVAL_UNDEF(&_109$$82); - ZVAL_UNDEF(&_114$$89); - ZVAL_UNDEF(&_115$$90); - ZVAL_UNDEF(&_116$$90); - ZVAL_UNDEF(&_117$$90); - ZVAL_UNDEF(&_118$$91); - ZVAL_UNDEF(&_119$$92); - ZVAL_UNDEF(&_120$$93); - ZVAL_UNDEF(&_121$$93); - ZVAL_UNDEF(&_123$$94); - ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&join); + ZVAL_UNDEF(&_1$$4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 4) + Z_PARAM_STR(model) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(conditions) + Z_PARAM_ZVAL_OR_NULL(alias) + Z_PARAM_ZVAL_OR_NULL(type) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - zephir_get_strval(&table, table_param); - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + zephir_fetch_params(1, 1, 3, &model_param, &conditions, &alias, &type); + if (UNEXPECTED(Z_TYPE_P(model_param) != IS_STRING && Z_TYPE_P(model_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'model' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(model_param) == IS_STRING)) { + zephir_get_strval(&model, model_param); } else { - zephir_get_strval(&schema, schema_param); + ZEPHIR_INIT_VAR(&model); + } + if (!conditions) { + conditions = &conditions_sub; + conditions = &__$null; + } + if (!alias) { + alias = &alias_sub; + alias = &__$null; + } + if (!type) { + type = &type_sub; + type = &__$null; } - ZEPHIR_INIT_VAR(&oldColumn); - ZVAL_NULL(&oldColumn); - ZEPHIR_INIT_VAR(&sizePattern); - ZVAL_STRING(&sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#"); - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "describecolumns", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_2, 3); - ZEPHIR_CALL_METHOD(&fields, this_ptr, "fetchall", NULL, 0, &_1, &_2); - zephir_check_call_status(); - zephir_is_iterable(&fields, 0, "phalcon/Db/Adapter/Pdo/Mysql.zep", 500); - if (Z_TYPE_P(&fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&fields), _3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _3); - ZEPHIR_INIT_NVAR(&definition); - zephir_create_array(&definition, 1, 0); - add_assoc_long_ex(&definition, SL("bindType"), 2); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 153); - do { - _5$$3 = 1; - if (_5$$3 == zephir_start_with_str(&columnType, SL("bigint"))) { - ZEPHIR_INIT_NVAR(&_6$$4); - ZVAL_LONG(&_6$$4, 14); - zephir_array_update_string(&definition, SL("type"), &_6$$4, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_7$$4); - ZVAL_LONG(&_7$$4, 2); - zephir_array_update_string(&definition, SL("bindType"), &_7$$4, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("mediumint"))) { - ZEPHIR_INIT_NVAR(&_8$$5); - ZVAL_LONG(&_8$$5, 21); - zephir_array_update_string(&definition, SL("type"), &_8$$5, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_9$$5); - ZVAL_LONG(&_9$$5, 1); - zephir_array_update_string(&definition, SL("bindType"), &_9$$5, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("smallint"))) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZVAL_LONG(&_10$$6, 22); - zephir_array_update_string(&definition, SL("type"), &_10$$6, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_11$$6); - ZVAL_LONG(&_11$$6, 1); - zephir_array_update_string(&definition, SL("bindType"), &_11$$6, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("tinyint"))) { - ZEPHIR_INIT_NVAR(&_12$$7); - ZVAL_LONG(&_12$$7, 26); - zephir_array_update_string(&definition, SL("type"), &_12$$7, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_13$$7); - ZVAL_LONG(&_13$$7, 1); - zephir_array_update_string(&definition, SL("bindType"), &_13$$7, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("int"))) { - ZEPHIR_INIT_NVAR(&_14$$8); - ZVAL_LONG(&_14$$8, 0); - zephir_array_update_string(&definition, SL("type"), &_14$$8, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_15$$8); - ZVAL_LONG(&_15$$8, 1); - zephir_array_update_string(&definition, SL("bindType"), &_15$$8, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("bit"))) { - ZEPHIR_INIT_NVAR(&_16$$9); - ZVAL_LONG(&_16$$9, 19); - zephir_array_update_string(&definition, SL("type"), &_16$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_17$$9); - ZVAL_LONG(&_17$$9, 1); - zephir_array_update_string(&definition, SL("bindType"), &_17$$9, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("enum"))) { - ZEPHIR_INIT_NVAR(&_18$$10); - ZVAL_LONG(&_18$$10, 18); - zephir_array_update_string(&definition, SL("type"), &_18$$10, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("datetime"))) { - ZEPHIR_INIT_NVAR(&_19$$11); - ZVAL_LONG(&_19$$11, 4); - zephir_array_update_string(&definition, SL("type"), &_19$$11, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("date"))) { - ZEPHIR_INIT_NVAR(&_20$$12); - ZVAL_LONG(&_20$$12, 1); - zephir_array_update_string(&definition, SL("type"), &_20$$12, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("decimal"))) { - ZEPHIR_INIT_NVAR(&_21$$13); - ZVAL_LONG(&_21$$13, 3); - zephir_array_update_string(&definition, SL("type"), &_21$$13, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("double"))) { - ZEPHIR_INIT_NVAR(&_22$$14); - ZVAL_LONG(&_22$$14, 9); - zephir_array_update_string(&definition, SL("type"), &_22$$14, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_23$$14); - ZVAL_LONG(&_23$$14, 32); - zephir_array_update_string(&definition, SL("bindType"), &_23$$14, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("float"))) { - ZEPHIR_INIT_NVAR(&_24$$15); - ZVAL_LONG(&_24$$15, 7); - zephir_array_update_string(&definition, SL("type"), &_24$$15, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_25$$15); - ZVAL_LONG(&_25$$15, 32); - zephir_array_update_string(&definition, SL("bindType"), &_25$$15, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("mediumblob"))) { - ZEPHIR_INIT_NVAR(&_26$$16); - ZVAL_LONG(&_26$$16, 12); - zephir_array_update_string(&definition, SL("type"), &_26$$16, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("longblob"))) { - ZEPHIR_INIT_NVAR(&_27$$17); - ZVAL_LONG(&_27$$17, 13); - zephir_array_update_string(&definition, SL("type"), &_27$$17, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("tinyblob"))) { - ZEPHIR_INIT_NVAR(&_28$$18); - ZVAL_LONG(&_28$$18, 10); - zephir_array_update_string(&definition, SL("type"), &_28$$18, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("blob"))) { - ZEPHIR_INIT_NVAR(&_29$$19); - ZVAL_LONG(&_29$$19, 11); - zephir_array_update_string(&definition, SL("type"), &_29$$19, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("timestamp"))) { - ZEPHIR_INIT_NVAR(&_30$$20); - ZVAL_LONG(&_30$$20, 17); - zephir_array_update_string(&definition, SL("type"), &_30$$20, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("time"))) { - ZEPHIR_INIT_NVAR(&_31$$21); - ZVAL_LONG(&_31$$21, 20); - zephir_array_update_string(&definition, SL("type"), &_31$$21, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("json"))) { - ZEPHIR_INIT_NVAR(&_32$$22); - ZVAL_LONG(&_32$$22, 15); - zephir_array_update_string(&definition, SL("type"), &_32$$22, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("longtext"))) { - ZEPHIR_INIT_NVAR(&_33$$23); - ZVAL_LONG(&_33$$23, 24); - zephir_array_update_string(&definition, SL("type"), &_33$$23, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("mediumtext"))) { - ZEPHIR_INIT_NVAR(&_34$$24); - ZVAL_LONG(&_34$$24, 23); - zephir_array_update_string(&definition, SL("type"), &_34$$24, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("tinytext"))) { - ZEPHIR_INIT_NVAR(&_35$$25); - ZVAL_LONG(&_35$$25, 25); - zephir_array_update_string(&definition, SL("type"), &_35$$25, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("text"))) { - ZEPHIR_INIT_NVAR(&_36$$26); - ZVAL_LONG(&_36$$26, 6); - zephir_array_update_string(&definition, SL("type"), &_36$$26, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("varchar"))) { - ZEPHIR_INIT_NVAR(&_37$$27); - ZVAL_LONG(&_37$$27, 2); - zephir_array_update_string(&definition, SL("type"), &_37$$27, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("char"))) { - ZEPHIR_INIT_NVAR(&_38$$28); - ZVAL_LONG(&_38$$28, 5); - zephir_array_update_string(&definition, SL("type"), &_38$$28, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("varbinary"))) { - ZEPHIR_INIT_NVAR(&_39$$29); - ZVAL_LONG(&_39$$29, 26); - zephir_array_update_string(&definition, SL("type"), &_39$$29, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_start_with_str(&columnType, SL("binary"))) { - ZEPHIR_INIT_NVAR(&_40$$30); - ZVAL_LONG(&_40$$30, 26); - zephir_array_update_string(&definition, SL("type"), &_40$$30, PH_COPY | PH_SEPARATE); - break; - } - ZEPHIR_INIT_NVAR(&_41$$31); - ZVAL_LONG(&_41$$31, 2); - zephir_array_update_string(&definition, SL("type"), &_41$$31, PH_COPY | PH_SEPARATE); - break; - } while(0); - - if (zephir_memnstr_str(&columnType, SL("("), "phalcon/Db/Adapter/Pdo/Mysql.zep", 417)) { - ZEPHIR_INIT_NVAR(&matches); - ZVAL_NULL(&matches); - zephir_array_fetch_string(&_42$$32, &definition, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 420); - ZEPHIR_INIT_NVAR(&_43$$32); - zephir_preg_match(&_43$$32, &sizePattern, &columnType, &matches, 0, 0 , 0 ); - if (ZEPHIR_IS_LONG(&_42$$32, 18)) { - ZVAL_LONG(&_44$$33, 5); - ZVAL_LONG(&_45$$33, -1); - ZEPHIR_INIT_NVAR(&_46$$33); - zephir_substr(&_46$$33, &columnType, 5 , -1 , 0); - zephir_array_update_string(&definition, SL("size"), &_46$$33, PH_COPY | PH_SEPARATE); - } else if (zephir_is_true(&_43$$32)) { - ZEPHIR_OBS_NVAR(&matchOne); - if (zephir_array_isset_long_fetch(&matchOne, &matches, 1, 0)) { - ZEPHIR_INIT_NVAR(&_47$$35); - ZVAL_LONG(&_47$$35, zephir_get_intval(&matchOne)); - zephir_array_update_string(&definition, SL("size"), &_47$$35, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&matchTwo); - if (zephir_array_isset_long_fetch(&matchTwo, &matches, 2, 0)) { - ZEPHIR_INIT_NVAR(&_48$$36); - ZVAL_LONG(&_48$$36, zephir_get_intval(&matchTwo)); - zephir_array_update_string(&definition, SL("scale"), &_48$$36, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_memnstr_str(&columnType, SL("unsigned"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 436)) { - zephir_array_update_string(&definition, SL("unsigned"), &__$true, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_49$$3, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 452); - if (ZEPHIR_IS_STRING(&_49$$3, "PRI")) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_50$$3, &field, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 459); - if (ZEPHIR_IS_STRING(&_50$$3, "YES")) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_51$$3, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 466); - if (ZEPHIR_IS_STRING(&_51$$3, "auto_increment")) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_52$$3, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 473); - if (Z_TYPE_P(&_52$$3) != IS_NULL) { - zephir_array_fetch_long(&_53$$43, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 474); - if (zephir_memnstr_str(&_53$$43, SL("on update"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 474)) { - zephir_array_fetch_long(&_54$$44, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 475); - zephir_array_fetch_long(&_55$$44, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 475); - ZEPHIR_INIT_NVAR(&_56$$44); - ZEPHIR_CONCAT_VSV(&_56$$44, &_54$$44, " ", &_55$$44); - zephir_array_update_string(&definition, SL("default"), &_56$$44, PH_COPY | PH_SEPARATE); - } else { - zephir_array_fetch_long(&_57$$45, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 477); - zephir_array_update_string(&definition, SL("default"), &_57$$45, PH_COPY | PH_SEPARATE); - } - } else { - zephir_array_fetch_long(&_58$$46, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 480); - if (zephir_memnstr_str(&_58$$46, SL("on update"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 480)) { - zephir_array_fetch_long(&_59$$47, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 481); - ZEPHIR_INIT_NVAR(&_60$$47); - ZEPHIR_CONCAT_SV(&_60$$47, "NULL ", &_59$$47); - zephir_array_update_string(&definition, SL("default"), &_60$$47, PH_COPY | PH_SEPARATE); - } - } - zephir_array_fetch_long(&_61$$3, &field, 8, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 488); - if (Z_TYPE_P(&_61$$3) != IS_NULL) { - zephir_array_fetch_long(&_62$$48, &field, 8, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 489); - zephir_array_update_string(&definition, SL("comment"), &_62$$48, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 495); - ZEPHIR_INIT_NVAR(&_63$$3); - object_init_ex(&_63$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_63$$3, "__construct", &_64, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_63$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 496); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &fields, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&field, &fields, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_65$$49); - zephir_create_array(&_65$$49, 1, 0); - add_assoc_long_ex(&_65$$49, SL("bindType"), 2); - ZEPHIR_CPY_WRT(&definition, &_65$$49); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 153); - do { - _66$$49 = 1; - if (_66$$49 == zephir_start_with_str(&columnType, SL("bigint"))) { - ZEPHIR_INIT_NVAR(&_67$$50); - ZVAL_LONG(&_67$$50, 14); - zephir_array_update_string(&definition, SL("type"), &_67$$50, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_68$$50); - ZVAL_LONG(&_68$$50, 2); - zephir_array_update_string(&definition, SL("bindType"), &_68$$50, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("mediumint"))) { - ZEPHIR_INIT_NVAR(&_69$$51); - ZVAL_LONG(&_69$$51, 21); - zephir_array_update_string(&definition, SL("type"), &_69$$51, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_70$$51); - ZVAL_LONG(&_70$$51, 1); - zephir_array_update_string(&definition, SL("bindType"), &_70$$51, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("smallint"))) { - ZEPHIR_INIT_NVAR(&_71$$52); - ZVAL_LONG(&_71$$52, 22); - zephir_array_update_string(&definition, SL("type"), &_71$$52, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_72$$52); - ZVAL_LONG(&_72$$52, 1); - zephir_array_update_string(&definition, SL("bindType"), &_72$$52, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("tinyint"))) { - ZEPHIR_INIT_NVAR(&_73$$53); - ZVAL_LONG(&_73$$53, 26); - zephir_array_update_string(&definition, SL("type"), &_73$$53, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_74$$53); - ZVAL_LONG(&_74$$53, 1); - zephir_array_update_string(&definition, SL("bindType"), &_74$$53, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("int"))) { - ZEPHIR_INIT_NVAR(&_75$$54); - ZVAL_LONG(&_75$$54, 0); - zephir_array_update_string(&definition, SL("type"), &_75$$54, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_76$$54); - ZVAL_LONG(&_76$$54, 1); - zephir_array_update_string(&definition, SL("bindType"), &_76$$54, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("bit"))) { - ZEPHIR_INIT_NVAR(&_77$$55); - ZVAL_LONG(&_77$$55, 19); - zephir_array_update_string(&definition, SL("type"), &_77$$55, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_78$$55); - ZVAL_LONG(&_78$$55, 1); - zephir_array_update_string(&definition, SL("bindType"), &_78$$55, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("enum"))) { - ZEPHIR_INIT_NVAR(&_79$$56); - ZVAL_LONG(&_79$$56, 18); - zephir_array_update_string(&definition, SL("type"), &_79$$56, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("datetime"))) { - ZEPHIR_INIT_NVAR(&_80$$57); - ZVAL_LONG(&_80$$57, 4); - zephir_array_update_string(&definition, SL("type"), &_80$$57, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("date"))) { - ZEPHIR_INIT_NVAR(&_81$$58); - ZVAL_LONG(&_81$$58, 1); - zephir_array_update_string(&definition, SL("type"), &_81$$58, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("decimal"))) { - ZEPHIR_INIT_NVAR(&_82$$59); - ZVAL_LONG(&_82$$59, 3); - zephir_array_update_string(&definition, SL("type"), &_82$$59, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("double"))) { - ZEPHIR_INIT_NVAR(&_83$$60); - ZVAL_LONG(&_83$$60, 9); - zephir_array_update_string(&definition, SL("type"), &_83$$60, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_84$$60); - ZVAL_LONG(&_84$$60, 32); - zephir_array_update_string(&definition, SL("bindType"), &_84$$60, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("float"))) { - ZEPHIR_INIT_NVAR(&_85$$61); - ZVAL_LONG(&_85$$61, 7); - zephir_array_update_string(&definition, SL("type"), &_85$$61, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_86$$61); - ZVAL_LONG(&_86$$61, 32); - zephir_array_update_string(&definition, SL("bindType"), &_86$$61, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("mediumblob"))) { - ZEPHIR_INIT_NVAR(&_87$$62); - ZVAL_LONG(&_87$$62, 12); - zephir_array_update_string(&definition, SL("type"), &_87$$62, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("longblob"))) { - ZEPHIR_INIT_NVAR(&_88$$63); - ZVAL_LONG(&_88$$63, 13); - zephir_array_update_string(&definition, SL("type"), &_88$$63, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("tinyblob"))) { - ZEPHIR_INIT_NVAR(&_89$$64); - ZVAL_LONG(&_89$$64, 10); - zephir_array_update_string(&definition, SL("type"), &_89$$64, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("blob"))) { - ZEPHIR_INIT_NVAR(&_90$$65); - ZVAL_LONG(&_90$$65, 11); - zephir_array_update_string(&definition, SL("type"), &_90$$65, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("timestamp"))) { - ZEPHIR_INIT_NVAR(&_91$$66); - ZVAL_LONG(&_91$$66, 17); - zephir_array_update_string(&definition, SL("type"), &_91$$66, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("time"))) { - ZEPHIR_INIT_NVAR(&_92$$67); - ZVAL_LONG(&_92$$67, 20); - zephir_array_update_string(&definition, SL("type"), &_92$$67, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("json"))) { - ZEPHIR_INIT_NVAR(&_93$$68); - ZVAL_LONG(&_93$$68, 15); - zephir_array_update_string(&definition, SL("type"), &_93$$68, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("longtext"))) { - ZEPHIR_INIT_NVAR(&_94$$69); - ZVAL_LONG(&_94$$69, 24); - zephir_array_update_string(&definition, SL("type"), &_94$$69, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("mediumtext"))) { - ZEPHIR_INIT_NVAR(&_95$$70); - ZVAL_LONG(&_95$$70, 23); - zephir_array_update_string(&definition, SL("type"), &_95$$70, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("tinytext"))) { - ZEPHIR_INIT_NVAR(&_96$$71); - ZVAL_LONG(&_96$$71, 25); - zephir_array_update_string(&definition, SL("type"), &_96$$71, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("text"))) { - ZEPHIR_INIT_NVAR(&_97$$72); - ZVAL_LONG(&_97$$72, 6); - zephir_array_update_string(&definition, SL("type"), &_97$$72, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("varchar"))) { - ZEPHIR_INIT_NVAR(&_98$$73); - ZVAL_LONG(&_98$$73, 2); - zephir_array_update_string(&definition, SL("type"), &_98$$73, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("char"))) { - ZEPHIR_INIT_NVAR(&_99$$74); - ZVAL_LONG(&_99$$74, 5); - zephir_array_update_string(&definition, SL("type"), &_99$$74, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("varbinary"))) { - ZEPHIR_INIT_NVAR(&_100$$75); - ZVAL_LONG(&_100$$75, 26); - zephir_array_update_string(&definition, SL("type"), &_100$$75, PH_COPY | PH_SEPARATE); - break; - } - if (_66$$49 == zephir_start_with_str(&columnType, SL("binary"))) { - ZEPHIR_INIT_NVAR(&_101$$76); - ZVAL_LONG(&_101$$76, 26); - zephir_array_update_string(&definition, SL("type"), &_101$$76, PH_COPY | PH_SEPARATE); - break; - } - ZEPHIR_INIT_NVAR(&_102$$77); - ZVAL_LONG(&_102$$77, 2); - zephir_array_update_string(&definition, SL("type"), &_102$$77, PH_COPY | PH_SEPARATE); - break; - } while(0); - - if (zephir_memnstr_str(&columnType, SL("("), "phalcon/Db/Adapter/Pdo/Mysql.zep", 417)) { - ZEPHIR_INIT_NVAR(&matches); - ZVAL_NULL(&matches); - zephir_array_fetch_string(&_103$$78, &definition, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 420); - ZEPHIR_INIT_NVAR(&_104$$78); - zephir_preg_match(&_104$$78, &sizePattern, &columnType, &matches, 0, 0 , 0 ); - if (ZEPHIR_IS_LONG(&_103$$78, 18)) { - ZVAL_LONG(&_105$$79, 5); - ZVAL_LONG(&_106$$79, -1); - ZEPHIR_INIT_NVAR(&_107$$79); - zephir_substr(&_107$$79, &columnType, 5 , -1 , 0); - zephir_array_update_string(&definition, SL("size"), &_107$$79, PH_COPY | PH_SEPARATE); - } else if (zephir_is_true(&_104$$78)) { - ZEPHIR_OBS_NVAR(&matchOne); - if (zephir_array_isset_long_fetch(&matchOne, &matches, 1, 0)) { - ZEPHIR_INIT_NVAR(&_108$$81); - ZVAL_LONG(&_108$$81, zephir_get_intval(&matchOne)); - zephir_array_update_string(&definition, SL("size"), &_108$$81, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&matchTwo); - if (zephir_array_isset_long_fetch(&matchTwo, &matches, 2, 0)) { - ZEPHIR_INIT_NVAR(&_109$$82); - ZVAL_LONG(&_109$$82, zephir_get_intval(&matchTwo)); - zephir_array_update_string(&definition, SL("scale"), &_109$$82, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_memnstr_str(&columnType, SL("unsigned"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 436)) { - zephir_array_update_string(&definition, SL("unsigned"), &__$true, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_110$$49, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 452); - if (ZEPHIR_IS_STRING(&_110$$49, "PRI")) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_111$$49, &field, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 459); - if (ZEPHIR_IS_STRING(&_111$$49, "YES")) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_112$$49, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 466); - if (ZEPHIR_IS_STRING(&_112$$49, "auto_increment")) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_113$$49, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 473); - if (Z_TYPE_P(&_113$$49) != IS_NULL) { - zephir_array_fetch_long(&_114$$89, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 474); - if (zephir_memnstr_str(&_114$$89, SL("on update"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 474)) { - zephir_array_fetch_long(&_115$$90, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 475); - zephir_array_fetch_long(&_116$$90, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 475); - ZEPHIR_INIT_NVAR(&_117$$90); - ZEPHIR_CONCAT_VSV(&_117$$90, &_115$$90, " ", &_116$$90); - zephir_array_update_string(&definition, SL("default"), &_117$$90, PH_COPY | PH_SEPARATE); - } else { - zephir_array_fetch_long(&_118$$91, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 477); - zephir_array_update_string(&definition, SL("default"), &_118$$91, PH_COPY | PH_SEPARATE); - } - } else { - zephir_array_fetch_long(&_119$$92, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 480); - if (zephir_memnstr_str(&_119$$92, SL("on update"), "phalcon/Db/Adapter/Pdo/Mysql.zep", 480)) { - zephir_array_fetch_long(&_120$$93, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 481); - ZEPHIR_INIT_NVAR(&_121$$93); - ZEPHIR_CONCAT_SV(&_121$$93, "NULL ", &_120$$93); - zephir_array_update_string(&definition, SL("default"), &_121$$93, PH_COPY | PH_SEPARATE); - } - } - zephir_array_fetch_long(&_122$$49, &field, 8, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 488); - if (Z_TYPE_P(&_122$$49) != IS_NULL) { - zephir_array_fetch_long(&_123$$94, &field, 8, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 489); - zephir_array_update_string(&definition, SL("comment"), &_123$$94, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&columnName); - zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 495); - ZEPHIR_INIT_NVAR(&_124$$49); - object_init_ex(&_124$$49, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_124$$49, "__construct", &_64, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_124$$49, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 496); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - ZEPHIR_CALL_METHOD(NULL, &fields, "next", NULL, 0); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&join); + zephir_create_array(&join, 4, 0); + zephir_array_fast_append(&join, &model); + zephir_array_fast_append(&join, conditions); + zephir_array_fast_append(&join, alias); + zephir_array_fast_append(&join, type); + ZEPHIR_OBS_VAR(¤tJoins); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(¤tJoins, &_0, SL("joins"), 0)) { + if (Z_TYPE_P(¤tJoins) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_1$$4); + zephir_create_array(&_1$$4, 1, 0); + zephir_array_fast_append(&_1$$4, &join); + ZEPHIR_INIT_VAR(&mergedJoins); + zephir_fast_array_merge(&mergedJoins, ¤tJoins, &_1$$4); + } else { + ZEPHIR_INIT_VAR(&_2$$5); + zephir_create_array(&_2$$5, 1, 0); + zephir_array_fast_append(&_2$$5, &join); + ZEPHIR_CPY_WRT(&mergedJoins, &_2$$5); } + } else { + ZEPHIR_INIT_VAR(&_3$$6); + zephir_create_array(&_3$$6, 1, 0); + zephir_array_fast_append(&_3$$6, &join); + ZEPHIR_CPY_WRT(&mergedJoins, &_3$$6); } - ZEPHIR_INIT_NVAR(&field); - RETURN_CCTOR(&columns); + ZEPHIR_INIT_VAR(&_4); + ZVAL_STRING(&_4, "joins"); + zephir_update_property_array(this_ptr, SL("params"), &_4, &mergedJoins); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, leftJoin) { - zend_string *_27; - zend_ulong _26; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_31 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, indexes, index, keyName, indexType, indexObjects, columns, name, _0, _1, _2, _3, *_4, _5, *_24, _25, _6$$4, _7$$3, _9$$3, _10$$3, _8$$6, _11$$7, _12$$8, _13$$9, _14$$10, _15$$12, _16$$11, _18$$11, _19$$11, _17$$14, _20$$15, _21$$16, _22$$17, _23$$18, _28$$19, _29$$19, _30$$19, _32$$20, _33$$20, _34$$20; - zval table, schema; + zval *model_param = NULL, *conditions = NULL, conditions_sub, *alias = NULL, alias_sub, __$null, _0; + zval model; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&indexType); - ZVAL_UNDEF(&indexObjects); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&conditions_sub); + ZVAL_UNDEF(&alias_sub); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_25); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_13$$9); - ZVAL_UNDEF(&_14$$10); - ZVAL_UNDEF(&_15$$12); - ZVAL_UNDEF(&_16$$11); - ZVAL_UNDEF(&_18$$11); - ZVAL_UNDEF(&_19$$11); - ZVAL_UNDEF(&_17$$14); - ZVAL_UNDEF(&_20$$15); - ZVAL_UNDEF(&_21$$16); - ZVAL_UNDEF(&_22$$17); - ZVAL_UNDEF(&_23$$18); - ZVAL_UNDEF(&_28$$19); - ZVAL_UNDEF(&_29$$19); - ZVAL_UNDEF(&_30$$19); - ZVAL_UNDEF(&_32$$20); - ZVAL_UNDEF(&_33$$20); - ZVAL_UNDEF(&_34$$20); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(model) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(conditions) + Z_PARAM_ZVAL_OR_NULL(alias) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 1, 2, &model_param, &conditions, &alias); + if (UNEXPECTED(Z_TYPE_P(model_param) != IS_STRING && Z_TYPE_P(model_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'model' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (EXPECTED(Z_TYPE_P(model_param) == IS_STRING)) { + zephir_get_strval(&model, model_param); } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&model); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); - } else { - ZEPHIR_INIT_VAR(&schema); + if (!conditions) { + conditions = &conditions_sub; + conditions = &__$null; } + if (!alias) { + alias = &alias_sub; + alias = &__$null; } - ZEPHIR_INIT_VAR(&indexes); - array_init(&indexes); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describeindexes", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 2); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "LEFT"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "join", NULL, 0, &model, conditions, alias, &_0); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/Pdo/Mysql.zep", 546); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _4); - zephir_array_fetch_string(&keyName, &index, SL("Key_name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 519); - zephir_array_fetch_string(&indexType, &index, SL("Index_type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 520); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&_6$$4); - array_init(&_6$$4); - zephir_array_update_zval(&indexes, &keyName, &_6$$4, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch(&_7$$3, &indexes, &keyName, PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 526); - if (!(zephir_array_isset_string(&_7$$3, SL("columns")))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - } else { - zephir_array_fetch(&_8$$6, &indexes, &keyName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 529); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_8$$6, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 529); - } - zephir_array_fetch_string(&_9$$3, &index, SL("Column_name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 532); - zephir_array_append(&columns, &_9$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 532); - zephir_array_update_multi(&indexes, &columns, SL("zs"), 3, &keyName, SL("columns")); - zephir_array_fetch_string(&_10$$3, &index, SL("Non_unique"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 539); - if (ZEPHIR_IS_STRING(&keyName, "PRIMARY")) { - ZEPHIR_INIT_NVAR(&_11$$7); - ZVAL_STRING(&_11$$7, "PRIMARY"); - zephir_array_update_multi(&indexes, &_11$$7, SL("zs"), 3, &keyName, SL("type")); - } else if (ZEPHIR_IS_STRING(&indexType, "FULLTEXT")) { - ZEPHIR_INIT_NVAR(&_12$$8); - ZVAL_STRING(&_12$$8, "FULLTEXT"); - zephir_array_update_multi(&indexes, &_12$$8, SL("zs"), 3, &keyName, SL("type")); - } else if (ZEPHIR_IS_LONG(&_10$$3, 0)) { - ZEPHIR_INIT_NVAR(&_13$$9); - ZVAL_STRING(&_13$$9, "UNIQUE"); - zephir_array_update_multi(&indexes, &_13$$9, SL("zs"), 3, &keyName, SL("type")); - } else { - ZEPHIR_INIT_NVAR(&_14$$10); - ZVAL_STRING(&_14$$10, ""); - zephir_array_update_multi(&indexes, &_14$$10, SL("zs"), 3, &keyName, SL("type")); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&index, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&keyName); - zephir_array_fetch_string(&keyName, &index, SL("Key_name"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 519); - ZEPHIR_OBS_NVAR(&indexType); - zephir_array_fetch_string(&indexType, &index, SL("Index_type"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 520); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&_15$$12); - array_init(&_15$$12); - zephir_array_update_zval(&indexes, &keyName, &_15$$12, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch(&_16$$11, &indexes, &keyName, PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 526); - if (!(zephir_array_isset_string(&_16$$11, SL("columns")))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - } else { - zephir_array_fetch(&_17$$14, &indexes, &keyName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 529); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_17$$14, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 529); - } - zephir_array_fetch_string(&_18$$11, &index, SL("Column_name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 532); - zephir_array_append(&columns, &_18$$11, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 532); - zephir_array_update_multi(&indexes, &columns, SL("zs"), 3, &keyName, SL("columns")); - zephir_array_fetch_string(&_19$$11, &index, SL("Non_unique"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 539); - if (ZEPHIR_IS_STRING(&keyName, "PRIMARY")) { - ZEPHIR_INIT_NVAR(&_20$$15); - ZVAL_STRING(&_20$$15, "PRIMARY"); - zephir_array_update_multi(&indexes, &_20$$15, SL("zs"), 3, &keyName, SL("type")); - } else if (ZEPHIR_IS_STRING(&indexType, "FULLTEXT")) { - ZEPHIR_INIT_NVAR(&_21$$16); - ZVAL_STRING(&_21$$16, "FULLTEXT"); - zephir_array_update_multi(&indexes, &_21$$16, SL("zs"), 3, &keyName, SL("type")); - } else if (ZEPHIR_IS_LONG(&_19$$11, 0)) { - ZEPHIR_INIT_NVAR(&_22$$17); - ZVAL_STRING(&_22$$17, "UNIQUE"); - zephir_array_update_multi(&indexes, &_22$$17, SL("zs"), 3, &keyName, SL("type")); - } else { - ZEPHIR_INIT_NVAR(&_23$$18); - ZVAL_STRING(&_23$$18, ""); - zephir_array_update_multi(&indexes, &_23$$18, SL("zs"), 3, &keyName, SL("type")); - } - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - ZEPHIR_INIT_VAR(&indexObjects); - array_init(&indexObjects); - zephir_is_iterable(&indexes, 0, "phalcon/Db/Adapter/Pdo/Mysql.zep", 556); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&indexes), _26, _27, _24) - { - ZEPHIR_INIT_NVAR(&name); - if (_27 != NULL) { - ZVAL_STR_COPY(&name, _27); - } else { - ZVAL_LONG(&name, _26); - } - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _24); - ZEPHIR_INIT_NVAR(&_28$$19); - object_init_ex(&_28$$19, phalcon_db_index_ce); - zephir_array_fetch_string(&_29$$19, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 551); - zephir_array_fetch_string(&_30$$19, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 553); - ZEPHIR_CALL_METHOD(NULL, &_28$$19, "__construct", &_31, 30, &name, &_29$$19, &_30$$19); - zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_28$$19, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_25, &indexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_25)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &indexes, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&index, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_32$$20); - object_init_ex(&_32$$20, phalcon_db_index_ce); - zephir_array_fetch_string(&_33$$20, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 551); - zephir_array_fetch_string(&_34$$20, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 553); - ZEPHIR_CALL_METHOD(NULL, &_32$$20, "__construct", &_31, 30, &name, &_33$$20, &_34$$20); - zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_32$$20, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&indexObjects); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeReferences) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit) { - zval _14$$3, _23$$6, _29$$9, _33$$10; - zend_string *_27; - zend_ulong _26; + zval _5$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_31 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, references, reference, arrayReference, constraintName, referenceObjects, name, referencedSchema, referencedTable, columns, referencedColumns, referenceUpdate, referenceDelete, _0, _1, _2, _3, *_4, _5, *_24, _25, _6$$5, _7$$5, _8$$5, _9$$5, _10$$5, _11$$5, _12$$3, _13$$3, _15$$8, _16$$8, _17$$8, _18$$8, _19$$8, _20$$8, _21$$6, _22$$6, _28$$9, _30$$9, _32$$10, _34$$10; - zval table, schema; + zval *limit_param = NULL, *offset_param = NULL, _0, _1, _2, _3$$4, _4$$4, _6$$5; + zend_long limit, offset, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&arrayReference); - ZVAL_UNDEF(&constraintName); - ZVAL_UNDEF(&referenceObjects); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&referencedSchema); - ZVAL_UNDEF(&referencedTable); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&referencedColumns); - ZVAL_UNDEF(&referenceUpdate); - ZVAL_UNDEF(&referenceDelete); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_25); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_18$$8); - ZVAL_UNDEF(&_19$$8); - ZVAL_UNDEF(&_20$$8); - ZVAL_UNDEF(&_21$$6); - ZVAL_UNDEF(&_22$$6); - ZVAL_UNDEF(&_28$$9); - ZVAL_UNDEF(&_30$$9); - ZVAL_UNDEF(&_32$$10); - ZVAL_UNDEF(&_34$$10); - ZVAL_UNDEF(&_14$$3); - ZVAL_UNDEF(&_23$$6); - ZVAL_UNDEF(&_29$$9); - ZVAL_UNDEF(&_33$$10); + ZVAL_UNDEF(&_5$$5); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + Z_PARAM_LONG(limit) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + zephir_fetch_params(1, 1, 1, &limit_param, &offset_param); + limit = zephir_get_intval(limit_param); + if (!offset_param) { + offset = 0; } else { - ZEPHIR_INIT_VAR(&table); + offset = zephir_get_intval(offset_param); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); - RETURN_MM_NULL(); + + + ZVAL_LONG(&_0, limit); + ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 283, &_0); + zephir_check_call_status(); + limit = zephir_get_numberval(&_1); + ZVAL_LONG(&_0, offset); + ZEPHIR_CALL_FUNCTION(&_2, "abs", NULL, 283, &_0); + zephir_check_call_status(); + offset = zephir_get_numberval(&_2); + if (UNEXPECTED(limit == 0)) { + RETURN_THIS(); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); + if (offset == 0) { + ZEPHIR_INIT_VAR(&_3$$4); + ZVAL_STRING(&_3$$4, "limit"); + ZEPHIR_INIT_VAR(&_4$$4); + ZVAL_LONG(&_4$$4, limit); + zephir_update_property_array(this_ptr, SL("params"), &_3$$4, &_4$$4); } else { - ZEPHIR_INIT_VAR(&schema); - } + ZEPHIR_INIT_VAR(&_5$$5); + zephir_create_array(&_5$$5, 2, 0); + ZEPHIR_INIT_VAR(&_6$$5); + ZVAL_LONG(&_6$$5, limit); + zephir_array_update_string(&_5$$5, SL("number"), &_6$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_6$$5); + ZVAL_LONG(&_6$$5, offset); + zephir_array_update_string(&_5$$5, SL("offset"), &_6$$5, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_6$$5); + ZVAL_STRING(&_6$$5, "limit"); + zephir_update_property_array(this_ptr, SL("params"), &_6$$5, &_5$$5); } + RETURN_THIS(); +} +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, notBetweenWhere) +{ + zval _3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *expr_param = NULL, *minimum, minimum_sub, *maximum, maximum_sub, hiddenParam, nextHiddenParam, _0, _1; + zval expr, minimumKey, maximumKey, _2; + zval *this_ptr = getThis(); - ZEPHIR_INIT_VAR(&references); - array_init(&references); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describereferences", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); - zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/Pdo/Mysql.zep", 609); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _4); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 578); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 581); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 582); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_long(&referenceUpdate, &reference, 6, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 583); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_long(&referenceDelete, &reference, 7, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 584); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_6$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 588); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_6$$5, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 588); - zephir_array_fetch(&_7$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 589); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_7$$5, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 589); - zephir_array_fetch(&_8$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 590); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_8$$5, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 590); - zephir_array_fetch(&_9$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 591); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_9$$5, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 591); - zephir_array_fetch(&_10$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 592); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_string(&referenceUpdate, &_10$$5, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 592); - zephir_array_fetch(&_11$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 593); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_string(&referenceDelete, &_11$$5, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 593); - } - zephir_array_fetch_long(&_12$$3, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 596); - zephir_array_append(&columns, &_12$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 596); - zephir_array_fetch_long(&_13$$3, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 597); - zephir_array_append(&referencedColumns, &_13$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 597); - ZEPHIR_INIT_NVAR(&_14$$3); - zephir_create_array(&_14$$3, 6, 0); - zephir_array_update_string(&_14$$3, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("onUpdate"), &referenceUpdate, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("onDelete"), &referenceDelete, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_14$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + ZVAL_UNDEF(&expr); + ZVAL_UNDEF(&minimumKey); + ZVAL_UNDEF(&maximumKey); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&minimum_sub); + ZVAL_UNDEF(&maximum_sub); + ZVAL_UNDEF(&hiddenParam); + ZVAL_UNDEF(&nextHiddenParam); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_STR(expr) + Z_PARAM_ZVAL(minimum) + Z_PARAM_ZVAL(maximum) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &expr_param, &minimum, &maximum); + if (UNEXPECTED(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(expr_param) == IS_STRING)) { + zephir_get_strval(&expr, expr_param); } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&constraintName); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 578); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 581); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 582); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_long(&referenceUpdate, &reference, 6, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 583); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_long(&referenceDelete, &reference, 7, PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 584); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_15$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 588); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_15$$8, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 588); - zephir_array_fetch(&_16$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 589); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_16$$8, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 589); - zephir_array_fetch(&_17$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 590); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_17$$8, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 590); - zephir_array_fetch(&_18$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 591); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_18$$8, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 591); - zephir_array_fetch(&_19$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 592); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_string(&referenceUpdate, &_19$$8, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 592); - zephir_array_fetch(&_20$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 593); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_string(&referenceDelete, &_20$$8, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 593); - } - zephir_array_fetch_long(&_21$$6, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 596); - zephir_array_append(&columns, &_21$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 596); - zephir_array_fetch_long(&_22$$6, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 597); - zephir_array_append(&referencedColumns, &_22$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Mysql.zep", 597); - ZEPHIR_INIT_NVAR(&_23$$6); - zephir_create_array(&_23$$6, 6, 0); - zephir_array_update_string(&_23$$6, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("onUpdate"), &referenceUpdate, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("onDelete"), &referenceDelete, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_23$$6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_INIT_VAR(&expr); } - ZEPHIR_INIT_NVAR(&reference); - ZEPHIR_INIT_VAR(&referenceObjects); - array_init(&referenceObjects); - zephir_is_iterable(&references, 0, "phalcon/Db/Adapter/Pdo/Mysql.zep", 624); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&references), _26, _27, _24) + + + ZEPHIR_OBS_VAR(&hiddenParam); + zephir_read_property(&hiddenParam, this_ptr, ZEND_STRL("hiddenParamNumber"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(&nextHiddenParam); + ZVAL_LONG(&nextHiddenParam, (zephir_get_numberval(&hiddenParam) + 1)); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_SV(&_0, "ACP", &hiddenParam); + zephir_get_strval(&minimumKey, &_0); + ZEPHIR_INIT_VAR(&_1); + ZEPHIR_CONCAT_SV(&_1, "ACP", &nextHiddenParam); + zephir_get_strval(&maximumKey, &_1); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSVSVS(&_2, &expr, " NOT BETWEEN :", &minimumKey, ": AND :", &maximumKey, ":"); + ZEPHIR_INIT_VAR(&_3); + zephir_create_array(&_3, 2, 0); + zephir_array_update_zval(&_3, &minimumKey, minimum, PH_COPY); + zephir_array_update_zval(&_3, &maximumKey, maximum, PH_COPY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, &_2, &_3); + zephir_check_call_status(); + ZEPHIR_SEPARATE(&nextHiddenParam); + zephir_increment(&nextHiddenParam); + zephir_update_property_zval(this_ptr, ZEND_STRL("hiddenParamNumber"), &nextHiddenParam); + RETURN_THIS(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, notInWhere) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval values, bindParams, bindKeys; + zval *expr_param = NULL, *values_param = NULL, hiddenParam, value, *_0, _1, _6, _7, _2$$3, _4$$4; + zval expr, key, _3$$3, _5$$4; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&expr); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&hiddenParam); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&values); + ZVAL_UNDEF(&bindParams); + ZVAL_UNDEF(&bindKeys); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(expr) + Z_PARAM_ARRAY(values) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &expr_param, &values_param); + if (UNEXPECTED(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(expr_param) == IS_STRING)) { + zephir_get_strval(&expr, expr_param); + } else { + ZEPHIR_INIT_VAR(&expr); + } + ZEPHIR_OBS_COPY_OR_DUP(&values, values_param); + + + ZEPHIR_OBS_VAR(&hiddenParam); + zephir_read_property(&hiddenParam, this_ptr, ZEND_STRL("hiddenParamNumber"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(&bindParams); + array_init(&bindParams); + ZEPHIR_INIT_VAR(&bindKeys); + array_init(&bindKeys); + zephir_is_iterable(&values, 0, "phalcon/Mvc/Model/Criteria.zep", 742); + if (Z_TYPE_P(&values) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&values), _0) { - ZEPHIR_INIT_NVAR(&name); - if (_27 != NULL) { - ZVAL_STR_COPY(&name, _27); - } else { - ZVAL_LONG(&name, _26); - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZVAL_COPY(&arrayReference, _24); - ZEPHIR_INIT_NVAR(&_28$$9); - object_init_ex(&_28$$9, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_29$$9); - zephir_create_array(&_29$$9, 6, 0); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 614); - zephir_array_update_string(&_29$$9, SL("referencedSchema"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 615); - zephir_array_update_string(&_29$$9, SL("referencedTable"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 616); - zephir_array_update_string(&_29$$9, SL("columns"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 617); - zephir_array_update_string(&_29$$9, SL("referencedColumns"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 618); - zephir_array_update_string(&_29$$9, SL("onUpdate"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 620); - zephir_array_update_string(&_29$$9, SL("onDelete"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 31, &name, &_29$$9); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_28$$9, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _0); + ZEPHIR_INIT_NVAR(&_2$$3); + ZEPHIR_CONCAT_SV(&_2$$3, "ACP", &hiddenParam); + zephir_get_strval(&key, &_2$$3); + ZEPHIR_INIT_NVAR(&_3$$3); + ZEPHIR_CONCAT_SVS(&_3$$3, ":", &key, ":"); + zephir_array_append(&bindKeys, &_3$$3, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 732); + zephir_array_update_zval(&bindParams, &key, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_SEPARATE(&hiddenParam); + zephir_increment(&hiddenParam); } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_25, &references, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1, &values, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_25)) { + if (!zend_is_true(&_1)) { break; } - ZEPHIR_CALL_METHOD(&name, &references, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&arrayReference, &references, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&value, &values, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_32$$10); - object_init_ex(&_32$$10, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_33$$10); - zephir_create_array(&_33$$10, 6, 0); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 614); - zephir_array_update_string(&_33$$10, SL("referencedSchema"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 615); - zephir_array_update_string(&_33$$10, SL("referencedTable"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 616); - zephir_array_update_string(&_33$$10, SL("columns"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 617); - zephir_array_update_string(&_33$$10, SL("referencedColumns"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 618); - zephir_array_update_string(&_33$$10, SL("onUpdate"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Mysql.zep", 620); - zephir_array_update_string(&_33$$10, SL("onDelete"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 31, &name, &_33$$10); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); + ZEPHIR_INIT_NVAR(&_4$$4); + ZEPHIR_CONCAT_SV(&_4$$4, "ACP", &hiddenParam); + zephir_get_strval(&key, &_4$$4); + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_CONCAT_SVS(&_5$$4, ":", &key, ":"); + zephir_array_append(&bindKeys, &_5$$4, PH_SEPARATE, "phalcon/Mvc/Model/Criteria.zep", 732); + zephir_array_update_zval(&bindParams, &key, &value, PH_COPY | PH_SEPARATE); + ZEPHIR_SEPARATE(&hiddenParam); + zephir_increment(&hiddenParam); + ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&arrayReference); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&referenceObjects); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_VAR(&_6); + zephir_fast_join_str(&_6, SL(", "), &bindKeys); + ZEPHIR_INIT_VAR(&_7); + ZEPHIR_CONCAT_VSVS(&_7, &expr, " NOT IN (", &_6, ")"); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, &_7, &bindParams); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("hiddenParamNumber"), &hiddenParam); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, getDsnDefaults) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, orderBy) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *orderColumns_param = NULL, _0; + zval orderColumns; zval *this_ptr = getThis(); - - - zephir_create_array(return_value, 1, 0); - add_assoc_stringl_ex(return_value, SL("charset"), SL("utf8mb4")); - return; -} - - - - -#ifdef HAVE_CONFIG_H + ZVAL_UNDEF(&orderColumns); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(orderColumns) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &orderColumns_param); + if (UNEXPECTED(Z_TYPE_P(orderColumns_param) != IS_STRING && Z_TYPE_P(orderColumns_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'orderColumns' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(orderColumns_param) == IS_STRING)) { + zephir_get_strval(&orderColumns, orderColumns_param); + } else { + ZEPHIR_INIT_VAR(&orderColumns); + } - -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo_Postgresql) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter\\Pdo, Postgresql, phalcon, db_adapter_pdo_postgresql, phalcon_db_adapter_pdo_abstractpdo_ce, phalcon_db_adapter_pdo_postgresql_method_entry, 0); - - zend_declare_property_string(phalcon_db_adapter_pdo_postgresql_ce, SL("dialectType"), "postgresql", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_db_adapter_pdo_postgresql_ce, SL("type"), "pgsql", ZEND_ACC_PROTECTED); - return SUCCESS; + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "order"); + zephir_update_property_array(this_ptr, SL("params"), &_0, &orderColumns); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, __construct) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, orWhere) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL, _0$$3; - zval descriptor; + zval *conditions_param = NULL, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null, currentConditions, _0, _1$$3; + zval conditions; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&bindParams_sub); + ZVAL_UNDEF(&bindTypes_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(¤tConditions); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(descriptor) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(conditions) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(bindParams) + Z_PARAM_ZVAL_OR_NULL(bindTypes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); + zephir_fetch_params(1, 1, 2, &conditions_param, &bindParams, &bindTypes); + if (UNEXPECTED(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(conditions_param) == IS_STRING)) { + zephir_get_strval(&conditions, conditions_param); + } else { + ZEPHIR_INIT_VAR(&conditions); + } + if (!bindParams) { + bindParams = &bindParams_sub; + bindParams = &__$null; + } + if (!bindTypes) { + bindTypes = &bindTypes_sub; + bindTypes = &__$null; + } - if (zephir_array_isset_string(&descriptor, SL("charset"))) { - ZEPHIR_INIT_VAR(&_0$$3); - ZVAL_STRING(&_0$$3, "Postgres does not allow the charset to be changed in the DSN."); - ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 7, &_0$$3); - zephir_check_call_status(); + ZEPHIR_OBS_VAR(¤tConditions); + zephir_read_property(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(¤tConditions, &_0, SL("conditions"), 0)) { + ZEPHIR_INIT_VAR(&_1$$3); + ZEPHIR_CONCAT_SVSVS(&_1$$3, "(", ¤tConditions, ") OR (", &conditions, ")"); + zephir_get_strval(&conditions, &_1$$3); } - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_postgresql_ce, getThis(), "__construct", &_1, 0, &descriptor); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "where", NULL, 0, &conditions, bindParams, bindTypes); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, connect) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, rightJoin) { - zend_bool _2$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_4 = NULL; - zval *descriptor_param = NULL, __$null, schema, sql, _0$$3, _1$$6, _3$$6; - zval descriptor; + zval *model_param = NULL, *conditions = NULL, conditions_sub, *alias = NULL, alias_sub, __$null, _0; + zval model; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); + ZVAL_UNDEF(&model); + ZVAL_UNDEF(&conditions_sub); + ZVAL_UNDEF(&alias_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_3$$6); + ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(model) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(descriptor) + Z_PARAM_ZVAL_OR_NULL(conditions) + Z_PARAM_ZVAL_OR_NULL(alias) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &descriptor_param); - if (!descriptor_param) { - ZEPHIR_INIT_VAR(&descriptor); - array_init(&descriptor); - } else { - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); - } - - - if (ZEPHIR_IS_EMPTY(&descriptor)) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("descriptor"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&descriptor, &_0$$3); + zephir_fetch_params(1, 1, 2, &model_param, &conditions, &alias); + if (UNEXPECTED(Z_TYPE_P(model_param) != IS_STRING && Z_TYPE_P(model_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'model' must be of the type string")); + RETURN_MM_NULL(); } - ZEPHIR_OBS_VAR(&schema); - if (zephir_array_isset_string_fetch(&schema, &descriptor, SL("schema"), 0)) { - zephir_array_unset_string(&descriptor, SL("schema"), PH_SEPARATE); + if (EXPECTED(Z_TYPE_P(model_param) == IS_STRING)) { + zephir_get_strval(&model, model_param); } else { - ZEPHIR_INIT_NVAR(&schema); - ZVAL_NULL(&schema); + ZEPHIR_INIT_VAR(&model); } - if (zephir_array_isset_string(&descriptor, SL("password"))) { - ZEPHIR_OBS_VAR(&_1$$6); - zephir_array_fetch_string(&_1$$6, &descriptor, SL("password"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 85); - _2$$6 = Z_TYPE_P(&_1$$6) == IS_STRING; - if (_2$$6) { - zephir_array_fetch_string(&_3$$6, &descriptor, SL("password"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 85); - _2$$6 = zephir_fast_strlen_ev(&_3$$6) == 0; - } - if (_2$$6) { - zephir_array_update_string(&descriptor, SL("password"), &__$null, PH_COPY | PH_SEPARATE); - } + if (!conditions) { + conditions = &conditions_sub; + conditions = &__$null; } - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_postgresql_ce, getThis(), "connect", &_4, 0, &descriptor); - zephir_check_call_status(); - if (!(ZEPHIR_IS_EMPTY(&schema))) { - ZEPHIR_INIT_VAR(&sql); - ZEPHIR_CONCAT_SVS(&sql, "SET search_path TO '", &schema, "'"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "execute", NULL, 0, &sql); - zephir_check_call_status(); + if (!alias) { + alias = &alias_sub; + alias = &__$null; } - ZEPHIR_MM_RESTORE(); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "RIGHT"); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "join", NULL, 0, &model, conditions, alias, &_0); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, createTable) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, setDI) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval definition; - zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, sql, queries, query, exception, columns, _0, *_1$$6, _2$$6, _3$$7, _5$$9, _6$$5, _7$$12, _8$$12; - zval tableName, schemaName; + zval *container, container_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&queries); - ZVAL_UNDEF(&query); - ZVAL_UNDEF(&exception); - ZVAL_UNDEF(&columns); + ZVAL_UNDEF(&container_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$6); - ZVAL_UNDEF(&_3$$7); - ZVAL_UNDEF(&_5$$9); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$12); - ZVAL_UNDEF(&_8$$12); - ZVAL_UNDEF(&definition); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_ARRAY(definition) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(container, phalcon_di_diinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); - } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); + zephir_fetch_params(1, 1, 0, &container); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "di"); + zephir_update_property_array(this_ptr, SL("params"), &_0, container); + ZEPHIR_MM_RESTORE(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, setModelName) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *modelName_param = NULL; + zval modelName; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&modelName); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(modelName) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &modelName_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_INIT_VAR(&schemaName); + ZEPHIR_INIT_VAR(&modelName); } - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/Db/Adapter/Pdo/Postgresql.zep", 107); - return; - } - if (UNEXPECTED(!(zephir_fast_count_int(&columns)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/Db/Adapter/Pdo/Postgresql.zep", 111); - return; - } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&sql, &_0, "createtable", NULL, 0, &tableName, &schemaName, &definition); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&queries); - zephir_fast_explode_str(&queries, SL(";"), &sql, LONG_MAX); - if (zephir_fast_count_int(&queries) > 1) { + zephir_update_property_zval(this_ptr, ZEND_STRL("model"), &modelName); + RETURN_THIS(); +} - /* try_start_1: */ +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, sharedLock) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *sharedLock_param = NULL, _0, _1; + zend_bool sharedLock; + zval *this_ptr = getThis(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); - zephir_check_call_status_or_jump(try_end_1); - zephir_is_iterable(&queries, 0, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 130); - if (Z_TYPE_P(&queries) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&queries), _1$$6) - { - ZEPHIR_INIT_NVAR(&query); - ZVAL_COPY(&query, _1$$6); - if (ZEPHIR_IS_EMPTY(&query)) { - continue; - } - ZEPHIR_INIT_NVAR(&_3$$7); - ZEPHIR_CONCAT_VS(&_3$$7, &query, ";"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_4, 0, &_3$$7); - zephir_check_call_status_or_jump(try_end_1); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &queries, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$6, &queries, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$6)) { - break; - } - ZEPHIR_CALL_METHOD(&query, &queries, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(&query)) { - continue; - } - ZEPHIR_INIT_NVAR(&_5$$9); - ZEPHIR_CONCAT_VS(&_5$$9, &query, ";"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_4, 0, &_5$$9); - zephir_check_call_status_or_jump(try_end_1); - ZEPHIR_CALL_METHOD(NULL, &queries, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&query); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); - zephir_check_call_status_or_jump(try_end_1); - RETURN_MM(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(sharedLock) + ZEND_PARSE_PARAMETERS_END(); +#endif - try_end_1: - if (EG(exception)) { - ZEPHIR_INIT_VAR(&_6$$5); - ZVAL_OBJ(&_6$$5, EG(exception)); - Z_ADDREF_P(&_6$$5); - if (zephir_is_instance_of(&_6$$5, SL("Throwable"))) { - zend_clear_exception(); - ZEPHIR_CPY_WRT(&exception, &_6$$5); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); - zephir_check_call_status(); - zephir_throw_exception_debug(&exception, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 134); - ZEPHIR_MM_RESTORE(); - return; - } - } + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &sharedLock_param); + if (!sharedLock_param) { + sharedLock = 1; } else { - zephir_array_fetch_long(&_7$$12, &queries, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 137); - ZEPHIR_INIT_VAR(&_8$$12); - ZEPHIR_CONCAT_VS(&_8$$12, &_7$$12, ";"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, &_8$$12); - zephir_check_call_status(); - RETURN_MM(); + sharedLock = zephir_get_boolval(sharedLock_param); } - RETURN_MM_BOOL(1); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "shared_lock"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_BOOL(&_1, sharedLock); + zephir_update_property_array(this_ptr, SL("params"), &_0, &_1); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns) +static PHP_METHOD(Phalcon_Mvc_Model_Criteria, where) { - zend_bool _5$$3, _64$$41; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_55 = NULL, *_58 = NULL, *_62 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, __$true, __$false, __$null, columns, columnType, fields, field, definition, oldColumn, columnName, charSize, numericSize, numericScale, _0, _1, _2, *_3, _4, _47$$3, _48$$3, _49$$3, _50$$3, _59$$3, _61$$3, _6$$4, _7$$4, _8$$5, _9$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$11, _20$$12, _21$$12, _22$$13, _23$$13, _24$$14, _25$$14, _26$$15, _27$$15, _28$$16, _29$$16, _30$$17, _31$$18, _32$$19, _33$$20, _34$$21, _35$$22, _36$$23, _37$$24, _38$$25, _39$$26, _40$$27, _41$$28, _42$$29, _43$$30, _44$$31, _45$$31, _46$$32, _51$$38, _52$$38, _53$$38, _54$$38, _56$$38, _57$$38, _60$$40, _63$$41, _106$$41, _107$$41, _108$$41, _109$$41, _116$$41, _118$$41, _65$$42, _66$$42, _67$$43, _68$$43, _69$$44, _70$$44, _71$$45, _72$$45, _73$$46, _74$$46, _75$$47, _76$$47, _77$$48, _78$$49, _79$$50, _80$$50, _81$$51, _82$$51, _83$$52, _84$$52, _85$$53, _86$$53, _87$$54, _88$$54, _89$$55, _90$$56, _91$$57, _92$$58, _93$$59, _94$$60, _95$$61, _96$$62, _97$$63, _98$$64, _99$$65, _100$$66, _101$$67, _102$$68, _103$$69, _104$$69, _105$$70, _110$$76, _111$$76, _112$$76, _113$$76, _114$$76, _115$$76, _117$$78; - zval table, schema; + zval *conditions_param = NULL, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null, currentBindParams, currentBindTypes, _0, _1$$3, _2$$4, _3$$4, _4$$5, _5$$6, _6$$7, _7$$7, _8$$8; + zval conditions; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&conditions); + ZVAL_UNDEF(&bindParams_sub); + ZVAL_UNDEF(&bindTypes_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&oldColumn); - ZVAL_UNDEF(&columnName); - ZVAL_UNDEF(&charSize); - ZVAL_UNDEF(&numericSize); - ZVAL_UNDEF(&numericScale); + ZVAL_UNDEF(¤tBindParams); + ZVAL_UNDEF(¤tBindTypes); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_47$$3); - ZVAL_UNDEF(&_48$$3); - ZVAL_UNDEF(&_49$$3); - ZVAL_UNDEF(&_50$$3); - ZVAL_UNDEF(&_59$$3); - ZVAL_UNDEF(&_61$$3); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$6); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_13$$7); - ZVAL_UNDEF(&_14$$8); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$9); - ZVAL_UNDEF(&_17$$9); - ZVAL_UNDEF(&_18$$10); - ZVAL_UNDEF(&_19$$11); - ZVAL_UNDEF(&_20$$12); - ZVAL_UNDEF(&_21$$12); - ZVAL_UNDEF(&_22$$13); - ZVAL_UNDEF(&_23$$13); - ZVAL_UNDEF(&_24$$14); - ZVAL_UNDEF(&_25$$14); - ZVAL_UNDEF(&_26$$15); - ZVAL_UNDEF(&_27$$15); - ZVAL_UNDEF(&_28$$16); - ZVAL_UNDEF(&_29$$16); - ZVAL_UNDEF(&_30$$17); - ZVAL_UNDEF(&_31$$18); - ZVAL_UNDEF(&_32$$19); - ZVAL_UNDEF(&_33$$20); - ZVAL_UNDEF(&_34$$21); - ZVAL_UNDEF(&_35$$22); - ZVAL_UNDEF(&_36$$23); - ZVAL_UNDEF(&_37$$24); - ZVAL_UNDEF(&_38$$25); - ZVAL_UNDEF(&_39$$26); - ZVAL_UNDEF(&_40$$27); - ZVAL_UNDEF(&_41$$28); - ZVAL_UNDEF(&_42$$29); - ZVAL_UNDEF(&_43$$30); - ZVAL_UNDEF(&_44$$31); - ZVAL_UNDEF(&_45$$31); - ZVAL_UNDEF(&_46$$32); - ZVAL_UNDEF(&_51$$38); - ZVAL_UNDEF(&_52$$38); - ZVAL_UNDEF(&_53$$38); - ZVAL_UNDEF(&_54$$38); - ZVAL_UNDEF(&_56$$38); - ZVAL_UNDEF(&_57$$38); - ZVAL_UNDEF(&_60$$40); - ZVAL_UNDEF(&_63$$41); - ZVAL_UNDEF(&_106$$41); - ZVAL_UNDEF(&_107$$41); - ZVAL_UNDEF(&_108$$41); - ZVAL_UNDEF(&_109$$41); - ZVAL_UNDEF(&_116$$41); - ZVAL_UNDEF(&_118$$41); - ZVAL_UNDEF(&_65$$42); - ZVAL_UNDEF(&_66$$42); - ZVAL_UNDEF(&_67$$43); - ZVAL_UNDEF(&_68$$43); - ZVAL_UNDEF(&_69$$44); - ZVAL_UNDEF(&_70$$44); - ZVAL_UNDEF(&_71$$45); - ZVAL_UNDEF(&_72$$45); - ZVAL_UNDEF(&_73$$46); - ZVAL_UNDEF(&_74$$46); - ZVAL_UNDEF(&_75$$47); - ZVAL_UNDEF(&_76$$47); - ZVAL_UNDEF(&_77$$48); - ZVAL_UNDEF(&_78$$49); - ZVAL_UNDEF(&_79$$50); - ZVAL_UNDEF(&_80$$50); - ZVAL_UNDEF(&_81$$51); - ZVAL_UNDEF(&_82$$51); - ZVAL_UNDEF(&_83$$52); - ZVAL_UNDEF(&_84$$52); - ZVAL_UNDEF(&_85$$53); - ZVAL_UNDEF(&_86$$53); - ZVAL_UNDEF(&_87$$54); - ZVAL_UNDEF(&_88$$54); - ZVAL_UNDEF(&_89$$55); - ZVAL_UNDEF(&_90$$56); - ZVAL_UNDEF(&_91$$57); - ZVAL_UNDEF(&_92$$58); - ZVAL_UNDEF(&_93$$59); - ZVAL_UNDEF(&_94$$60); - ZVAL_UNDEF(&_95$$61); - ZVAL_UNDEF(&_96$$62); - ZVAL_UNDEF(&_97$$63); - ZVAL_UNDEF(&_98$$64); - ZVAL_UNDEF(&_99$$65); - ZVAL_UNDEF(&_100$$66); - ZVAL_UNDEF(&_101$$67); - ZVAL_UNDEF(&_102$$68); - ZVAL_UNDEF(&_103$$69); - ZVAL_UNDEF(&_104$$69); - ZVAL_UNDEF(&_105$$70); - ZVAL_UNDEF(&_110$$76); - ZVAL_UNDEF(&_111$$76); - ZVAL_UNDEF(&_112$$76); - ZVAL_UNDEF(&_113$$76); - ZVAL_UNDEF(&_114$$76); - ZVAL_UNDEF(&_115$$76); - ZVAL_UNDEF(&_117$$78); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_5$$6); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&_7$$7); + ZVAL_UNDEF(&_8$$8); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(conditions) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + Z_PARAM_ZVAL_OR_NULL(bindParams) + Z_PARAM_ZVAL_OR_NULL(bindTypes) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - zephir_get_strval(&table, table_param); - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + zephir_fetch_params(1, 1, 2, &conditions_param, &bindParams, &bindTypes); + if (UNEXPECTED(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(conditions_param) == IS_STRING)) { + zephir_get_strval(&conditions, conditions_param); } else { - zephir_get_strval(&schema, schema_param); + ZEPHIR_INIT_VAR(&conditions); + } + if (!bindParams) { + bindParams = &bindParams_sub; + bindParams = &__$null; + } + if (!bindTypes) { + bindTypes = &bindTypes_sub; + bindTypes = &__$null; } - ZEPHIR_INIT_VAR(&oldColumn); - ZVAL_NULL(&oldColumn); - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "describecolumns", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_2, 3); - ZEPHIR_CALL_METHOD(&fields, this_ptr, "fetchall", NULL, 0, &_1, &_2); - zephir_check_call_status(); - zephir_is_iterable(&fields, 0, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 529); - if (Z_TYPE_P(&fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&fields), _3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _3); - ZEPHIR_INIT_NVAR(&definition); - zephir_create_array(&definition, 1, 0); - add_assoc_long_ex(&definition, SL("bindType"), 2); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 182); - ZEPHIR_OBS_NVAR(&charSize); - zephir_array_fetch_long(&charSize, &field, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 183); - ZEPHIR_OBS_NVAR(&numericSize); - zephir_array_fetch_long(&numericSize, &field, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 184); - ZEPHIR_OBS_NVAR(&numericScale); - zephir_array_fetch_long(&numericScale, &field, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 185); - do { - _5$$3 = 1; - if (_5$$3 == zephir_memnstr_str(&columnType, SL("boolean"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 203)) { - ZEPHIR_INIT_NVAR(&_6$$4); - ZVAL_LONG(&_6$$4, 8); - zephir_array_update_string(&definition, SL("type"), &_6$$4, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_7$$4); - ZVAL_LONG(&_7$$4, 5); - zephir_array_update_string(&definition, SL("bindType"), &_7$$4, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("bigint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 215)) { - ZEPHIR_INIT_NVAR(&_8$$5); - ZVAL_LONG(&_8$$5, 14); - zephir_array_update_string(&definition, SL("type"), &_8$$5, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_9$$5); - ZVAL_LONG(&_9$$5, 2); - zephir_array_update_string(&definition, SL("bindType"), &_9$$5, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("mediumint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 225)) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZVAL_LONG(&_10$$6, 21); - zephir_array_update_string(&definition, SL("type"), &_10$$6, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_11$$6); - ZVAL_LONG(&_11$$6, 1); - zephir_array_update_string(&definition, SL("bindType"), &_11$$6, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("smallint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 235)) { - ZEPHIR_INIT_NVAR(&_12$$7); - ZVAL_LONG(&_12$$7, 22); - zephir_array_update_string(&definition, SL("type"), &_12$$7, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_13$$7); - ZVAL_LONG(&_13$$7, 1); - zephir_array_update_string(&definition, SL("bindType"), &_13$$7, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("tinyint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 245)) { - ZEPHIR_INIT_NVAR(&_14$$8); - ZVAL_LONG(&_14$$8, 26); - zephir_array_update_string(&definition, SL("type"), &_14$$8, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_15$$8); - ZVAL_LONG(&_15$$8, 1); - zephir_array_update_string(&definition, SL("bindType"), &_15$$8, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("int"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 258)) { - ZEPHIR_INIT_NVAR(&_16$$9); - ZVAL_LONG(&_16$$9, 0); - zephir_array_update_string(&definition, SL("type"), &_16$$9, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_17$$9); - ZVAL_LONG(&_17$$9, 1); - zephir_array_update_string(&definition, SL("bindType"), &_17$$9, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("bit"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 268)) { - ZEPHIR_INIT_NVAR(&_18$$10); - ZVAL_LONG(&_18$$10, 19); - zephir_array_update_string(&definition, SL("type"), &_18$$10, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("enum"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 277)) { - ZEPHIR_INIT_NVAR(&_19$$11); - ZVAL_LONG(&_19$$11, 18); - zephir_array_update_string(&definition, SL("type"), &_19$$11, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("datetime"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 285)) { - ZEPHIR_INIT_NVAR(&_20$$12); - ZVAL_LONG(&_20$$12, 4); - zephir_array_update_string(&definition, SL("type"), &_20$$12, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_21$$12); - ZVAL_LONG(&_21$$12, 0); - zephir_array_update_string(&definition, SL("size"), &_21$$12, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("date"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 294)) { - ZEPHIR_INIT_NVAR(&_22$$13); - ZVAL_LONG(&_22$$13, 1); - zephir_array_update_string(&definition, SL("type"), &_22$$13, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_23$$13); - ZVAL_LONG(&_23$$13, 0); - zephir_array_update_string(&definition, SL("size"), &_23$$13, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("decimal"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 304) || _5$$3 == zephir_memnstr_str(&columnType, SL("numeric"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 305)) { - ZEPHIR_INIT_NVAR(&_24$$14); - ZVAL_LONG(&_24$$14, 3); - zephir_array_update_string(&definition, SL("type"), &_24$$14, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_25$$14); - ZVAL_LONG(&_25$$14, 32); - zephir_array_update_string(&definition, SL("bindType"), &_25$$14, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("double precision"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 316)) { - ZEPHIR_INIT_NVAR(&_26$$15); - ZVAL_LONG(&_26$$15, 9); - zephir_array_update_string(&definition, SL("type"), &_26$$15, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_27$$15); - ZVAL_LONG(&_27$$15, 32); - zephir_array_update_string(&definition, SL("bindType"), &_27$$15, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("float"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 327) || _5$$3 == zephir_memnstr_str(&columnType, SL("real"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 328)) { - ZEPHIR_INIT_NVAR(&_28$$16); - ZVAL_LONG(&_28$$16, 7); - zephir_array_update_string(&definition, SL("type"), &_28$$16, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_29$$16); - ZVAL_LONG(&_29$$16, 32); - zephir_array_update_string(&definition, SL("bindType"), &_29$$16, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("mediumblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 339)) { - ZEPHIR_INIT_NVAR(&_30$$17); - ZVAL_LONG(&_30$$17, 6); - zephir_array_update_string(&definition, SL("type"), &_30$$17, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("longblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 347)) { - ZEPHIR_INIT_NVAR(&_31$$18); - ZVAL_LONG(&_31$$18, 13); - zephir_array_update_string(&definition, SL("type"), &_31$$18, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("tinyblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 355)) { - ZEPHIR_INIT_NVAR(&_32$$19); - ZVAL_LONG(&_32$$19, 10); - zephir_array_update_string(&definition, SL("type"), &_32$$19, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("blob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 363)) { - ZEPHIR_INIT_NVAR(&_33$$20); - ZVAL_LONG(&_33$$20, 11); - zephir_array_update_string(&definition, SL("type"), &_33$$20, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("timestamp"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 371)) { - ZEPHIR_INIT_NVAR(&_34$$21); - ZVAL_LONG(&_34$$21, 17); - zephir_array_update_string(&definition, SL("type"), &_34$$21, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("time"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 379)) { - ZEPHIR_INIT_NVAR(&_35$$22); - ZVAL_LONG(&_35$$22, 20); - zephir_array_update_string(&definition, SL("type"), &_35$$22, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("jsonb"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 387)) { - ZEPHIR_INIT_NVAR(&_36$$23); - ZVAL_LONG(&_36$$23, 16); - zephir_array_update_string(&definition, SL("type"), &_36$$23, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("json"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 395)) { - ZEPHIR_INIT_NVAR(&_37$$24); - ZVAL_LONG(&_37$$24, 15); - zephir_array_update_string(&definition, SL("type"), &_37$$24, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("longtext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 403)) { - ZEPHIR_INIT_NVAR(&_38$$25); - ZVAL_LONG(&_38$$25, 24); - zephir_array_update_string(&definition, SL("type"), &_38$$25, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("mediumtext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 411)) { - ZEPHIR_INIT_NVAR(&_39$$26); - ZVAL_LONG(&_39$$26, 23); - zephir_array_update_string(&definition, SL("type"), &_39$$26, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("tinytext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 419)) { - ZEPHIR_INIT_NVAR(&_40$$27); - ZVAL_LONG(&_40$$27, 25); - zephir_array_update_string(&definition, SL("type"), &_40$$27, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("text"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 427)) { - ZEPHIR_INIT_NVAR(&_41$$28); - ZVAL_LONG(&_41$$28, 6); - zephir_array_update_string(&definition, SL("type"), &_41$$28, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("varying"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 435) || _5$$3 == zephir_memnstr_str(&columnType, SL("varchar"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 436)) { - ZEPHIR_INIT_NVAR(&_42$$29); - ZVAL_LONG(&_42$$29, 2); - zephir_array_update_string(&definition, SL("type"), &_42$$29, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("char"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 445)) { - ZEPHIR_INIT_NVAR(&_43$$30); - ZVAL_LONG(&_43$$30, 5); - zephir_array_update_string(&definition, SL("type"), &_43$$30, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); - break; - } - if (_5$$3 == zephir_memnstr_str(&columnType, SL("uuid"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 454)) { - ZEPHIR_INIT_NVAR(&_44$$31); - ZVAL_LONG(&_44$$31, 5); - zephir_array_update_string(&definition, SL("type"), &_44$$31, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_45$$31); - ZVAL_LONG(&_45$$31, 36); - zephir_array_update_string(&definition, SL("size"), &_45$$31, PH_COPY | PH_SEPARATE); - break; - } - ZEPHIR_INIT_NVAR(&_46$$32); - ZVAL_LONG(&_46$$32, 2); - zephir_array_update_string(&definition, SL("type"), &_46$$32, PH_COPY | PH_SEPARATE); - break; - } while(0); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "conditions"); + zephir_update_property_array(this_ptr, SL("params"), &_0, &conditions); + if (Z_TYPE_P(bindParams) == IS_ARRAY) { + ZEPHIR_OBS_VAR(¤tBindParams); + zephir_read_property(&_1$$3, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(¤tBindParams, &_1$$3, SL("bind"), 0)) { + ZEPHIR_INIT_VAR(&_2$$4); + zephir_fast_array_merge(&_2$$4, ¤tBindParams, bindParams); + ZEPHIR_INIT_VAR(&_3$$4); + ZVAL_STRING(&_3$$4, "bind"); + zephir_update_property_array(this_ptr, SL("params"), &_3$$4, &_2$$4); + } else { + ZEPHIR_INIT_VAR(&_4$$5); + ZVAL_STRING(&_4$$5, "bind"); + zephir_update_property_array(this_ptr, SL("params"), &_4$$5, bindParams); + } + } + if (Z_TYPE_P(bindTypes) == IS_ARRAY) { + ZEPHIR_OBS_VAR(¤tBindTypes); + zephir_read_property(&_5$$6, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_string_fetch(¤tBindTypes, &_5$$6, SL("bindTypes"), 0)) { + ZEPHIR_INIT_VAR(&_6$$7); + zephir_fast_array_merge(&_6$$7, ¤tBindTypes, bindTypes); + ZEPHIR_INIT_VAR(&_7$$7); + ZVAL_STRING(&_7$$7, "bindTypes"); + zephir_update_property_array(this_ptr, SL("params"), &_7$$7, &_6$$7); + } else { + ZEPHIR_INIT_VAR(&_8$$8); + ZVAL_STRING(&_8$$8, "bindTypes"); + zephir_update_property_array(this_ptr, SL("params"), &_8$$8, bindTypes); + } + } + RETURN_THIS(); +} - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_47$$3, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 481); - if (ZEPHIR_IS_STRING(&_47$$3, "PRI")) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_48$$3, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 488); - if (ZEPHIR_IS_STRING(&_48$$3, "YES")) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_49$$3, &field, 7, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 495); - if (ZEPHIR_IS_STRING(&_49$$3, "auto_increment")) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_50$$3, &field, 9, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 502); - if (Z_TYPE_P(&_50$$3) != IS_NULL) { - zephir_array_fetch_long(&_51$$38, &field, 9, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 507); - ZEPHIR_INIT_NVAR(&_52$$38); - ZVAL_STRING(&_52$$38, "/^'|'?::[[:alnum:][:space:]]+$/"); - ZEPHIR_INIT_NVAR(&_53$$38); - ZVAL_STRING(&_53$$38, ""); - ZEPHIR_CALL_FUNCTION(&_54$$38, "preg_replace", &_55, 37, &_52$$38, &_53$$38, &_51$$38); - zephir_check_call_status(); - zephir_array_update_string(&definition, SL("default"), &_54$$38, PH_COPY | PH_SEPARATE); - zephir_array_fetch_string(&_56$$38, &definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 509); - ZEPHIR_INIT_NVAR(&_52$$38); - ZVAL_STRING(&_52$$38, "null"); - ZEPHIR_CALL_FUNCTION(&_57$$38, "strcasecmp", &_58, 35, &_56$$38, &_52$$38); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_57$$38, 0)) { - zephir_array_update_string(&definition, SL("default"), &__$null, PH_COPY | PH_SEPARATE); - } - } - zephir_array_fetch_long(&_59$$3, &field, 10, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 517); - if (Z_TYPE_P(&_59$$3) != IS_NULL) { - zephir_array_fetch_long(&_60$$40, &field, 10, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 518); - zephir_array_update_string(&definition, SL("comment"), &_60$$40, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 524); - ZEPHIR_INIT_NVAR(&_61$$3); - object_init_ex(&_61$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_61$$3, "__construct", &_62, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_61$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 525); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &fields, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&field, &fields, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_63$$41); - zephir_create_array(&_63$$41, 1, 0); - add_assoc_long_ex(&_63$$41, SL("bindType"), 2); - ZEPHIR_CPY_WRT(&definition, &_63$$41); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 182); - ZEPHIR_OBS_NVAR(&charSize); - zephir_array_fetch_long(&charSize, &field, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 183); - ZEPHIR_OBS_NVAR(&numericSize); - zephir_array_fetch_long(&numericSize, &field, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 184); - ZEPHIR_OBS_NVAR(&numericScale); - zephir_array_fetch_long(&numericScale, &field, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 185); - do { - _64$$41 = 1; - if (_64$$41 == zephir_memnstr_str(&columnType, SL("boolean"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 203)) { - ZEPHIR_INIT_NVAR(&_65$$42); - ZVAL_LONG(&_65$$42, 8); - zephir_array_update_string(&definition, SL("type"), &_65$$42, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_66$$42); - ZVAL_LONG(&_66$$42, 5); - zephir_array_update_string(&definition, SL("bindType"), &_66$$42, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("bigint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 215)) { - ZEPHIR_INIT_NVAR(&_67$$43); - ZVAL_LONG(&_67$$43, 14); - zephir_array_update_string(&definition, SL("type"), &_67$$43, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_68$$43); - ZVAL_LONG(&_68$$43, 2); - zephir_array_update_string(&definition, SL("bindType"), &_68$$43, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("mediumint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 225)) { - ZEPHIR_INIT_NVAR(&_69$$44); - ZVAL_LONG(&_69$$44, 21); - zephir_array_update_string(&definition, SL("type"), &_69$$44, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_70$$44); - ZVAL_LONG(&_70$$44, 1); - zephir_array_update_string(&definition, SL("bindType"), &_70$$44, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("smallint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 235)) { - ZEPHIR_INIT_NVAR(&_71$$45); - ZVAL_LONG(&_71$$45, 22); - zephir_array_update_string(&definition, SL("type"), &_71$$45, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_72$$45); - ZVAL_LONG(&_72$$45, 1); - zephir_array_update_string(&definition, SL("bindType"), &_72$$45, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("tinyint"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 245)) { - ZEPHIR_INIT_NVAR(&_73$$46); - ZVAL_LONG(&_73$$46, 26); - zephir_array_update_string(&definition, SL("type"), &_73$$46, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_74$$46); - ZVAL_LONG(&_74$$46, 1); - zephir_array_update_string(&definition, SL("bindType"), &_74$$46, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("int"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 258)) { - ZEPHIR_INIT_NVAR(&_75$$47); - ZVAL_LONG(&_75$$47, 0); - zephir_array_update_string(&definition, SL("type"), &_75$$47, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_76$$47); - ZVAL_LONG(&_76$$47, 1); - zephir_array_update_string(&definition, SL("bindType"), &_76$$47, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("bit"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 268)) { - ZEPHIR_INIT_NVAR(&_77$$48); - ZVAL_LONG(&_77$$48, 19); - zephir_array_update_string(&definition, SL("type"), &_77$$48, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("enum"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 277)) { - ZEPHIR_INIT_NVAR(&_78$$49); - ZVAL_LONG(&_78$$49, 18); - zephir_array_update_string(&definition, SL("type"), &_78$$49, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("datetime"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 285)) { - ZEPHIR_INIT_NVAR(&_79$$50); - ZVAL_LONG(&_79$$50, 4); - zephir_array_update_string(&definition, SL("type"), &_79$$50, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_80$$50); - ZVAL_LONG(&_80$$50, 0); - zephir_array_update_string(&definition, SL("size"), &_80$$50, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("date"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 294)) { - ZEPHIR_INIT_NVAR(&_81$$51); - ZVAL_LONG(&_81$$51, 1); - zephir_array_update_string(&definition, SL("type"), &_81$$51, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_82$$51); - ZVAL_LONG(&_82$$51, 0); - zephir_array_update_string(&definition, SL("size"), &_82$$51, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("decimal"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 304) || _64$$41 == zephir_memnstr_str(&columnType, SL("numeric"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 305)) { - ZEPHIR_INIT_NVAR(&_83$$52); - ZVAL_LONG(&_83$$52, 3); - zephir_array_update_string(&definition, SL("type"), &_83$$52, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_84$$52); - ZVAL_LONG(&_84$$52, 32); - zephir_array_update_string(&definition, SL("bindType"), &_84$$52, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("double precision"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 316)) { - ZEPHIR_INIT_NVAR(&_85$$53); - ZVAL_LONG(&_85$$53, 9); - zephir_array_update_string(&definition, SL("type"), &_85$$53, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_86$$53); - ZVAL_LONG(&_86$$53, 32); - zephir_array_update_string(&definition, SL("bindType"), &_86$$53, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("float"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 327) || _64$$41 == zephir_memnstr_str(&columnType, SL("real"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 328)) { - ZEPHIR_INIT_NVAR(&_87$$54); - ZVAL_LONG(&_87$$54, 7); - zephir_array_update_string(&definition, SL("type"), &_87$$54, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &numericSize, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_88$$54); - ZVAL_LONG(&_88$$54, 32); - zephir_array_update_string(&definition, SL("bindType"), &_88$$54, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("mediumblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 339)) { - ZEPHIR_INIT_NVAR(&_89$$55); - ZVAL_LONG(&_89$$55, 6); - zephir_array_update_string(&definition, SL("type"), &_89$$55, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("longblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 347)) { - ZEPHIR_INIT_NVAR(&_90$$56); - ZVAL_LONG(&_90$$56, 13); - zephir_array_update_string(&definition, SL("type"), &_90$$56, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("tinyblob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 355)) { - ZEPHIR_INIT_NVAR(&_91$$57); - ZVAL_LONG(&_91$$57, 10); - zephir_array_update_string(&definition, SL("type"), &_91$$57, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("blob"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 363)) { - ZEPHIR_INIT_NVAR(&_92$$58); - ZVAL_LONG(&_92$$58, 11); - zephir_array_update_string(&definition, SL("type"), &_92$$58, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("timestamp"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 371)) { - ZEPHIR_INIT_NVAR(&_93$$59); - ZVAL_LONG(&_93$$59, 17); - zephir_array_update_string(&definition, SL("type"), &_93$$59, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("time"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 379)) { - ZEPHIR_INIT_NVAR(&_94$$60); - ZVAL_LONG(&_94$$60, 20); - zephir_array_update_string(&definition, SL("type"), &_94$$60, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("jsonb"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 387)) { - ZEPHIR_INIT_NVAR(&_95$$61); - ZVAL_LONG(&_95$$61, 16); - zephir_array_update_string(&definition, SL("type"), &_95$$61, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("json"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 395)) { - ZEPHIR_INIT_NVAR(&_96$$62); - ZVAL_LONG(&_96$$62, 15); - zephir_array_update_string(&definition, SL("type"), &_96$$62, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("longtext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 403)) { - ZEPHIR_INIT_NVAR(&_97$$63); - ZVAL_LONG(&_97$$63, 24); - zephir_array_update_string(&definition, SL("type"), &_97$$63, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("mediumtext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 411)) { - ZEPHIR_INIT_NVAR(&_98$$64); - ZVAL_LONG(&_98$$64, 23); - zephir_array_update_string(&definition, SL("type"), &_98$$64, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("tinytext"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 419)) { - ZEPHIR_INIT_NVAR(&_99$$65); - ZVAL_LONG(&_99$$65, 25); - zephir_array_update_string(&definition, SL("type"), &_99$$65, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("text"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 427)) { - ZEPHIR_INIT_NVAR(&_100$$66); - ZVAL_LONG(&_100$$66, 6); - zephir_array_update_string(&definition, SL("type"), &_100$$66, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("varying"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 435) || _64$$41 == zephir_memnstr_str(&columnType, SL("varchar"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 436)) { - ZEPHIR_INIT_NVAR(&_101$$67); - ZVAL_LONG(&_101$$67, 2); - zephir_array_update_string(&definition, SL("type"), &_101$$67, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("char"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 445)) { - ZEPHIR_INIT_NVAR(&_102$$68); - ZVAL_LONG(&_102$$68, 5); - zephir_array_update_string(&definition, SL("type"), &_102$$68, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("size"), &charSize, PH_COPY | PH_SEPARATE); - break; - } - if (_64$$41 == zephir_memnstr_str(&columnType, SL("uuid"), "phalcon/Db/Adapter/Pdo/Postgresql.zep", 454)) { - ZEPHIR_INIT_NVAR(&_103$$69); - ZVAL_LONG(&_103$$69, 5); - zephir_array_update_string(&definition, SL("type"), &_103$$69, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_104$$69); - ZVAL_LONG(&_104$$69, 36); - zephir_array_update_string(&definition, SL("size"), &_104$$69, PH_COPY | PH_SEPARATE); - break; - } - ZEPHIR_INIT_NVAR(&_105$$70); - ZVAL_LONG(&_105$$70, 2); - zephir_array_update_string(&definition, SL("type"), &_105$$70, PH_COPY | PH_SEPARATE); - break; - } while(0); +zend_object *zephir_init_properties_Phalcon_Mvc_Model_Criteria(zend_class_entry *class_type) +{ + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_106$$41, &field, 6, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 481); - if (ZEPHIR_IS_STRING(&_106$$41, "PRI")) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_107$$41, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 488); - if (ZEPHIR_IS_STRING(&_107$$41, "YES")) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_108$$41, &field, 7, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 495); - if (ZEPHIR_IS_STRING(&_108$$41, "auto_increment")) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_109$$41, &field, 9, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 502); - if (Z_TYPE_P(&_109$$41) != IS_NULL) { - zephir_array_fetch_long(&_110$$76, &field, 9, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 507); - ZEPHIR_INIT_NVAR(&_111$$76); - ZVAL_STRING(&_111$$76, "/^'|'?::[[:alnum:][:space:]]+$/"); - ZEPHIR_INIT_NVAR(&_112$$76); - ZVAL_STRING(&_112$$76, ""); - ZEPHIR_CALL_FUNCTION(&_113$$76, "preg_replace", &_55, 37, &_111$$76, &_112$$76, &_110$$76); - zephir_check_call_status(); - zephir_array_update_string(&definition, SL("default"), &_113$$76, PH_COPY | PH_SEPARATE); - zephir_array_fetch_string(&_114$$76, &definition, SL("default"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 509); - ZEPHIR_INIT_NVAR(&_111$$76); - ZVAL_STRING(&_111$$76, "null"); - ZEPHIR_CALL_FUNCTION(&_115$$76, "strcasecmp", &_58, 35, &_114$$76, &_111$$76); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&_115$$76, 0)) { - zephir_array_update_string(&definition, SL("default"), &__$null, PH_COPY | PH_SEPARATE); - } - } - zephir_array_fetch_long(&_116$$41, &field, 10, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 517); - if (Z_TYPE_P(&_116$$41) != IS_NULL) { - zephir_array_fetch_long(&_117$$78, &field, 10, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 518); - zephir_array_update_string(&definition, SL("comment"), &_117$$78, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&columnName); - zephir_array_fetch_long(&columnName, &field, 0, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 524); - ZEPHIR_INIT_NVAR(&_118$$41); - object_init_ex(&_118$$41, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_118$$41, "__construct", &_62, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_118$$41, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 525); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - ZEPHIR_CALL_METHOD(NULL, &fields, "next", NULL, 0); - zephir_check_call_status(); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("params"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("params"), &_1$$3); } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - ZEPHIR_INIT_NVAR(&field); - RETURN_CCTOR(&columns); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeReferences) + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_CriteriaInterface) +{ + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc\\Model, CriteriaInterface, phalcon, mvc_model_criteriainterface, phalcon_mvc_model_criteriainterface_method_entry); + + return SUCCESS; +} + +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, andWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, betweenWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, bind); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, bindTypes); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, cache); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, conditions); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, distinct); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, execute); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, forUpdate); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getColumns); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getConditions); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getGroupBy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getHaving); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getLimit); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getModelName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getOrderBy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getParams); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, getWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, groupBy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, having); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, innerJoin); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, inWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, leftJoin); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, limit); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, notBetweenWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, notInWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, orderBy); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, orWhere); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, rightJoin); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, setModelName); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, sharedLock); +ZEPHIR_DOC_METHOD(Phalcon_Mvc_Model_CriteriaInterface, where); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Exception) +{ + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model, Exception, phalcon, mvc_model_exception, zend_ce_exception, NULL, 0); + + return SUCCESS; +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Manager) +{ + ZEPHIR_REGISTER_CLASS(Phalcon\\Mvc\\Model, Manager, phalcon, mvc_model_manager, phalcon_mvc_model_manager_method_entry, 0); + + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("aliases"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("behaviors"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("belongsTo"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("belongsToSingle"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("builder"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("container"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("customEventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("dynamicUpdate"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("eventsManager"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasMany"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasManySingle"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasManyToMany"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasManyToManySingle"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasOne"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasOneSingle"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasOneThrough"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("hasOneThroughSingle"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("initialized"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("keepSnapshots"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("lastInitialized"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("lastQuery"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("modelVisibility"), ZEND_ACC_PROTECTED); + zend_declare_property_string(phalcon_mvc_model_manager_ce, SL("prefix"), "", ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("readConnectionServices"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("sources"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("schemas"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("writeConnectionServices"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_mvc_model_manager_ce, SL("reusable"), ZEND_ACC_PROTECTED); + phalcon_mvc_model_manager_ce->create_object = zephir_init_properties_Phalcon_Mvc_Model_Manager; + + zend_class_implements(phalcon_mvc_model_manager_ce, 1, phalcon_mvc_model_managerinterface_ce); + zend_class_implements(phalcon_mvc_model_manager_ce, 1, phalcon_di_injectionawareinterface_ce); + zend_class_implements(phalcon_mvc_model_manager_ce, 1, phalcon_events_eventsawareinterface_ce); + return SUCCESS; +} + +static PHP_METHOD(Phalcon_Mvc_Model_Manager, __destruct) { - zval _14$$3, _23$$6, _29$$9, _33$$10; - zend_string *_27; - zend_ulong _26; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_31 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, references, reference, arrayReference, constraintName, referenceObjects, name, referencedSchema, referencedTable, columns, referencedColumns, referenceUpdate, referenceDelete, _0, _1, _2, _3, *_4, _5, *_24, _25, _6$$5, _7$$5, _8$$5, _9$$5, _10$$5, _11$$5, _12$$3, _13$$3, _15$$8, _16$$8, _17$$8, _18$$8, _19$$8, _20$$8, _21$$6, _22$$6, _28$$9, _30$$9, _32$$10, _34$$10; - zval table, schema; + zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&arrayReference); - ZVAL_UNDEF(&constraintName); - ZVAL_UNDEF(&referenceObjects); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&referencedSchema); - ZVAL_UNDEF(&referencedTable); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&referencedColumns); - ZVAL_UNDEF(&referenceUpdate); - ZVAL_UNDEF(&referenceDelete); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_25); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$5); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_18$$8); - ZVAL_UNDEF(&_19$$8); - ZVAL_UNDEF(&_20$$8); - ZVAL_UNDEF(&_21$$6); - ZVAL_UNDEF(&_22$$6); - ZVAL_UNDEF(&_28$$9); - ZVAL_UNDEF(&_30$$9); - ZVAL_UNDEF(&_32$$10); - ZVAL_UNDEF(&_34$$10); - ZVAL_UNDEF(&_14$$3); - ZVAL_UNDEF(&_23$$6); - ZVAL_UNDEF(&_29$$9); - ZVAL_UNDEF(&_33$$10); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) - ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); - } else { - ZEPHIR_INIT_VAR(&schema); - } - } - - ZEPHIR_INIT_VAR(&references); - array_init(&references); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describereferences", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); + phalcon_orm_destroy_cache(); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_mvc_model_query_ce, "clean", &_0, 0); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 581); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _4); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 550); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 553); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 554); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_long(&referenceUpdate, &reference, 6, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 555); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_long(&referenceDelete, &reference, 7, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 556); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_6$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 560); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_6$$5, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 560); - zephir_array_fetch(&_7$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 561); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_7$$5, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 561); - zephir_array_fetch(&_8$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 562); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_8$$5, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 562); - zephir_array_fetch(&_9$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 563); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_9$$5, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 563); - zephir_array_fetch(&_10$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 564); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_string(&referenceUpdate, &_10$$5, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 564); - zephir_array_fetch(&_11$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 565); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_string(&referenceDelete, &_11$$5, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 565); - } - zephir_array_fetch_long(&_12$$3, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 568); - zephir_array_append(&columns, &_12$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 568); - zephir_array_fetch_long(&_13$$3, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 569); - zephir_array_append(&referencedColumns, &_13$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 569); - ZEPHIR_INIT_NVAR(&_14$$3); - zephir_create_array(&_14$$3, 6, 0); - zephir_array_update_string(&_14$$3, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("onUpdate"), &referenceUpdate, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("onDelete"), &referenceDelete, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_14$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&reference, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&constraintName); - zephir_array_fetch_long(&constraintName, &reference, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 550); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_long(&referencedSchema, &reference, 3, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 553); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 554); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_long(&referenceUpdate, &reference, 6, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 555); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_long(&referenceDelete, &reference, 7, PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 556); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_15$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 560); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_15$$8, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 560); - zephir_array_fetch(&_16$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 561); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_16$$8, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 561); - zephir_array_fetch(&_17$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 562); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_17$$8, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 562); - zephir_array_fetch(&_18$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 563); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_18$$8, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 563); - zephir_array_fetch(&_19$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 564); - ZEPHIR_OBS_NVAR(&referenceUpdate); - zephir_array_fetch_string(&referenceUpdate, &_19$$8, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 564); - zephir_array_fetch(&_20$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 565); - ZEPHIR_OBS_NVAR(&referenceDelete); - zephir_array_fetch_string(&referenceDelete, &_20$$8, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 565); - } - zephir_array_fetch_long(&_21$$6, &reference, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 568); - zephir_array_append(&columns, &_21$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 568); - zephir_array_fetch_long(&_22$$6, &reference, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 569); - zephir_array_append(&referencedColumns, &_22$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 569); - ZEPHIR_INIT_NVAR(&_23$$6); - zephir_create_array(&_23$$6, 6, 0); - zephir_array_update_string(&_23$$6, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("onUpdate"), &referenceUpdate, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_23$$6, SL("onDelete"), &referenceDelete, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_23$$6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reference); - ZEPHIR_INIT_VAR(&referenceObjects); - array_init(&referenceObjects); - zephir_is_iterable(&references, 0, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 597); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&references), _26, _27, _24) - { - ZEPHIR_INIT_NVAR(&name); - if (_27 != NULL) { - ZVAL_STR_COPY(&name, _27); - } else { - ZVAL_LONG(&name, _26); - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZVAL_COPY(&arrayReference, _24); - ZEPHIR_INIT_NVAR(&_28$$9); - object_init_ex(&_28$$9, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_29$$9); - zephir_create_array(&_29$$9, 6, 0); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 587); - zephir_array_update_string(&_29$$9, SL("referencedSchema"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 588); - zephir_array_update_string(&_29$$9, SL("referencedTable"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 589); - zephir_array_update_string(&_29$$9, SL("columns"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 590); - zephir_array_update_string(&_29$$9, SL("referencedColumns"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 591); - zephir_array_update_string(&_29$$9, SL("onUpdate"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_30$$9); - zephir_array_fetch_string(&_30$$9, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 593); - zephir_array_update_string(&_29$$9, SL("onDelete"), &_30$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_28$$9, "__construct", &_31, 31, &name, &_29$$9); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_28$$9, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_25, &references, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_25)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &references, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&arrayReference, &references, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_32$$10); - object_init_ex(&_32$$10, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_33$$10); - zephir_create_array(&_33$$10, 6, 0); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 587); - zephir_array_update_string(&_33$$10, SL("referencedSchema"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 588); - zephir_array_update_string(&_33$$10, SL("referencedTable"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 589); - zephir_array_update_string(&_33$$10, SL("columns"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 590); - zephir_array_update_string(&_33$$10, SL("referencedColumns"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onUpdate"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 591); - zephir_array_update_string(&_33$$10, SL("onUpdate"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_34$$10); - zephir_array_fetch_string(&_34$$10, &arrayReference, SL("onDelete"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 593); - zephir_array_update_string(&_33$$10, SL("onDelete"), &_34$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_32$$10, "__construct", &_31, 31, &name, &_33$$10); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&referenceObjects); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, getDefaultIdValue) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addBehavior) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, *behavior, behavior_sub, entityName, _0, _1$$3; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&behavior_sub); + ZVAL_UNDEF(&entityName); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_OBJECT_OF_CLASS(behavior, phalcon_mvc_model_behaviorinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &model, &behavior); - object_init_ex(return_value, phalcon_db_rawvalue_ce); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "DEFAULT"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); - zephir_check_call_status(); - RETURN_MM(); + + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + zephir_read_property(&_0, this_ptr, ZEND_STRL("behaviors"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset(&_0, &entityName))) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_array(this_ptr, SL("behaviors"), &entityName, &_1$$3); + } + zephir_update_property_array_multi(this_ptr, SL("behaviors"), behavior, SL("za"), 2, &entityName); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, modifyColumn) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addBelongsTo) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *tableName_param = NULL, *schemaName_param = NULL, *column, column_sub, *currentColumn = NULL, currentColumn_sub, __$null, sql, queries, query, exception, _0, *_1$$4, _2$$4, _3$$5, _5$$7, _6$$3, _7$$10, _8$$10, _9$$10; - zval tableName, schemaName; + zval options; + zval referencedModel, keyRelation; + zval *model, model_sub, *fields, fields_sub, *referencedModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, entityName, referencedEntity, relation, relations, alias, lowerAlias, singleRelations, _0, _1, _2, _3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(¤tColumn_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&queries); - ZVAL_UNDEF(&query); - ZVAL_UNDEF(&exception); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&entityName); + ZVAL_UNDEF(&referencedEntity); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&singleRelations); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$10); - ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_9$$10); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&options); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 4) - Z_PARAM_STR(tableName) - Z_PARAM_STR(schemaName) - Z_PARAM_OBJECT_OF_CLASS(column, phalcon_db_columninterface_ce) + ZEND_PARSE_PARAMETERS_START(4, 5) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referencedModel) + Z_PARAM_ZVAL(referencedFields) Z_PARAM_OPTIONAL - Z_PARAM_OBJECT_OF_CLASS_OR_NULL(currentColumn, phalcon_db_columninterface_ce) + Z_PARAM_ARRAY(options) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); - if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be of the type string")); + zephir_fetch_params(1, 4, 1, &model, &fields, &referencedModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referencedModel_param) != IS_STRING && Z_TYPE_P(referencedModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referencedModel' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { - zephir_get_strval(&tableName, tableName_param); + if (EXPECTED(Z_TYPE_P(referencedModel_param) == IS_STRING)) { + zephir_get_strval(&referencedModel, referencedModel_param); } else { - ZEPHIR_INIT_VAR(&tableName); - } - if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be of the type string")); - RETURN_MM_NULL(); + ZEPHIR_INIT_VAR(&referencedModel); } - if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { - zephir_get_strval(&schemaName, schemaName_param); + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); } else { - ZEPHIR_INIT_VAR(&schemaName); - } - if (!currentColumn) { - currentColumn = ¤tColumn_sub; - currentColumn = &__$null; + zephir_get_arrval(&options, options_param); } - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&sql, &_0, "modifycolumn", NULL, 0, &tableName, &schemaName, column, currentColumn); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&queries); - zephir_fast_explode_str(&queries, SL(";"), &sql, LONG_MAX); - if (zephir_fast_count_int(&queries) > 1) { - - /* try_start_1: */ - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); - zephir_check_call_status_or_jump(try_end_1); - zephir_is_iterable(&queries, 0, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 653); - if (Z_TYPE_P(&queries) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&queries), _1$$4) - { - ZEPHIR_INIT_NVAR(&query); - ZVAL_COPY(&query, _1$$4); - if (ZEPHIR_IS_EMPTY(&query)) { - continue; - } - ZEPHIR_INIT_NVAR(&_3$$5); - ZEPHIR_CONCAT_VS(&_3$$5, &query, ";"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_4, 0, &_3$$5); - zephir_check_call_status_or_jump(try_end_1); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &queries, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$4, &queries, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$4)) { - break; - } - ZEPHIR_CALL_METHOD(&query, &queries, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EMPTY(&query)) { - continue; - } - ZEPHIR_INIT_NVAR(&_5$$7); - ZEPHIR_CONCAT_VS(&_5$$7, &query, ";"); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_4, 0, &_5$$7); - zephir_check_call_status_or_jump(try_end_1); - ZEPHIR_CALL_METHOD(NULL, &queries, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&query); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); - zephir_check_call_status_or_jump(try_end_1); - RETURN_MM(); + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + ZEPHIR_INIT_VAR(&referencedEntity); + zephir_fast_strtolower(&referencedEntity, &referencedModel); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSV(&_0, &entityName, "$", &referencedEntity); + zephir_get_strval(&keyRelation, &_0); + ZEPHIR_OBS_VAR(&relations); + zephir_read_property(&_1, this_ptr, ZEND_STRL("belongsTo"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&relations, &_1, &keyRelation, 0))) { + ZEPHIR_INIT_NVAR(&relations); + array_init(&relations); + } + if (Z_TYPE_P(referencedFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(referencedFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 296); + return; + } + } + ZEPHIR_INIT_VAR(&relation); + object_init_ex(&relation, phalcon_mvc_model_relation_ce); + ZVAL_LONG(&_2, 0); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_2, &referencedModel, fields, referencedFields, &options); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&alias); + if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&alias) != IS_STRING)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Relation alias must be a string", "phalcon/Mvc/Model/Manager.zep", 316); + return; + } + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + } else { + ZEPHIR_CPY_WRT(&lowerAlias, &referencedEntity); + } + zephir_array_append(&relations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 329); + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_CONCAT_VSV(&_3, &entityName, "$", &lowerAlias); + zephir_update_property_array(this_ptr, SL("aliases"), &_3, &relation); + zephir_update_property_array(this_ptr, SL("belongsTo"), &keyRelation, &relations); + ZEPHIR_OBS_VAR(&singleRelations); + zephir_read_property(&_2, this_ptr, ZEND_STRL("belongsToSingle"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&singleRelations, &_2, &entityName, 0))) { + ZEPHIR_INIT_NVAR(&singleRelations); + array_init(&singleRelations); + } + zephir_array_append(&singleRelations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 343); + zephir_update_property_array(this_ptr, SL("belongsToSingle"), &entityName, &singleRelations); + RETURN_CCTOR(&relation); +} - try_end_1: +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasMany) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval referencedModel, keyRelation; + zval *model, model_sub, *fields, fields_sub, *referencedModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, entityName, referencedEntity, hasMany, relation, relations, alias, lowerAlias, singleRelations, _0, _1, _2; + zval *this_ptr = getThis(); - if (EG(exception)) { - ZEPHIR_INIT_VAR(&_6$$3); - ZVAL_OBJ(&_6$$3, EG(exception)); - Z_ADDREF_P(&_6$$3); - if (zephir_is_instance_of(&_6$$3, SL("Throwable"))) { - zend_clear_exception(); - ZEPHIR_CPY_WRT(&exception, &_6$$3); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); - zephir_check_call_status(); - zephir_throw_exception_debug(&exception, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 657); - ZEPHIR_MM_RESTORE(); - return; - } - } + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&entityName); + ZVAL_UNDEF(&referencedEntity); + ZVAL_UNDEF(&hasMany); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&singleRelations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(4, 5) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referencedModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 4, 1, &model, &fields, &referencedModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referencedModel_param) != IS_STRING && Z_TYPE_P(referencedModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referencedModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referencedModel_param) == IS_STRING)) { + zephir_get_strval(&referencedModel, referencedModel_param); } else { - ZEPHIR_INIT_VAR(&_7$$10); - if (!(ZEPHIR_IS_EMPTY(&sql))) { - zephir_array_fetch_long(&_8$$10, &queries, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Postgresql.zep", 660); - ZEPHIR_INIT_VAR(&_9$$10); - ZEPHIR_CONCAT_VS(&_9$$10, &_8$$10, ";"); - ZEPHIR_CALL_METHOD(&_7$$10, this_ptr, "execute", NULL, 0, &_9$$10); - zephir_check_call_status(); - } else { - ZVAL_BOOL(&_7$$10, 1); + ZEPHIR_INIT_VAR(&referencedModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + + + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + ZEPHIR_INIT_VAR(&referencedEntity); + zephir_fast_strtolower(&referencedEntity, &referencedModel); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSV(&_0, &entityName, "$", &referencedEntity); + zephir_get_strval(&keyRelation, &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasMany"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&hasMany, &_1); + ZEPHIR_OBS_VAR(&relations); + if (!(zephir_array_isset_fetch(&relations, &hasMany, &keyRelation, 0))) { + ZEPHIR_INIT_NVAR(&relations); + array_init(&relations); + } + if (Z_TYPE_P(referencedFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(referencedFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 392); + return; } - RETURN_CCTOR(&_7$$10); } - RETURN_MM_BOOL(1); + ZEPHIR_INIT_VAR(&relation); + object_init_ex(&relation, phalcon_mvc_model_relation_ce); + ZVAL_LONG(&_1, 2); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&alias); + if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&alias) != IS_STRING)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Relation alias must be a string", "phalcon/Mvc/Model/Manager.zep", 412); + return; + } + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + } else { + ZEPHIR_CPY_WRT(&lowerAlias, &referencedEntity); + } + zephir_array_append(&relations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 425); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSV(&_2, &entityName, "$", &lowerAlias); + zephir_update_property_array(this_ptr, SL("aliases"), &_2, &relation); + zephir_update_property_array(this_ptr, SL("hasMany"), &keyRelation, &relations); + ZEPHIR_OBS_VAR(&singleRelations); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasManySingle"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&singleRelations, &_1, &entityName, 0))) { + ZEPHIR_INIT_NVAR(&singleRelations); + array_init(&singleRelations); + } + zephir_array_append(&singleRelations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 439); + zephir_update_property_array(this_ptr, SL("hasManySingle"), &entityName, &singleRelations); + RETURN_CCTOR(&relation); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, supportSequences) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasManyToMany) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval intermediateModel, referencedModel, keyRelation; + zval *model, model_sub, *fields, fields_sub, *intermediateModel_param = NULL, *intermediateFields, intermediateFields_sub, *intermediateReferencedFields, intermediateReferencedFields_sub, *referencedModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, entityName, referencedEntity, hasManyToMany, relation, relations, alias, lowerAlias, singleRelations, intermediateEntity, _0, _1, _2; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&intermediateFields_sub); + ZVAL_UNDEF(&intermediateReferencedFields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&entityName); + ZVAL_UNDEF(&referencedEntity); + ZVAL_UNDEF(&hasManyToMany); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&singleRelations); + ZVAL_UNDEF(&intermediateEntity); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&intermediateModel); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(7, 8) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(intermediateModel) + Z_PARAM_ZVAL(intermediateFields) + Z_PARAM_ZVAL(intermediateReferencedFields) + Z_PARAM_STR(referencedModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 7, 1, &model, &fields, &intermediateModel_param, &intermediateFields, &intermediateReferencedFields, &referencedModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(intermediateModel_param) != IS_STRING && Z_TYPE_P(intermediateModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'intermediateModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(intermediateModel_param) == IS_STRING)) { + zephir_get_strval(&intermediateModel, intermediateModel_param); + } else { + ZEPHIR_INIT_VAR(&intermediateModel); + } + if (UNEXPECTED(Z_TYPE_P(referencedModel_param) != IS_STRING && Z_TYPE_P(referencedModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referencedModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referencedModel_param) == IS_STRING)) { + zephir_get_strval(&referencedModel, referencedModel_param); + } else { + ZEPHIR_INIT_VAR(&referencedModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } - RETURN_BOOL(1); + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + ZEPHIR_INIT_VAR(&intermediateEntity); + zephir_fast_strtolower(&intermediateEntity, &intermediateModel); + ZEPHIR_INIT_VAR(&referencedEntity); + zephir_fast_strtolower(&referencedEntity, &referencedModel); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSV(&_0, &entityName, "$", &referencedEntity); + zephir_get_strval(&keyRelation, &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasManyToMany"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&hasManyToMany, &_1); + ZEPHIR_OBS_VAR(&relations); + if (!(zephir_array_isset_fetch(&relations, &hasManyToMany, &keyRelation, 0))) { + ZEPHIR_INIT_NVAR(&relations); + array_init(&relations); + } + if (Z_TYPE_P(intermediateFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(intermediateFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 496); + return; + } + } + if (Z_TYPE_P(intermediateReferencedFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(intermediateFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 508); + return; + } + } + ZEPHIR_INIT_VAR(&relation); + object_init_ex(&relation, phalcon_mvc_model_relation_ce); + ZVAL_LONG(&_1, 4); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 443, intermediateFields, &intermediateModel, intermediateReferencedFields); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&alias); + if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { + if (Z_TYPE_P(&alias) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Relation alias must be a string", "phalcon/Mvc/Model/Manager.zep", 537); + return; + } + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + } else { + ZEPHIR_CPY_WRT(&lowerAlias, &referencedEntity); + } + zephir_array_append(&relations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 548); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSV(&_2, &entityName, "$", &lowerAlias); + zephir_update_property_array(this_ptr, SL("aliases"), &_2, &relation); + zephir_update_property_array(this_ptr, SL("hasManyToMany"), &keyRelation, &relations); + ZEPHIR_OBS_VAR(&singleRelations); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasManyToManySingle"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&singleRelations, &_1, &entityName, 0))) { + ZEPHIR_INIT_NVAR(&singleRelations); + array_init(&singleRelations); + } + zephir_array_append(&singleRelations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 570); + zephir_update_property_array(this_ptr, SL("hasManyToManySingle"), &entityName, &singleRelations); + RETURN_CCTOR(&relation); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, useExplicitIdValue) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOne) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval referencedModel, keyRelation; + zval *model, model_sub, *fields, fields_sub, *referencedModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, entityName, referencedEntity, relation, relations, alias, lowerAlias, singleRelations, _0, _1, _2, _3; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&entityName); + ZVAL_UNDEF(&referencedEntity); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&singleRelations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(4, 5) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(referencedModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_BOOL(1); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 4, 1, &model, &fields, &referencedModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(referencedModel_param) != IS_STRING && Z_TYPE_P(referencedModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referencedModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referencedModel_param) == IS_STRING)) { + zephir_get_strval(&referencedModel, referencedModel_param); + } else { + ZEPHIR_INIT_VAR(&referencedModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + + + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + ZEPHIR_INIT_VAR(&referencedEntity); + zephir_fast_strtolower(&referencedEntity, &referencedModel); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSV(&_0, &entityName, "$", &referencedEntity); + zephir_get_strval(&keyRelation, &_0); + ZEPHIR_OBS_VAR(&relations); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasOne"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&relations, &_1, &keyRelation, 0))) { + ZEPHIR_INIT_NVAR(&relations); + array_init(&relations); + } + if (Z_TYPE_P(referencedFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(referencedFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 618); + return; + } + } + ZEPHIR_INIT_VAR(&relation); + object_init_ex(&relation, phalcon_mvc_model_relation_ce); + ZVAL_LONG(&_2, 1); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_2, &referencedModel, fields, referencedFields, &options); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&alias); + if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&alias) != IS_STRING)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Relation alias must be a string", "phalcon/Mvc/Model/Manager.zep", 638); + return; + } + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + } else { + ZEPHIR_CPY_WRT(&lowerAlias, &referencedEntity); + } + zephir_array_append(&relations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 651); + ZEPHIR_INIT_VAR(&_3); + ZEPHIR_CONCAT_VSV(&_3, &entityName, "$", &lowerAlias); + zephir_update_property_array(this_ptr, SL("aliases"), &_3, &relation); + zephir_update_property_array(this_ptr, SL("hasOne"), &keyRelation, &relations); + ZEPHIR_OBS_VAR(&singleRelations); + zephir_read_property(&_2, this_ptr, ZEND_STRL("hasOneSingle"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&singleRelations, &_2, &entityName, 0))) { + ZEPHIR_INIT_NVAR(&singleRelations); + array_init(&singleRelations); + } + zephir_array_append(&singleRelations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 665); + zephir_update_property_array(this_ptr, SL("hasOneSingle"), &entityName, &singleRelations); + RETURN_CCTOR(&relation); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, getDsnDefaults) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, addHasOneThrough) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval options; + zval intermediateModel, referencedModel, keyRelation; + zval *model, model_sub, *fields, fields_sub, *intermediateModel_param = NULL, *intermediateFields, intermediateFields_sub, *intermediateReferencedFields, intermediateReferencedFields_sub, *referencedModel_param = NULL, *referencedFields, referencedFields_sub, *options_param = NULL, entityName, referencedEntity, hasOneThrough, relation, relations, alias, lowerAlias, singleRelations, intermediateEntity, _0, _1, _2; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&fields_sub); + ZVAL_UNDEF(&intermediateFields_sub); + ZVAL_UNDEF(&intermediateReferencedFields_sub); + ZVAL_UNDEF(&referencedFields_sub); + ZVAL_UNDEF(&entityName); + ZVAL_UNDEF(&referencedEntity); + ZVAL_UNDEF(&hasOneThrough); + ZVAL_UNDEF(&relation); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&alias); + ZVAL_UNDEF(&lowerAlias); + ZVAL_UNDEF(&singleRelations); + ZVAL_UNDEF(&intermediateEntity); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&intermediateModel); + ZVAL_UNDEF(&referencedModel); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&options); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(7, 8) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ZVAL(fields) + Z_PARAM_STR(intermediateModel) + Z_PARAM_ZVAL(intermediateFields) + Z_PARAM_ZVAL(intermediateReferencedFields) + Z_PARAM_STR(referencedModel) + Z_PARAM_ZVAL(referencedFields) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(options) + ZEND_PARSE_PARAMETERS_END(); +#endif - array_init(return_value); - return; + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 7, 1, &model, &fields, &intermediateModel_param, &intermediateFields, &intermediateReferencedFields, &referencedModel_param, &referencedFields, &options_param); + if (UNEXPECTED(Z_TYPE_P(intermediateModel_param) != IS_STRING && Z_TYPE_P(intermediateModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'intermediateModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(intermediateModel_param) == IS_STRING)) { + zephir_get_strval(&intermediateModel, intermediateModel_param); + } else { + ZEPHIR_INIT_VAR(&intermediateModel); + } + if (UNEXPECTED(Z_TYPE_P(referencedModel_param) != IS_STRING && Z_TYPE_P(referencedModel_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referencedModel' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(referencedModel_param) == IS_STRING)) { + zephir_get_strval(&referencedModel, referencedModel_param); + } else { + ZEPHIR_INIT_VAR(&referencedModel); + } + if (!options_param) { + ZEPHIR_INIT_VAR(&options); + array_init(&options); + } else { + zephir_get_arrval(&options, options_param); + } + + + ZEPHIR_INIT_VAR(&entityName); + zephir_get_class(&entityName, model, 1); + ZEPHIR_INIT_VAR(&intermediateEntity); + zephir_fast_strtolower(&intermediateEntity, &intermediateModel); + ZEPHIR_INIT_VAR(&referencedEntity); + zephir_fast_strtolower(&referencedEntity, &referencedModel); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_CONCAT_VSV(&_0, &entityName, "$", &referencedEntity); + zephir_get_strval(&keyRelation, &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasOneThrough"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&hasOneThrough, &_1); + ZEPHIR_OBS_VAR(&relations); + if (!(zephir_array_isset_fetch(&relations, &hasOneThrough, &keyRelation, 0))) { + ZEPHIR_INIT_NVAR(&relations); + array_init(&relations); + } + if (Z_TYPE_P(intermediateFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(intermediateFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 722); + return; + } + } + if (Z_TYPE_P(intermediateReferencedFields) == IS_ARRAY) { + if (UNEXPECTED(zephir_fast_count_int(fields) != zephir_fast_count_int(intermediateFields))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Number of referenced fields are not the same", "phalcon/Mvc/Model/Manager.zep", 734); + return; + } + } + ZEPHIR_INIT_VAR(&relation); + object_init_ex(&relation, phalcon_mvc_model_relation_ce); + ZVAL_LONG(&_1, 3); + ZEPHIR_CALL_METHOD(NULL, &relation, "__construct", NULL, 442, &_1, &referencedModel, fields, referencedFields, &options); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &relation, "setintermediaterelation", NULL, 443, intermediateFields, &intermediateModel, intermediateReferencedFields); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&alias); + if (zephir_array_isset_string_fetch(&alias, &options, SL("alias"), 0)) { + if (Z_TYPE_P(&alias) != IS_STRING) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Relation alias must be a string", "phalcon/Mvc/Model/Manager.zep", 763); + return; + } + ZEPHIR_INIT_VAR(&lowerAlias); + zephir_fast_strtolower(&lowerAlias, &alias); + } else { + ZEPHIR_CPY_WRT(&lowerAlias, &referencedEntity); + } + zephir_array_append(&relations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 774); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSV(&_2, &entityName, "$", &lowerAlias); + zephir_update_property_array(this_ptr, SL("aliases"), &_2, &relation); + zephir_update_property_array(this_ptr, SL("hasOneThrough"), &keyRelation, &relations); + ZEPHIR_OBS_VAR(&singleRelations); + zephir_read_property(&_1, this_ptr, ZEND_STRL("hasOneThroughSingle"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&singleRelations, &_1, &entityName, 0))) { + ZEPHIR_INIT_NVAR(&singleRelations); + array_init(&singleRelations); + } + zephir_array_append(&singleRelations, &relation, PH_SEPARATE, "phalcon/Mvc/Model/Manager.zep", 796); + zephir_update_property_array(this_ptr, SL("hasOneThroughSingle"), &entityName, &singleRelations); + RETURN_CCTOR(&relation); } +static PHP_METHOD(Phalcon_Mvc_Model_Manager, clearReusableObjects) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("reusable"), &_0); + ZEPHIR_MM_RESTORE(); +} +static PHP_METHOD(Phalcon_Mvc_Model_Manager, createBuilder) +{ + zval _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *params = NULL, params_sub, __$null, container, _0, _1, _3; + zval *this_ptr = getThis(); + ZVAL_UNDEF(¶ms_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(params) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, ¶ms); + if (!params) { + params = ¶ms_sub; + params = &__$null; + } -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo_Sqlite) -{ - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter\\Pdo, Sqlite, phalcon, db_adapter_pdo_sqlite, phalcon_db_adapter_pdo_abstractpdo_ce, phalcon_db_adapter_pdo_sqlite_method_entry, 0); - zend_declare_property_string(phalcon_db_adapter_pdo_sqlite_ce, SL("dialectType"), "sqlite", ZEND_ACC_PROTECTED); - zend_declare_property_string(phalcon_db_adapter_pdo_sqlite_ce, SL("type"), "sqlite", ZEND_ACC_PROTECTED); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ORM", "phalcon/Mvc/Model/Manager.zep", 828); + return; + } + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 2, 0); + zephir_array_fast_append(&_2, params); + zephir_array_fast_append(&_2, &container); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Query\\Builder"); + ZEPHIR_CALL_METHOD(&_1, &container, "get", NULL, 0, &_3, &_2); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, ZEND_STRL("builder"), &_1); + RETURN_MM_MEMBER(getThis(), "builder"); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, __construct) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, createQuery) { + zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL, _0$$3; - zval descriptor; + zval *phql_param = NULL, container, query, _0, _1, _3; + zval phql; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&phql); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&query); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_2); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY(descriptor) + Z_PARAM_STR(phql) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); + zephir_fetch_params(1, 1, 0, &phql_param); + if (UNEXPECTED(Z_TYPE_P(phql_param) != IS_STRING && Z_TYPE_P(phql_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'phql' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(phql_param) == IS_STRING)) { + zephir_get_strval(&phql, phql_param); + } else { + ZEPHIR_INIT_VAR(&phql); + } - if (zephir_array_isset_string(&descriptor, SL("charset"))) { - ZEPHIR_INIT_VAR(&_0$$3); - ZVAL_STRING(&_0$$3, "SQLite does not allow the charset to be changed in the DSN."); - ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 7, &_0$$3); - zephir_check_call_status(); + zephir_read_property(&_0, this_ptr, ZEND_STRL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injection container is required to access the services related to the ORM", "phalcon/Mvc/Model/Manager.zep", 861); + return; } - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_sqlite_ce, getThis(), "__construct", &_1, 0, &descriptor); + ZEPHIR_INIT_VAR(&_2); + zephir_create_array(&_2, 2, 0); + zephir_array_fast_append(&_2, &phql); + zephir_array_fast_append(&_2, &container); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Query"); + ZEPHIR_CALL_METHOD(&_1, &container, "get", NULL, 0, &_3, &_2); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + ZEPHIR_CPY_WRT(&query, &_1); + zephir_update_property_zval(this_ptr, ZEND_STRL("lastQuery"), &query); + RETURN_CCTOR(&query); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, connect) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, executeQuery) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL; - zval *descriptor_param = NULL, dbname, _0$$3; - zval descriptor; + zval *phql_param = NULL, *placeholders = NULL, placeholders_sub, *types = NULL, types_sub, __$null, query; + zval phql; zval *this_ptr = getThis(); - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&dbname); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&phql); + ZVAL_UNDEF(&placeholders_sub); + ZVAL_UNDEF(&types_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&query); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(0, 1) + ZEND_PARSE_PARAMETERS_START(1, 3) + Z_PARAM_STR(phql) Z_PARAM_OPTIONAL - Z_PARAM_ARRAY(descriptor) + Z_PARAM_ZVAL_OR_NULL(placeholders) + Z_PARAM_ZVAL_OR_NULL(types) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &descriptor_param); - if (!descriptor_param) { - ZEPHIR_INIT_VAR(&descriptor); - array_init(&descriptor); + zephir_fetch_params(1, 1, 2, &phql_param, &placeholders, &types); + if (UNEXPECTED(Z_TYPE_P(phql_param) != IS_STRING && Z_TYPE_P(phql_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'phql' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(phql_param) == IS_STRING)) { + zephir_get_strval(&phql, phql_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); + ZEPHIR_INIT_VAR(&phql); + } + if (!placeholders) { + placeholders = &placeholders_sub; + placeholders = &__$null; + } + if (!types) { + types = &types_sub; + types = &__$null; } - if (ZEPHIR_IS_EMPTY(&descriptor)) { - zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("descriptor"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&descriptor, &_0$$3); + ZEPHIR_CALL_METHOD(&query, this_ptr, "createquery", NULL, 0, &phql); + zephir_check_call_status(); + if (Z_TYPE_P(placeholders) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, &query, "setbindparams", NULL, 0, placeholders); + zephir_check_call_status(); } - ZEPHIR_OBS_VAR(&dbname); - if (zephir_array_isset_string_fetch(&dbname, &descriptor, SL("dbname"), 0)) { - zephir_array_update_string(&descriptor, SL("dsn"), &dbname, PH_COPY | PH_SEPARATE); - zephir_array_unset_string(&descriptor, SL("dbname"), PH_SEPARATE); - } else if (UNEXPECTED(!(zephir_array_isset_string(&descriptor, SL("dsn"))))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The database must be specified with either 'dbname' or 'dsn'.", "phalcon/Db/Adapter/Pdo/Sqlite.zep", 82); - return; + if (Z_TYPE_P(types) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, &query, "setbindtypes", NULL, 0, types); + zephir_check_call_status(); } - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_sqlite_ce, getThis(), "connect", &_1, 0, &descriptor); + ZEPHIR_RETURN_CALL_METHOD(&query, "execute", NULL, 0); zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, existsBelongsTo) { - zend_bool _5$$3, _31$$3, _43$$28, _69$$28; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_35 = NULL, *_40 = NULL, *_41 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, __$true, __$false, columns, columnType, fields, field, definition, oldColumn, sizePattern, matches, matchOne, matchTwo, columnName, _0, _1, _2, *_3, _4, _28$$3, _29$$3, _30$$3, _32$$3, _33$$3, _34$$3, _6$$4, _7$$4, _8$$5, _9$$5, _10$$5, _11$$7, _12$$7, _13$$8, _14$$9, _15$$10, _16$$11, _17$$11, _18$$12, _19$$12, _20$$13, _21$$14, _22$$15, _23$$16, _24$$17, _25$$18, _26$$20, _27$$21, _36$$27, _37$$27, _38$$27, _39$$27, _42$$28, _66$$28, _67$$28, _68$$28, _70$$28, _71$$28, _72$$28, _44$$29, _45$$29, _46$$30, _47$$30, _48$$30, _49$$32, _50$$32, _51$$33, _52$$34, _53$$35, _54$$36, _55$$36, _56$$37, _57$$37, _58$$38, _59$$39, _60$$40, _61$$41, _62$$42, _63$$43, _64$$45, _65$$46, _73$$52, _74$$52, _75$$52, _76$$52; - zval table, schema; + zval *modelName_param = NULL, *modelRelation_param = NULL; + zval modelName, modelRelation; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&columnType); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&oldColumn); - ZVAL_UNDEF(&sizePattern); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&matchOne); - ZVAL_UNDEF(&matchTwo); - ZVAL_UNDEF(&columnName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_28$$3); - ZVAL_UNDEF(&_29$$3); - ZVAL_UNDEF(&_30$$3); - ZVAL_UNDEF(&_32$$3); - ZVAL_UNDEF(&_33$$3); - ZVAL_UNDEF(&_34$$3); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_12$$7); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$11); - ZVAL_UNDEF(&_17$$11); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_19$$12); - ZVAL_UNDEF(&_20$$13); - ZVAL_UNDEF(&_21$$14); - ZVAL_UNDEF(&_22$$15); - ZVAL_UNDEF(&_23$$16); - ZVAL_UNDEF(&_24$$17); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&_26$$20); - ZVAL_UNDEF(&_27$$21); - ZVAL_UNDEF(&_36$$27); - ZVAL_UNDEF(&_37$$27); - ZVAL_UNDEF(&_38$$27); - ZVAL_UNDEF(&_39$$27); - ZVAL_UNDEF(&_42$$28); - ZVAL_UNDEF(&_66$$28); - ZVAL_UNDEF(&_67$$28); - ZVAL_UNDEF(&_68$$28); - ZVAL_UNDEF(&_70$$28); - ZVAL_UNDEF(&_71$$28); - ZVAL_UNDEF(&_72$$28); - ZVAL_UNDEF(&_44$$29); - ZVAL_UNDEF(&_45$$29); - ZVAL_UNDEF(&_46$$30); - ZVAL_UNDEF(&_47$$30); - ZVAL_UNDEF(&_48$$30); - ZVAL_UNDEF(&_49$$32); - ZVAL_UNDEF(&_50$$32); - ZVAL_UNDEF(&_51$$33); - ZVAL_UNDEF(&_52$$34); - ZVAL_UNDEF(&_53$$35); - ZVAL_UNDEF(&_54$$36); - ZVAL_UNDEF(&_55$$36); - ZVAL_UNDEF(&_56$$37); - ZVAL_UNDEF(&_57$$37); - ZVAL_UNDEF(&_58$$38); - ZVAL_UNDEF(&_59$$39); - ZVAL_UNDEF(&_60$$40); - ZVAL_UNDEF(&_61$$41); - ZVAL_UNDEF(&_62$$42); - ZVAL_UNDEF(&_63$$43); - ZVAL_UNDEF(&_64$$45); - ZVAL_UNDEF(&_65$$46); - ZVAL_UNDEF(&_73$$52); - ZVAL_UNDEF(&_74$$52); - ZVAL_UNDEF(&_75$$52); - ZVAL_UNDEF(&_76$$52); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 2, 0, &modelName_param, &modelRelation_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&modelName); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); + ZEPHIR_INIT_VAR(&modelRelation); + } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hasbelongsto", NULL, 0, &modelName, &modelRelation); + zephir_check_call_status(); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Manager, existsHasMany) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *modelName_param = NULL, *modelRelation_param = NULL; + zval modelName, modelRelation; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &modelName_param, &modelRelation_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_INIT_VAR(&schema); + ZEPHIR_INIT_VAR(&modelName); + } + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); + RETURN_MM_NULL(); } + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); + } else { + ZEPHIR_INIT_VAR(&modelRelation); } - ZEPHIR_INIT_VAR(&oldColumn); - ZVAL_NULL(&oldColumn); - ZEPHIR_INIT_VAR(&sizePattern); - ZVAL_STRING(&sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#"); - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_read_property(&_0, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_1, &_0, "describecolumns", NULL, 0, &table, &schema); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hashasmany", NULL, 0, &modelName, &modelRelation); zephir_check_call_status(); - ZVAL_LONG(&_2, 3); - ZEPHIR_CALL_METHOD(&fields, this_ptr, "fetchall", NULL, 0, &_1, &_2); + RETURN_MM(); +} + +static PHP_METHOD(Phalcon_Mvc_Model_Manager, existsHasManyToMany) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *modelName_param = NULL, *modelRelation_param = NULL; + zval modelName, modelRelation; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &modelName_param, &modelRelation_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); + } else { + ZEPHIR_INIT_VAR(&modelName); + } + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); + } else { + ZEPHIR_INIT_VAR(&modelRelation); + } + + + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hashasmanytomany", NULL, 0, &modelName, &modelRelation); zephir_check_call_status(); - zephir_is_iterable(&fields, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 311); - if (Z_TYPE_P(&fields) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&fields), _3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _3); - ZEPHIR_INIT_NVAR(&definition); - zephir_create_array(&definition, 1, 0); - add_assoc_long_ex(&definition, SL("bindType"), 2); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 127); - _5$$3 = zephir_memnstr_str(&columnType, SL("int"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 149); - if (!(_5$$3)) { - _5$$3 = zephir_memnstr_str(&columnType, SL("INT"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 149); - } - if (zephir_memnstr_str(&columnType, SL("bigint"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 142)) { - ZEPHIR_INIT_NVAR(&_6$$4); - ZVAL_LONG(&_6$$4, 14); - zephir_array_update_string(&definition, SL("type"), &_6$$4, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_7$$4); - ZVAL_LONG(&_7$$4, 2); - zephir_array_update_string(&definition, SL("bindType"), &_7$$4, PH_COPY | PH_SEPARATE); - } else if (_5$$3) { - ZEPHIR_INIT_NVAR(&_8$$5); - ZVAL_LONG(&_8$$5, 0); - zephir_array_update_string(&definition, SL("type"), &_8$$5, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_9$$5); - ZVAL_LONG(&_9$$5, 1); - zephir_array_update_string(&definition, SL("bindType"), &_9$$5, PH_COPY | PH_SEPARATE); - zephir_array_fetch_long(&_10$$5, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 157); - if (zephir_is_true(&_10$$5)) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - } else if (zephir_memnstr_str(&columnType, SL("tinyint(1)"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 160)) { - ZEPHIR_INIT_NVAR(&_11$$7); - ZVAL_LONG(&_11$$7, 8); - zephir_array_update_string(&definition, SL("type"), &_11$$7, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_12$$7); - ZVAL_LONG(&_12$$7, 5); - zephir_array_update_string(&definition, SL("bindType"), &_12$$7, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&columnType); - ZVAL_STRING(&columnType, "boolean"); - } else if (zephir_memnstr_str(&columnType, SL("enum"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 171)) { - ZEPHIR_INIT_NVAR(&_13$$8); - ZVAL_LONG(&_13$$8, 5); - zephir_array_update_string(&definition, SL("type"), &_13$$8, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("datetime"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 180)) { - ZEPHIR_INIT_NVAR(&_14$$9); - ZVAL_LONG(&_14$$9, 4); - zephir_array_update_string(&definition, SL("type"), &_14$$9, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("date"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 185)) { - ZEPHIR_INIT_NVAR(&_15$$10); - ZVAL_LONG(&_15$$10, 1); - zephir_array_update_string(&definition, SL("type"), &_15$$10, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("decimal"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 194)) { - ZEPHIR_INIT_NVAR(&_16$$11); - ZVAL_LONG(&_16$$11, 3); - zephir_array_update_string(&definition, SL("type"), &_16$$11, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_17$$11); - ZVAL_LONG(&_17$$11, 32); - zephir_array_update_string(&definition, SL("bindType"), &_17$$11, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("float"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 201)) { - ZEPHIR_INIT_NVAR(&_18$$12); - ZVAL_LONG(&_18$$12, 7); - zephir_array_update_string(&definition, SL("type"), &_18$$12, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_19$$12); - ZVAL_LONG(&_19$$12, 3); - zephir_array_update_string(&definition, SL("bindType"), &_19$$12, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("timestamp"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 212)) { - ZEPHIR_INIT_NVAR(&_20$$13); - ZVAL_LONG(&_20$$13, 17); - zephir_array_update_string(&definition, SL("type"), &_20$$13, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("varchar"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 221)) { - ZEPHIR_INIT_NVAR(&_21$$14); - ZVAL_LONG(&_21$$14, 2); - zephir_array_update_string(&definition, SL("type"), &_21$$14, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("char"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 226)) { - ZEPHIR_INIT_NVAR(&_22$$15); - ZVAL_LONG(&_22$$15, 5); - zephir_array_update_string(&definition, SL("type"), &_22$$15, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("text"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 231)) { - ZEPHIR_INIT_NVAR(&_23$$16); - ZVAL_LONG(&_23$$16, 6); - zephir_array_update_string(&definition, SL("type"), &_23$$16, PH_COPY | PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&_24$$17); - ZVAL_LONG(&_24$$17, 2); - zephir_array_update_string(&definition, SL("type"), &_24$$17, PH_COPY | PH_SEPARATE); - } - if (zephir_memnstr_str(&columnType, SL("("), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 248)) { - ZEPHIR_INIT_NVAR(&matches); - ZVAL_NULL(&matches); - ZEPHIR_INIT_NVAR(&_25$$18); - zephir_preg_match(&_25$$18, &sizePattern, &columnType, &matches, 0, 0 , 0 ); - if (zephir_is_true(&_25$$18)) { - ZEPHIR_OBS_NVAR(&matchOne); - if (zephir_array_isset_long_fetch(&matchOne, &matches, 1, 0)) { - ZEPHIR_INIT_NVAR(&_26$$20); - ZVAL_LONG(&_26$$20, zephir_get_intval(&matchOne)); - zephir_array_update_string(&definition, SL("size"), &_26$$20, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&matchTwo); - if (zephir_array_isset_long_fetch(&matchTwo, &matches, 2, 0)) { - ZEPHIR_INIT_NVAR(&_27$$21); - ZVAL_LONG(&_27$$21, zephir_get_intval(&matchTwo)); - zephir_array_update_string(&definition, SL("scale"), &_27$$21, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_memnstr_str(&columnType, SL("unsigned"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 264)) { - zephir_array_update_string(&definition, SL("unsigned"), &__$true, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_28$$3, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 280); - if (zephir_is_true(&_28$$3)) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_29$$3, &field, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 287); - if (ZEPHIR_IS_LONG(&_29$$3, 0)) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&_30$$3); - zephir_array_fetch_long(&_30$$3, &field, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); - _31$$3 = !(ZEPHIR_IS_EMPTY(&_30$$3)); - if (_31$$3) { - zephir_array_fetch_long(&_32$$3, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); - ZEPHIR_INIT_NVAR(&_33$$3); - ZVAL_STRING(&_33$$3, "null"); - ZEPHIR_CALL_FUNCTION(&_34$$3, "strcasecmp", &_35, 35, &_32$$3, &_33$$3); - zephir_check_call_status(); - _31$$3 = !ZEPHIR_IS_LONG_IDENTICAL(&_34$$3, 0); - } - if (_31$$3) { - zephir_array_fetch_long(&_36$$27, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 300); - ZEPHIR_INIT_NVAR(&_37$$27); - ZVAL_STRING(&_37$$27, "/^'|'$/"); - ZEPHIR_INIT_NVAR(&_38$$27); - ZVAL_STRING(&_38$$27, ""); - ZEPHIR_CALL_FUNCTION(&_39$$27, "preg_replace", &_40, 37, &_37$$27, &_38$$27, &_36$$27); - zephir_check_call_status(); - zephir_array_update_string(&definition, SL("default"), &_39$$27, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&columnName, &field, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 306); - ZEPHIR_INIT_NVAR(&_33$$3); - object_init_ex(&_33$$3, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_33$$3, "__construct", &_41, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_33$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 307); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &fields, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4, &fields, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4)) { - break; - } - ZEPHIR_CALL_METHOD(&field, &fields, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_42$$28); - zephir_create_array(&_42$$28, 1, 0); - add_assoc_long_ex(&_42$$28, SL("bindType"), 2); - ZEPHIR_CPY_WRT(&definition, &_42$$28); - ZEPHIR_OBS_NVAR(&columnType); - zephir_array_fetch_long(&columnType, &field, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 127); - _43$$28 = zephir_memnstr_str(&columnType, SL("int"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 149); - if (!(_43$$28)) { - _43$$28 = zephir_memnstr_str(&columnType, SL("INT"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 149); - } - if (zephir_memnstr_str(&columnType, SL("bigint"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 142)) { - ZEPHIR_INIT_NVAR(&_44$$29); - ZVAL_LONG(&_44$$29, 14); - zephir_array_update_string(&definition, SL("type"), &_44$$29, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_45$$29); - ZVAL_LONG(&_45$$29, 2); - zephir_array_update_string(&definition, SL("bindType"), &_45$$29, PH_COPY | PH_SEPARATE); - } else if (_43$$28) { - ZEPHIR_INIT_NVAR(&_46$$30); - ZVAL_LONG(&_46$$30, 0); - zephir_array_update_string(&definition, SL("type"), &_46$$30, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_47$$30); - ZVAL_LONG(&_47$$30, 1); - zephir_array_update_string(&definition, SL("bindType"), &_47$$30, PH_COPY | PH_SEPARATE); - zephir_array_fetch_long(&_48$$30, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 157); - if (zephir_is_true(&_48$$30)) { - zephir_array_update_string(&definition, SL("autoIncrement"), &__$true, PH_COPY | PH_SEPARATE); - } - } else if (zephir_memnstr_str(&columnType, SL("tinyint(1)"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 160)) { - ZEPHIR_INIT_NVAR(&_49$$32); - ZVAL_LONG(&_49$$32, 8); - zephir_array_update_string(&definition, SL("type"), &_49$$32, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_50$$32); - ZVAL_LONG(&_50$$32, 5); - zephir_array_update_string(&definition, SL("bindType"), &_50$$32, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&columnType); - ZVAL_STRING(&columnType, "boolean"); - } else if (zephir_memnstr_str(&columnType, SL("enum"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 171)) { - ZEPHIR_INIT_NVAR(&_51$$33); - ZVAL_LONG(&_51$$33, 5); - zephir_array_update_string(&definition, SL("type"), &_51$$33, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("datetime"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 180)) { - ZEPHIR_INIT_NVAR(&_52$$34); - ZVAL_LONG(&_52$$34, 4); - zephir_array_update_string(&definition, SL("type"), &_52$$34, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("date"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 185)) { - ZEPHIR_INIT_NVAR(&_53$$35); - ZVAL_LONG(&_53$$35, 1); - zephir_array_update_string(&definition, SL("type"), &_53$$35, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("decimal"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 194)) { - ZEPHIR_INIT_NVAR(&_54$$36); - ZVAL_LONG(&_54$$36, 3); - zephir_array_update_string(&definition, SL("type"), &_54$$36, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_55$$36); - ZVAL_LONG(&_55$$36, 32); - zephir_array_update_string(&definition, SL("bindType"), &_55$$36, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("float"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 201)) { - ZEPHIR_INIT_NVAR(&_56$$37); - ZVAL_LONG(&_56$$37, 7); - zephir_array_update_string(&definition, SL("type"), &_56$$37, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&definition, SL("isNumeric"), &__$true, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_57$$37); - ZVAL_LONG(&_57$$37, 3); - zephir_array_update_string(&definition, SL("bindType"), &_57$$37, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("timestamp"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 212)) { - ZEPHIR_INIT_NVAR(&_58$$38); - ZVAL_LONG(&_58$$38, 17); - zephir_array_update_string(&definition, SL("type"), &_58$$38, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("varchar"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 221)) { - ZEPHIR_INIT_NVAR(&_59$$39); - ZVAL_LONG(&_59$$39, 2); - zephir_array_update_string(&definition, SL("type"), &_59$$39, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("char"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 226)) { - ZEPHIR_INIT_NVAR(&_60$$40); - ZVAL_LONG(&_60$$40, 5); - zephir_array_update_string(&definition, SL("type"), &_60$$40, PH_COPY | PH_SEPARATE); - } else if (zephir_memnstr_str(&columnType, SL("text"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 231)) { - ZEPHIR_INIT_NVAR(&_61$$41); - ZVAL_LONG(&_61$$41, 6); - zephir_array_update_string(&definition, SL("type"), &_61$$41, PH_COPY | PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&_62$$42); - ZVAL_LONG(&_62$$42, 2); - zephir_array_update_string(&definition, SL("type"), &_62$$42, PH_COPY | PH_SEPARATE); - } - if (zephir_memnstr_str(&columnType, SL("("), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 248)) { - ZEPHIR_INIT_NVAR(&matches); - ZVAL_NULL(&matches); - ZEPHIR_INIT_NVAR(&_63$$43); - zephir_preg_match(&_63$$43, &sizePattern, &columnType, &matches, 0, 0 , 0 ); - if (zephir_is_true(&_63$$43)) { - ZEPHIR_OBS_NVAR(&matchOne); - if (zephir_array_isset_long_fetch(&matchOne, &matches, 1, 0)) { - ZEPHIR_INIT_NVAR(&_64$$45); - ZVAL_LONG(&_64$$45, zephir_get_intval(&matchOne)); - zephir_array_update_string(&definition, SL("size"), &_64$$45, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&matchTwo); - if (zephir_array_isset_long_fetch(&matchTwo, &matches, 2, 0)) { - ZEPHIR_INIT_NVAR(&_65$$46); - ZVAL_LONG(&_65$$46, zephir_get_intval(&matchTwo)); - zephir_array_update_string(&definition, SL("scale"), &_65$$46, PH_COPY | PH_SEPARATE); - } - } - } - if (zephir_memnstr_str(&columnType, SL("unsigned"), "phalcon/Db/Adapter/Pdo/Sqlite.zep", 264)) { - zephir_array_update_string(&definition, SL("unsigned"), &__$true, PH_COPY | PH_SEPARATE); - } - if (Z_TYPE_P(&oldColumn) == IS_NULL) { - zephir_array_update_string(&definition, SL("first"), &__$true, PH_COPY | PH_SEPARATE); - } else { - zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_66$$28, &field, 5, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 280); - if (zephir_is_true(&_66$$28)) { - zephir_array_update_string(&definition, SL("primary"), &__$true, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch_long(&_67$$28, &field, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 287); - if (ZEPHIR_IS_LONG(&_67$$28, 0)) { - zephir_array_update_string(&definition, SL("notNull"), &__$false, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&_68$$28); - zephir_array_fetch_long(&_68$$28, &field, 4, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); - _69$$28 = !(ZEPHIR_IS_EMPTY(&_68$$28)); - if (_69$$28) { - zephir_array_fetch_long(&_70$$28, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 295); - ZEPHIR_INIT_NVAR(&_71$$28); - ZVAL_STRING(&_71$$28, "null"); - ZEPHIR_CALL_FUNCTION(&_72$$28, "strcasecmp", &_35, 35, &_70$$28, &_71$$28); - zephir_check_call_status(); - _69$$28 = !ZEPHIR_IS_LONG_IDENTICAL(&_72$$28, 0); - } - if (_69$$28) { - zephir_array_fetch_long(&_73$$52, &field, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 300); - ZEPHIR_INIT_NVAR(&_74$$52); - ZVAL_STRING(&_74$$52, "/^'|'$/"); - ZEPHIR_INIT_NVAR(&_75$$52); - ZVAL_STRING(&_75$$52, ""); - ZEPHIR_CALL_FUNCTION(&_76$$52, "preg_replace", &_40, 37, &_74$$52, &_75$$52, &_73$$52); - zephir_check_call_status(); - zephir_array_update_string(&definition, SL("default"), &_76$$52, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_NVAR(&columnName); - zephir_array_fetch_long(&columnName, &field, 1, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 306); - ZEPHIR_INIT_NVAR(&_71$$28); - object_init_ex(&_71$$28, phalcon_db_column_ce); - ZEPHIR_CALL_METHOD(NULL, &_71$$28, "__construct", &_41, 212, &columnName, &definition); - zephir_check_call_status(); - zephir_array_append(&columns, &_71$$28, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 307); - ZEPHIR_CPY_WRT(&oldColumn, &columnName); - ZEPHIR_CALL_METHOD(NULL, &fields, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&field); - RETURN_CCTOR(&columns); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, existsHasOne) { - zend_string *_48; - zend_ulong _47; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_17 = NULL, *_52 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, indexes, index, keyName, indexObjects, name, columns, describeIndexes, describeIndex, indexSql, _0, _1, _2, _3, *_4, _5, *_45, _46, _6$$4, _7$$3, _9$$3, _10$$3, _11$$3, *_12$$3, _13$$3, _16$$3, _18$$3, _8$$6, _14$$7, _15$$8, _19$$9, _20$$9, _21$$9, _22$$9, _23$$10, _24$$11, _25$$12, _26$$14, _27$$13, _29$$13, _30$$13, _31$$13, *_32$$13, _33$$13, _36$$13, _37$$13, _28$$16, _34$$17, _35$$18, _38$$19, _39$$19, _40$$19, _41$$19, _42$$20, _43$$21, _44$$22, _49$$23, _50$$23, _51$$23, _53$$24, _54$$24, _55$$24; - zval table, schema; + zval *modelName_param = NULL, *modelRelation_param = NULL; + zval modelName, modelRelation; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&indexes); - ZVAL_UNDEF(&index); - ZVAL_UNDEF(&keyName); - ZVAL_UNDEF(&indexObjects); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&describeIndexes); - ZVAL_UNDEF(&describeIndex); - ZVAL_UNDEF(&indexSql); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_46); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_16$$3); - ZVAL_UNDEF(&_18$$3); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_19$$9); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&_21$$9); - ZVAL_UNDEF(&_22$$9); - ZVAL_UNDEF(&_23$$10); - ZVAL_UNDEF(&_24$$11); - ZVAL_UNDEF(&_25$$12); - ZVAL_UNDEF(&_26$$14); - ZVAL_UNDEF(&_27$$13); - ZVAL_UNDEF(&_29$$13); - ZVAL_UNDEF(&_30$$13); - ZVAL_UNDEF(&_31$$13); - ZVAL_UNDEF(&_33$$13); - ZVAL_UNDEF(&_36$$13); - ZVAL_UNDEF(&_37$$13); - ZVAL_UNDEF(&_28$$16); - ZVAL_UNDEF(&_34$$17); - ZVAL_UNDEF(&_35$$18); - ZVAL_UNDEF(&_38$$19); - ZVAL_UNDEF(&_39$$19); - ZVAL_UNDEF(&_40$$19); - ZVAL_UNDEF(&_41$$19); - ZVAL_UNDEF(&_42$$20); - ZVAL_UNDEF(&_43$$21); - ZVAL_UNDEF(&_44$$22); - ZVAL_UNDEF(&_49$$23); - ZVAL_UNDEF(&_50$$23); - ZVAL_UNDEF(&_51$$23); - ZVAL_UNDEF(&_53$$24); - ZVAL_UNDEF(&_54$$24); - ZVAL_UNDEF(&_55$$24); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 2, 0, &modelName_param, &modelRelation_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&modelName); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); } else { - ZEPHIR_INIT_VAR(&schema); - } + ZEPHIR_INIT_VAR(&modelRelation); } - ZEPHIR_INIT_VAR(&indexes); - array_init(&indexes); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describeindexes", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 2); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hashasone", NULL, 0, &modelName, &modelRelation); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 369); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _4) - { - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _4); - ZEPHIR_OBS_NVAR(&keyName); - zephir_array_fetch_string(&keyName, &index, SL("name"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 331); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&_6$$4); - array_init(&_6$$4); - zephir_array_update_zval(&indexes, &keyName, &_6$$4, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch(&_7$$3, &indexes, &keyName, PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 337); - if (!(zephir_array_isset_string(&_7$$3, SL("columns")))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - } else { - zephir_array_fetch(&_8$$6, &indexes, &keyName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 340); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_8$$6, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 340); - } - zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_10$$3, &_9$$3, "describeindex", NULL, 0, &keyName); - zephir_check_call_status(); - ZVAL_LONG(&_11$$3, 2); - ZEPHIR_CALL_METHOD(&describeIndexes, this_ptr, "fetchall", NULL, 0, &_10$$3, &_11$$3); - zephir_check_call_status(); - zephir_is_iterable(&describeIndexes, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 352); - if (Z_TYPE_P(&describeIndexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&describeIndexes), _12$$3) - { - ZEPHIR_INIT_NVAR(&describeIndex); - ZVAL_COPY(&describeIndex, _12$$3); - zephir_array_fetch_string(&_14$$7, &describeIndex, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - zephir_array_append(&columns, &_14$$7, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &describeIndexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_13$$3, &describeIndexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_13$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&describeIndex, &describeIndexes, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_string(&_15$$8, &describeIndex, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - zephir_array_append(&columns, &_15$$8, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - ZEPHIR_CALL_METHOD(NULL, &describeIndexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&describeIndex); - zephir_array_update_multi(&indexes, &columns, SL("zs"), 3, &keyName, SL("columns")); - zephir_read_property(&_11$$3, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_16$$3, &_11$$3, "listindexessql", NULL, 0, &table, &schema, &keyName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexSql, this_ptr, "fetchcolumn", &_17, 0, &_16$$3); - zephir_check_call_status(); - zephir_array_fetch_string(&_18$$3, &index, SL("unique"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 358); - if (zephir_is_true(&_18$$3)) { - ZEPHIR_INIT_NVAR(&_19$$9); - ZEPHIR_INIT_NVAR(&_20$$9); - ZVAL_STRING(&_20$$9, "# UNIQUE #i"); - ZEPHIR_INIT_NVAR(&_21$$9); - ZEPHIR_INIT_NVAR(&_22$$9); - ZVAL_STRING(&_22$$9, "# UNIQUE #i"); - zephir_preg_match(&_21$$9, &_22$$9, &indexSql, &_19$$9, 0, 0 , 0 ); - if (zephir_is_true(&_21$$9)) { - ZEPHIR_INIT_NVAR(&_23$$10); - ZVAL_STRING(&_23$$10, "UNIQUE"); - zephir_array_update_multi(&indexes, &_23$$10, SL("zs"), 3, &keyName, SL("type")); - } else { - ZEPHIR_INIT_NVAR(&_24$$11); - ZVAL_STRING(&_24$$11, "PRIMARY"); - zephir_array_update_multi(&indexes, &_24$$11, SL("zs"), 3, &keyName, SL("type")); - } - } else { - ZEPHIR_INIT_NVAR(&_25$$12); - ZVAL_STRING(&_25$$12, ""); - zephir_array_update_multi(&indexes, &_25$$12, SL("zs"), 3, &keyName, SL("type")); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&index, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&keyName); - zephir_array_fetch_string(&keyName, &index, SL("name"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 331); - if (!(zephir_array_isset(&indexes, &keyName))) { - ZEPHIR_INIT_NVAR(&_26$$14); - array_init(&_26$$14); - zephir_array_update_zval(&indexes, &keyName, &_26$$14, PH_COPY | PH_SEPARATE); - } - zephir_array_fetch(&_27$$13, &indexes, &keyName, PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 337); - if (!(zephir_array_isset_string(&_27$$13, SL("columns")))) { - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - } else { - zephir_array_fetch(&_28$$16, &indexes, &keyName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 340); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_28$$16, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 340); - } - zephir_read_property(&_29$$13, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_30$$13, &_29$$13, "describeindex", NULL, 0, &keyName); - zephir_check_call_status(); - ZVAL_LONG(&_31$$13, 2); - ZEPHIR_CALL_METHOD(&describeIndexes, this_ptr, "fetchall", NULL, 0, &_30$$13, &_31$$13); - zephir_check_call_status(); - zephir_is_iterable(&describeIndexes, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 352); - if (Z_TYPE_P(&describeIndexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&describeIndexes), _32$$13) - { - ZEPHIR_INIT_NVAR(&describeIndex); - ZVAL_COPY(&describeIndex, _32$$13); - zephir_array_fetch_string(&_34$$17, &describeIndex, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - zephir_array_append(&columns, &_34$$17, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &describeIndexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_33$$13, &describeIndexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_33$$13)) { - break; - } - ZEPHIR_CALL_METHOD(&describeIndex, &describeIndexes, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_string(&_35$$18, &describeIndex, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - zephir_array_append(&columns, &_35$$18, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 349); - ZEPHIR_CALL_METHOD(NULL, &describeIndexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&describeIndex); - zephir_array_update_multi(&indexes, &columns, SL("zs"), 3, &keyName, SL("columns")); - zephir_read_property(&_31$$13, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_36$$13, &_31$$13, "listindexessql", NULL, 0, &table, &schema, &keyName); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&indexSql, this_ptr, "fetchcolumn", &_17, 0, &_36$$13); - zephir_check_call_status(); - zephir_array_fetch_string(&_37$$13, &index, SL("unique"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 358); - if (zephir_is_true(&_37$$13)) { - ZEPHIR_INIT_NVAR(&_38$$19); - ZEPHIR_INIT_NVAR(&_39$$19); - ZVAL_STRING(&_39$$19, "# UNIQUE #i"); - ZEPHIR_INIT_NVAR(&_40$$19); - ZEPHIR_INIT_NVAR(&_41$$19); - ZVAL_STRING(&_41$$19, "# UNIQUE #i"); - zephir_preg_match(&_40$$19, &_41$$19, &indexSql, &_38$$19, 0, 0 , 0 ); - if (zephir_is_true(&_40$$19)) { - ZEPHIR_INIT_NVAR(&_42$$20); - ZVAL_STRING(&_42$$20, "UNIQUE"); - zephir_array_update_multi(&indexes, &_42$$20, SL("zs"), 3, &keyName, SL("type")); - } else { - ZEPHIR_INIT_NVAR(&_43$$21); - ZVAL_STRING(&_43$$21, "PRIMARY"); - zephir_array_update_multi(&indexes, &_43$$21, SL("zs"), 3, &keyName, SL("type")); - } - } else { - ZEPHIR_INIT_NVAR(&_44$$22); - ZVAL_STRING(&_44$$22, ""); - zephir_array_update_multi(&indexes, &_44$$22, SL("zs"), 3, &keyName, SL("type")); - } - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - ZEPHIR_INIT_VAR(&indexObjects); - array_init(&indexObjects); - zephir_is_iterable(&indexes, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 379); - if (Z_TYPE_P(&indexes) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&indexes), _47, _48, _45) - { - ZEPHIR_INIT_NVAR(&name); - if (_48 != NULL) { - ZVAL_STR_COPY(&name, _48); - } else { - ZVAL_LONG(&name, _47); - } - ZEPHIR_INIT_NVAR(&index); - ZVAL_COPY(&index, _45); - ZEPHIR_INIT_NVAR(&_49$$23); - object_init_ex(&_49$$23, phalcon_db_index_ce); - zephir_array_fetch_string(&_50$$23, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 374); - zephir_array_fetch_string(&_51$$23, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 376); - ZEPHIR_CALL_METHOD(NULL, &_49$$23, "__construct", &_52, 30, &name, &_50$$23, &_51$$23); - zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_49$$23, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &indexes, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_46, &indexes, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_46)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &indexes, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&index, &indexes, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_53$$24); - object_init_ex(&_53$$24, phalcon_db_index_ce); - zephir_array_fetch_string(&_54$$24, &index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 374); - zephir_array_fetch_string(&_55$$24, &index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 376); - ZEPHIR_CALL_METHOD(NULL, &_53$$24, "__construct", &_52, 30, &name, &_54$$24, &_55$$24); - zephir_check_call_status(); - zephir_array_update_zval(&indexObjects, &name, &_53$$24, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &indexes, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&index); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&indexObjects); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, existsHasOneThrough) { - zval _14$$3, _21$$6, _27$$9, _31$$10; - zend_string *_7, *_25; - zend_ulong _6, _24; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_29 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, references, reference, arrayReference, constraintName, referenceObjects, name, referencedSchema, referencedTable, columns, referencedColumns, number, _0, _1, _2, _3, *_4, _5, *_22, _23, _8$$5, _9$$5, _10$$5, _11$$5, _12$$3, _13$$3, _15$$8, _16$$8, _17$$8, _18$$8, _19$$6, _20$$6, _26$$9, _28$$9, _30$$10, _32$$10; - zval table, schema; + zval *modelName_param = NULL, *modelRelation_param = NULL; + zval modelName, modelRelation; zval *this_ptr = getThis(); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&references); - ZVAL_UNDEF(&reference); - ZVAL_UNDEF(&arrayReference); - ZVAL_UNDEF(&constraintName); - ZVAL_UNDEF(&referenceObjects); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&referencedSchema); - ZVAL_UNDEF(&referencedTable); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&referencedColumns); - ZVAL_UNDEF(&number); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_23); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$5); - ZVAL_UNDEF(&_11$$5); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_13$$3); - ZVAL_UNDEF(&_15$$8); - ZVAL_UNDEF(&_16$$8); - ZVAL_UNDEF(&_17$$8); - ZVAL_UNDEF(&_18$$8); - ZVAL_UNDEF(&_19$$6); - ZVAL_UNDEF(&_20$$6); - ZVAL_UNDEF(&_26$$9); - ZVAL_UNDEF(&_28$$9); - ZVAL_UNDEF(&_30$$10); - ZVAL_UNDEF(&_32$$10); - ZVAL_UNDEF(&_14$$3); - ZVAL_UNDEF(&_21$$6); - ZVAL_UNDEF(&_27$$9); - ZVAL_UNDEF(&_31$$10); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(table) - Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(schema) + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table_param, &schema_param); - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string")); + zephir_fetch_params(1, 2, 0, &modelName_param, &modelRelation_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_INIT_VAR(&table); + ZEPHIR_INIT_VAR(&modelName); } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - } else { - if (UNEXPECTED(Z_TYPE_P(schema_param) != IS_STRING && Z_TYPE_P(schema_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schema' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(schema_param) == IS_STRING)) { - zephir_get_strval(&schema, schema_param); + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); } else { - ZEPHIR_INIT_VAR(&schema); - } + ZEPHIR_INIT_VAR(&modelRelation); } - ZEPHIR_INIT_VAR(&references); - array_init(&references); - zephir_read_property(&_1, this_ptr, ZEND_STRL("dialect"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_2, &_1, "describereferences", NULL, 0, &table, &schema); - zephir_check_call_status(); - ZVAL_LONG(&_3, 3); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, &_2, &_3); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "hashasonethrough", NULL, 0, &modelName, &modelRelation); zephir_check_call_status(); - zephir_is_iterable(&_0, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 419); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_0), _6, _7, _4) - { - ZEPHIR_INIT_NVAR(&number); - if (_7 != NULL) { - ZVAL_STR_COPY(&number, _7); - } else { - ZVAL_LONG(&number, _6); - } - ZEPHIR_INIT_NVAR(&reference); - ZVAL_COPY(&reference, _4); - ZEPHIR_INIT_NVAR(&constraintName); - ZEPHIR_CONCAT_SV(&constraintName, "foreign_key_", &number); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_INIT_NVAR(&referencedSchema); - ZVAL_NULL(&referencedSchema); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 398); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_8$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 402); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_8$$5, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 402); - zephir_array_fetch(&_9$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 403); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_9$$5, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 403); - zephir_array_fetch(&_10$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 404); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_10$$5, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 404); - zephir_array_fetch(&_11$$5, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 405); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_11$$5, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 405); - } - zephir_array_fetch_long(&_12$$3, &reference, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 408); - zephir_array_append(&columns, &_12$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 408); - zephir_array_fetch_long(&_13$$3, &reference, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 409); - zephir_array_append(&referencedColumns, &_13$$3, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 409); - ZEPHIR_INIT_NVAR(&_14$$3); - zephir_create_array(&_14$$3, 4, 0); - zephir_array_update_string(&_14$$3, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_14$$3, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_14$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&number, &_0, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&reference, &_0, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&constraintName); - ZEPHIR_CONCAT_SV(&constraintName, "foreign_key_", &number); - if (!(zephir_array_isset(&references, &constraintName))) { - ZEPHIR_INIT_NVAR(&referencedSchema); - ZVAL_NULL(&referencedSchema); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_long(&referencedTable, &reference, 2, PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 398); - ZEPHIR_INIT_NVAR(&columns); - array_init(&columns); - ZEPHIR_INIT_NVAR(&referencedColumns); - array_init(&referencedColumns); - } else { - zephir_array_fetch(&_15$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 402); - ZEPHIR_OBS_NVAR(&referencedSchema); - zephir_array_fetch_string(&referencedSchema, &_15$$8, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 402); - zephir_array_fetch(&_16$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 403); - ZEPHIR_OBS_NVAR(&referencedTable); - zephir_array_fetch_string(&referencedTable, &_16$$8, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 403); - zephir_array_fetch(&_17$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 404); - ZEPHIR_OBS_NVAR(&columns); - zephir_array_fetch_string(&columns, &_17$$8, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 404); - zephir_array_fetch(&_18$$8, &references, &constraintName, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 405); - ZEPHIR_OBS_NVAR(&referencedColumns); - zephir_array_fetch_string(&referencedColumns, &_18$$8, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 405); - } - zephir_array_fetch_long(&_19$$6, &reference, 3, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 408); - zephir_array_append(&columns, &_19$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 408); - zephir_array_fetch_long(&_20$$6, &reference, 4, PH_NOISY | PH_READONLY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 409); - zephir_array_append(&referencedColumns, &_20$$6, PH_SEPARATE, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 409); - ZEPHIR_INIT_NVAR(&_21$$6); - zephir_create_array(&_21$$6, 4, 0); - zephir_array_update_string(&_21$$6, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_21$$6, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_21$$6, SL("columns"), &columns, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_21$$6, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); - zephir_array_update_zval(&references, &constraintName, &_21$$6, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reference); - ZEPHIR_INIT_NVAR(&number); - ZEPHIR_INIT_VAR(&referenceObjects); - array_init(&referenceObjects); - zephir_is_iterable(&references, 0, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 433); - if (Z_TYPE_P(&references) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&references), _24, _25, _22) - { - ZEPHIR_INIT_NVAR(&name); - if (_25 != NULL) { - ZVAL_STR_COPY(&name, _25); - } else { - ZVAL_LONG(&name, _24); - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZVAL_COPY(&arrayReference, _22); - ZEPHIR_INIT_NVAR(&_26$$9); - object_init_ex(&_26$$9, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_27$$9); - zephir_create_array(&_27$$9, 4, 0); - ZEPHIR_OBS_NVAR(&_28$$9); - zephir_array_fetch_string(&_28$$9, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 425); - zephir_array_update_string(&_27$$9, SL("referencedSchema"), &_28$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_28$$9); - zephir_array_fetch_string(&_28$$9, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 426); - zephir_array_update_string(&_27$$9, SL("referencedTable"), &_28$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_28$$9); - zephir_array_fetch_string(&_28$$9, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 427); - zephir_array_update_string(&_27$$9, SL("columns"), &_28$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_28$$9); - zephir_array_fetch_string(&_28$$9, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 429); - zephir_array_update_string(&_27$$9, SL("referencedColumns"), &_28$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_26$$9, "__construct", &_29, 31, &name, &_27$$9); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_26$$9, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &references, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_23, &references, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_23)) { - break; - } - ZEPHIR_CALL_METHOD(&name, &references, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&arrayReference, &references, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_30$$10); - object_init_ex(&_30$$10, phalcon_db_reference_ce); - ZEPHIR_INIT_NVAR(&_31$$10); - zephir_create_array(&_31$$10, 4, 0); - ZEPHIR_OBS_NVAR(&_32$$10); - zephir_array_fetch_string(&_32$$10, &arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 425); - zephir_array_update_string(&_31$$10, SL("referencedSchema"), &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_32$$10); - zephir_array_fetch_string(&_32$$10, &arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 426); - zephir_array_update_string(&_31$$10, SL("referencedTable"), &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_32$$10); - zephir_array_fetch_string(&_32$$10, &arrayReference, SL("columns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 427); - zephir_array_update_string(&_31$$10, SL("columns"), &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_OBS_NVAR(&_32$$10); - zephir_array_fetch_string(&_32$$10, &arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/Db/Adapter/Pdo/Sqlite.zep", 429); - zephir_array_update_string(&_31$$10, SL("referencedColumns"), &_32$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &_30$$10, "__construct", &_29, 31, &name, &_31$$10); - zephir_check_call_status(); - zephir_array_update_zval(&referenceObjects, &name, &_30$$10, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &references, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&arrayReference); - ZEPHIR_INIT_NVAR(&name); - RETURN_CCTOR(&referenceObjects); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, getDefaultValue) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getBelongsTo) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval *model, model_sub, relations, _0, _1; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&relations); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); - object_init_ex(return_value, phalcon_db_rawvalue_ce); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "NULL"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 32, &_0); - zephir_check_call_status(); - RETURN_MM(); + + zephir_read_property(&_0, this_ptr, ZEND_STRL("belongsToSingle"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_get_class(&_1, model, 1); + if (!(zephir_array_isset_fetch(&relations, &_0, &_1, 1))) { + array_init(return_value); + RETURN_MM(); + } + RETURN_CTOR(&relations); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, useExplicitIdValue) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getBelongsToRecords) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *modelName_param = NULL, *modelRelation_param = NULL, *record, record_sub, *parameters = NULL, parameters_sub, *method_param = NULL, __$null, relations, _0, _1, _2, _3, _4; + zval modelName, modelRelation, method, keyRelation; zval *this_ptr = getThis(); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&record_sub); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) + Z_PARAM_OBJECT_OF_CLASS(record, phalcon_mvc_modelinterface_ce) + Z_PARAM_OPTIONAL + Z_PARAM_ZVAL_OR_NULL(parameters) + Z_PARAM_STR_OR_NULL(method) + ZEND_PARSE_PARAMETERS_END(); +#endif - RETURN_BOOL(1); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 2, &modelName_param, &modelRelation_param, &record, ¶meters, &method_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); + } else { + ZEPHIR_INIT_VAR(&modelName); + } + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); + } else { + ZEPHIR_INIT_VAR(&modelRelation); + } + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } + if (!method_param) { + ZEPHIR_INIT_VAR(&method); + } else { + zephir_get_strval(&method, method_param); + } + + + ZEPHIR_INIT_VAR(&_0); + zephir_fast_strtolower(&_0, &modelName); + ZEPHIR_INIT_VAR(&_1); + zephir_fast_strtolower(&_1, &modelRelation); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSV(&_2, &_0, "$", &_1); + zephir_get_strval(&keyRelation, &_2); + ZEPHIR_OBS_VAR(&relations); + zephir_read_property(&_3, this_ptr, ZEND_STRL("hasMany"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&relations, &_3, &keyRelation, 0))) { + RETURN_MM_BOOL(0); + } + zephir_array_fetch_long(&_4, &relations, 0, PH_NOISY | PH_READONLY, "phalcon/Mvc/Model/Manager.zep", 1030); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getrelationrecords", NULL, 0, &_4, record, parameters, &method); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, supportsDefaultValue) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getBuilder) { zval *this_ptr = getThis(); - RETURN_BOOL(0); + RETURN_MEMBER(getThis(), "builder"); } -static PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, getDsnDefaults) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getConnectionService) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval connectionServices; + zval *model, model_sub, *connectionServices_param = NULL, connection, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&connection); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&connectionServices); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + Z_PARAM_ARRAY(connectionServices) + ZEND_PARSE_PARAMETERS_END(); +#endif - array_init(return_value); - return; -} - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &model, &connectionServices_param); + zephir_get_arrval(&connectionServices, connectionServices_param); + ZEPHIR_INIT_VAR(&_0); + zephir_get_class(&_0, model, 1); + if (!(zephir_array_isset_fetch(&connection, &connectionServices, &_0, 1))) { + RETURN_MM_STRING("db"); + } + RETURN_CTOR(&connection); +} -#ifdef HAVE_CONFIG_H +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getCustomEventsManager) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *model, model_sub, eventsManager, _0, _1; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&eventsManager); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); #endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); + zephir_read_property(&_0, this_ptr, ZEND_STRL("customEventsManager"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_get_class(&_1, model, 1); + if (zephir_array_isset_fetch(&eventsManager, &_0, &_1, 1)) { + RETURN_CTOR(&eventsManager); + } + RETURN_MM_NULL(); +} -ZEPHIR_INIT_CLASS(Phalcon_Tag_Exception) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getDI) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Tag, Exception, phalcon, tag_exception, zend_ce_exception, NULL, 0); + zval *this_ptr = getThis(); - return SUCCESS; + + + RETURN_MEMBER(getThis(), "container"); } +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getEventsManager) +{ + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif + RETURN_MEMBER(getThis(), "eventsManager"); +} +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasMany) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *model, model_sub, relations, _0, _1; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) + ZEND_PARSE_PARAMETERS_END(); +#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &model); -ZEPHIR_INIT_CLASS(Phalcon_Tag_Select) -{ - ZEPHIR_REGISTER_CLASS(Phalcon\\Tag, Select, phalcon, tag_select, phalcon_tag_select_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - return SUCCESS; + zephir_read_property(&_0, this_ptr, ZEND_STRL("hasManySingle"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_INIT_VAR(&_1); + zephir_get_class(&_1, model, 1); + if (!(zephir_array_isset_fetch(&relations, &_0, &_1, 1))) { + array_init(return_value); + RETURN_MM(); + } + RETURN_CTOR(&relations); } -static PHP_METHOD(Phalcon_Tag_Select, selectField) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasManyRecords) { - zend_bool _2$$19; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL, *_9 = NULL, *_13 = NULL; - zval *parameters, parameters_sub, *data = NULL, data_sub, __$null, params, name, id, value, useEmpty, code, emptyValue, emptyText, options, using, _3, _5, _0$$5, _6$$22, _7$$22, _8$$23, _10$$23, _11$$23, _12$$25, _14$$25, _15$$25; + zval *modelName_param = NULL, *modelRelation_param = NULL, *record, record_sub, *parameters = NULL, parameters_sub, *method_param = NULL, __$null, relations, _0, _1, _2, _3, _4; + zval modelName, modelRelation, method, keyRelation; zval *this_ptr = getThis(); + ZVAL_UNDEF(&modelName); + ZVAL_UNDEF(&modelRelation); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&keyRelation); + ZVAL_UNDEF(&record_sub); ZVAL_UNDEF(¶meters_sub); - ZVAL_UNDEF(&data_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&id); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&useEmpty); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&emptyValue); - ZVAL_UNDEF(&emptyText); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&using); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_6$$22); - ZVAL_UNDEF(&_7$$22); - ZVAL_UNDEF(&_8$$23); - ZVAL_UNDEF(&_10$$23); - ZVAL_UNDEF(&_11$$23); - ZVAL_UNDEF(&_12$$25); - ZVAL_UNDEF(&_14$$25); - ZVAL_UNDEF(&_15$$25); + ZVAL_UNDEF(&_4); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_ZVAL(parameters) + ZEND_PARSE_PARAMETERS_START(3, 5) + Z_PARAM_STR(modelName) + Z_PARAM_STR(modelRelation) + Z_PARAM_OBJECT_OF_CLASS(record, phalcon_mvc_modelinterface_ce) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL_OR_NULL(data) + Z_PARAM_ZVAL_OR_NULL(parameters) + Z_PARAM_STR_OR_NULL(method) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, ¶meters, &data); - if (!data) { - data = &data_sub; - data = &__$null; + zephir_fetch_params(1, 3, 2, &modelName_param, &modelRelation_param, &record, ¶meters, &method_param); + if (UNEXPECTED(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be of the type string")); + RETURN_MM_NULL(); } - - - if (Z_TYPE_P(parameters) != IS_ARRAY) { - ZEPHIR_INIT_VAR(¶ms); - zephir_create_array(¶ms, 2, 0); - zephir_array_fast_append(¶ms, parameters); - zephir_array_fast_append(¶ms, data); + if (EXPECTED(Z_TYPE_P(modelName_param) == IS_STRING)) { + zephir_get_strval(&modelName, modelName_param); } else { - ZEPHIR_CPY_WRT(¶ms, parameters); - } - ZEPHIR_OBS_VAR(&id); - if (!(zephir_array_isset_long_fetch(&id, ¶ms, 0, 0))) { - zephir_array_fetch_string(&_0$$5, ¶ms, SL("id"), PH_NOISY | PH_READONLY, "phalcon/Tag/Select.zep", 50); - zephir_array_update_long(¶ms, 0, &_0$$5, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - } - if (!(zephir_memnstr_str(&id, SL("["), "phalcon/Tag/Select.zep", 56))) { - if (!(zephir_array_isset_string(¶ms, SL("id")))) { - zephir_array_update_string(¶ms, SL("id"), &id, PH_COPY | PH_SEPARATE); - } + ZEPHIR_INIT_VAR(&modelName); } - ZEPHIR_OBS_VAR(&name); - if (!(zephir_array_isset_string_fetch(&name, ¶ms, SL("name"), 0))) { - zephir_array_update_string(¶ms, SL("name"), &id, PH_COPY | PH_SEPARATE); - } else { - if (!(zephir_is_true(&name))) { - zephir_array_update_string(¶ms, SL("name"), &id, PH_COPY | PH_SEPARATE); - } + if (UNEXPECTED(Z_TYPE_P(modelRelation_param) != IS_STRING && Z_TYPE_P(modelRelation_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelRelation' must be of the type string")); + RETURN_MM_NULL(); } - ZEPHIR_OBS_VAR(&value); - if (!(zephir_array_isset_string_fetch(&value, ¶ms, SL("value"), 0))) { - ZEPHIR_CALL_CE_STATIC(&value, phalcon_tag_ce, "getvalue", &_1, 0, &id, ¶ms); - zephir_check_call_status(); + if (EXPECTED(Z_TYPE_P(modelRelation_param) == IS_STRING)) { + zephir_get_strval(&modelRelation, modelRelation_param); } else { - zephir_array_unset_string(¶ms, SL("value"), PH_SEPARATE); + ZEPHIR_INIT_VAR(&modelRelation); } - ZEPHIR_OBS_VAR(&useEmpty); - if (zephir_array_isset_string_fetch(&useEmpty, ¶ms, SL("useEmpty"), 0)) { - ZEPHIR_OBS_VAR(&emptyValue); - if (!(zephir_array_isset_string_fetch(&emptyValue, ¶ms, SL("emptyValue"), 0))) { - ZEPHIR_INIT_NVAR(&emptyValue); - ZVAL_STRING(&emptyValue, ""); - } else { - zephir_array_unset_string(¶ms, SL("emptyValue"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&emptyText); - if (!(zephir_array_isset_string_fetch(&emptyText, ¶ms, SL("emptyText"), 0))) { - ZEPHIR_INIT_NVAR(&emptyText); - ZVAL_STRING(&emptyText, "Choose..."); - } else { - zephir_array_unset_string(¶ms, SL("emptyText"), PH_SEPARATE); - } - zephir_array_unset_string(¶ms, SL("useEmpty"), PH_SEPARATE); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; } - ZEPHIR_OBS_VAR(&options); - if (!(zephir_array_isset_long_fetch(&options, ¶ms, 1, 0))) { - ZEPHIR_CPY_WRT(&options, data); + if (!method_param) { + ZEPHIR_INIT_VAR(&method); + } else { + zephir_get_strval(&method, method_param); } - if (Z_TYPE_P(&options) == IS_OBJECT) { - ZEPHIR_OBS_VAR(&using); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&using, ¶ms, SL("using"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_tag_exception_ce, "The 'using' parameter is required", "phalcon/Tag/Select.zep", 101); - return; - } - _2$$19 = Z_TYPE_P(&using) != IS_ARRAY; - if (_2$$19) { - _2$$19 = Z_TYPE_P(&using) != IS_OBJECT; - } - if (UNEXPECTED(_2$$19)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_tag_exception_ce, "The 'using' parameter should be an array", "phalcon/Tag/Select.zep", 107); - return; - } + + + ZEPHIR_INIT_VAR(&_0); + zephir_fast_strtolower(&_0, &modelName); + ZEPHIR_INIT_VAR(&_1); + zephir_fast_strtolower(&_1, &modelRelation); + ZEPHIR_INIT_VAR(&_2); + ZEPHIR_CONCAT_VSV(&_2, &_0, "$", &_1); + zephir_get_strval(&keyRelation, &_2); + ZEPHIR_OBS_VAR(&relations); + zephir_read_property(&_3, this_ptr, ZEND_STRL("hasMany"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&relations, &_3, &keyRelation, 0))) { + RETURN_MM_BOOL(0); } - zephir_array_unset_string(¶ms, SL("using"), PH_SEPARATE); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, "", &_5); - if (zephir_is_true(&useEmpty)) { - ZEPHIR_INIT_VAR(&_6$$22); - ZEPHIR_GET_CONSTANT(&_6$$22, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_7$$22); - ZEPHIR_CONCAT_SVSVSV(&_7$$22, "\t", &_6$$22); - zephir_concat_self(&code, &_7$$22); - } - if (Z_TYPE_P(&options) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_10$$23); - ZEPHIR_GET_CONSTANT(&_10$$23, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_11$$23); - ZEPHIR_CONCAT_SV(&_11$$23, "", &_10$$23); - ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 0, &options, &using, &value, &_11$$23); - zephir_check_call_status(); - zephir_concat_self(&code, &_8$$23); - } else { - if (Z_TYPE_P(&options) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_14$$25); - ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_15$$25); - ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); - ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 0, &options, &value, &_15$$25); - zephir_check_call_status(); - zephir_concat_self(&code, &_12$$25); - } - } - zephir_concat_self_str(&code, SL("")); - RETURN_CCTOR(&code); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) +static PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasManyToMany) { - zend_string *_3; - zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; - zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; - zval data; + zval *model, model_sub, relations, _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); - ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&strValue); - ZVAL_UNDEF(&strOptionValue); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&optionValue); - ZVAL_UNDEF(&optionText); - ZVAL_UNDEF(&escaped); + ZVAL_UNDEF(&model_sub); + ZVAL_UNDEF(&relations); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_19$$12); - ZVAL_UNDEF(&_20$$14); - ZVAL_UNDEF(&_21$$15); - ZVAL_UNDEF(&_24$$17); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&closeOption); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_22$$16); - ZVAL_UNDEF(&_23$$16); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_ARRAY(data) - Z_PARAM_ZVAL(value) - Z_PARAM_STR(closeOption) + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(model, phalcon_mvc_modelinterface_ce) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); - zephir_get_arrval(&data, data_param); - zephir_get_strval(&closeOption, closeOption_param); + zephir_fetch_params(1, 1, 0, &model); - ZEPHIR_INIT_VAR(&code); - ZVAL_STRING(&code, ""); - zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&optionValue); - if (_3 != NULL) { - ZVAL_STR_COPY(&optionValue, _3); - } else { - ZVAL_LONG(&optionValue, _2); - } - ZEPHIR_INIT_NVAR(&optionText); - ZVAL_COPY(&optionText, _0); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 287, &optionValue); - zephir_check_call_status(); - if (Z_TYPE_P(&optionText) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_5$$4); - ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 0, &optionText, value, &closeOption); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$4); - ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); - ZEPHIR_INIT_NVAR(&_9$$4); - ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); - zephir_concat_self(&code, &_9$$4); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); - zephir_concat_self(&code, &_19$$12); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_20$$14); - ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); + ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 0, &options, &using, &value, &_11$$23); + zephir_check_call_status(); + zephir_concat_self(&code, &_8$$23); + } else { + if (Z_TYPE_P(&options) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_14$$25); + ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); + ZEPHIR_INIT_VAR(&_15$$25); + ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); + ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 0, &options, &value, &_15$$25); + zephir_check_call_status(); + zephir_concat_self(&code, &_12$$25); + } + } + zephir_concat_self_str(&code, SL("")); + RETURN_CCTOR(&code); } -static PHP_METHOD(Phalcon_Image_Adapter_Imagick, processWatermark) +static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { + zend_string *_3; + zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long offsetX, offsetY, opacity, ZEPHIR_LAST_CALL_STATUS; - zval *image, image_sub, *offsetX_param = NULL, *offsetY_param = NULL, *opacity_param = NULL, result, watermark, _0, _1, _2, _3, _4, _5, _6$$3, _7$$3, _8$$3, _9$$3, _10$$3, _11$$3; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; + zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; + zval data; zval *this_ptr = getThis(); - ZVAL_UNDEF(&image_sub); - ZVAL_UNDEF(&result); - ZVAL_UNDEF(&watermark); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&strValue); + ZVAL_UNDEF(&strOptionValue); + ZVAL_UNDEF(&code); + ZVAL_UNDEF(&optionValue); + ZVAL_UNDEF(&optionText); + ZVAL_UNDEF(&escaped); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$3); - ZVAL_UNDEF(&_8$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_11$$3); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_16$$12); + ZVAL_UNDEF(&_17$$12); + ZVAL_UNDEF(&_18$$12); + ZVAL_UNDEF(&_19$$12); + ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$18); + ZVAL_UNDEF(&closeOption); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$8); + ZVAL_UNDEF(&_22$$16); + ZVAL_UNDEF(&_23$$16); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(4, 4) - Z_PARAM_OBJECT_OF_CLASS(image, phalcon_image_adapter_adapterinterface_ce) - Z_PARAM_LONG(offsetX) - Z_PARAM_LONG(offsetY) - Z_PARAM_LONG(opacity) + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_ARRAY(data) + Z_PARAM_ZVAL(value) + Z_PARAM_STR(closeOption) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 4, 0, &image, &offsetX_param, &offsetY_param, &opacity_param); - offsetX = zephir_get_intval(offsetX_param); - offsetY = zephir_get_intval(offsetY_param); - opacity = zephir_get_intval(opacity_param); + zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); + zephir_get_arrval(&data, data_param); + zephir_get_strval(&closeOption, closeOption_param); - opacity = (long) (zephir_safe_div_long_long(opacity, 100)); - ZEPHIR_INIT_VAR(&watermark); - object_init_ex(&watermark, zephir_get_internal_ce(SL("imagick"))); - ZEPHIR_CALL_METHOD(NULL, &watermark, "__construct", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_0, image, "render", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &watermark, "readimageblob", NULL, 0, &_0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, "Imagick::EVALUATE_MULTIPLY"); - ZEPHIR_CALL_FUNCTION(&_2, "constant", NULL, 115, &_1); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "Imagick::CHANNEL_ALPHA"); - ZEPHIR_CALL_FUNCTION(&_3, "constant", NULL, 115, &_1); - zephir_check_call_status(); - ZVAL_LONG(&_4, opacity); - ZEPHIR_CALL_METHOD(NULL, &watermark, "evaluateimage", NULL, 0, &_2, &_4, &_3); - zephir_check_call_status(); - zephir_read_property(&_4, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZVAL_LONG(&_5, 0); - ZEPHIR_CALL_METHOD(NULL, &_4, "setiteratorindex", NULL, 0, &_5); - zephir_check_call_status(); - while (1) { - if (!(1)) { - break; - } - zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_NVAR(&_7$$3); - ZVAL_STRING(&_7$$3, "Imagick::COMPOSITE_OVER"); - ZEPHIR_CALL_FUNCTION(&_8$$3, "constant", NULL, 115, &_7$$3); - zephir_check_call_status(); - ZVAL_LONG(&_9$$3, offsetX); - ZVAL_LONG(&_10$$3, offsetY); - ZEPHIR_CALL_METHOD(&result, &_6$$3, "compositeimage", NULL, 0, &watermark, &_8$$3, &_9$$3, &_10$$3); - zephir_check_call_status(); - if (!ZEPHIR_IS_TRUE_IDENTICAL(&result)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_image_exception_ce, "Imagick::compositeImage failed", "phalcon/Image/Adapter/Imagick.zep", 893); - return; - } - zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_METHOD(&_11$$3, &_9$$3, "nextimage", NULL, 0); + ZEPHIR_INIT_VAR(&code); + ZVAL_STRING(&code, ""); + zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&optionValue); + if (_3 != NULL) { + ZVAL_STR_COPY(&optionValue, _3); + } else { + ZVAL_LONG(&optionValue, _2); + } + ZEPHIR_INIT_NVAR(&optionText); + ZVAL_COPY(&optionText, _0); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 285, &optionValue); + zephir_check_call_status(); + if (Z_TYPE_P(&optionText) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); + ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 0, &optionText, value, &closeOption); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$4); + ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); + zephir_concat_self(&code, &_9$$4); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_10$$6); + ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); + zephir_concat_self(&code, &_19$$12); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_20$$14); + ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t